akskubeconfig 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- akskubeconfig-1.0.0/LICENSE +21 -0
- akskubeconfig-1.0.0/PKG-INFO +128 -0
- akskubeconfig-1.0.0/README.md +104 -0
- akskubeconfig-1.0.0/akskubeconfig/__init__.py +0 -0
- akskubeconfig-1.0.0/akskubeconfig/command.py +501 -0
- akskubeconfig-1.0.0/akskubeconfig/errors.py +46 -0
- akskubeconfig-1.0.0/akskubeconfig/helpers.py +253 -0
- akskubeconfig-1.0.0/akskubeconfig/test_command.py +516 -0
- akskubeconfig-1.0.0/akskubeconfig/test_errors.py +88 -0
- akskubeconfig-1.0.0/akskubeconfig/test_helpers.py +135 -0
- akskubeconfig-1.0.0/akskubeconfig/test_types.py +150 -0
- akskubeconfig-1.0.0/akskubeconfig/types.py +311 -0
- akskubeconfig-1.0.0/pyproject.toml +31 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 NielsenIQ, Inc. and contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: akskubeconfig
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A utility to genearate kubeconfig for AKS clusters in bulk across one or multiple subscriptions
|
|
5
|
+
Home-page: https://github.com/niq-ccoe-platform-engineering/akskubeconfig
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: aks,kubeconfig,kubernetes
|
|
8
|
+
Author: Cameron Larsen
|
|
9
|
+
Author-email: cameron.larsen@nielseniq.com
|
|
10
|
+
Requires-Python: >=3.10,<4.0
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Requires-Dist: PyYAML (>=6.0.2,<7.0.0)
|
|
18
|
+
Requires-Dist: azure-identity (>=1.19.0,<2.0.0)
|
|
19
|
+
Requires-Dist: azure-mgmt-containerservice (>=32.0.0,<33.0.0)
|
|
20
|
+
Requires-Dist: azure-mgmt-subscription (>=3.1.1,<4.0.0)
|
|
21
|
+
Project-URL: Repository, https://github.com/niq-ccoe-platform-engineering/akskubeconfig
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
<!-- Space: CLDCOE -->
|
|
25
|
+
<!-- Parent: NIQ Managed Actions -->
|
|
26
|
+
<!-- Type: page -->
|
|
27
|
+
<!-- Layout: article -->
|
|
28
|
+
# akskubeconfig
|
|
29
|
+
<!-- Include: disclaimer.tmpl -->
|
|
30
|
+
<!-- Include: ac:toc -->
|
|
31
|
+
|
|
32
|
+
A utility to generate a kubeconfig file for all AKS clusters in one or more Azure subscriptions.
|
|
33
|
+
|
|
34
|
+
## Why
|
|
35
|
+
|
|
36
|
+
Managing and updating a Kubernetes configuration file for AKS clusters can be a
|
|
37
|
+
nightmare when you manage multiple clusters across multiple subscriptions. This
|
|
38
|
+
tool aims to simplify the process by generating a kubeconfig file for all AKS
|
|
39
|
+
clusters that you have access to in all subscriptions that you have access to.
|
|
40
|
+
|
|
41
|
+
While checking all subscriptions is default behavior, you can also specify a
|
|
42
|
+
list of subscriptions to check. This can be useful if you have access to a large
|
|
43
|
+
number of subscriptions and only want to check a subset of them.
|
|
44
|
+
|
|
45
|
+
It also supports generating that kubeconfig file using a number of different
|
|
46
|
+
authentication flows, including:
|
|
47
|
+
|
|
48
|
+
- Default (using the default authentication flow)
|
|
49
|
+
- Device Flow (using the device flow authentication flow)
|
|
50
|
+
- Interactive (using the interactive web browser authentication flow)
|
|
51
|
+
- Service Principal Secret (using a service principal secret to authenticate)
|
|
52
|
+
- Service Principal PFX (using a service principal pfx certificate to authenticate)
|
|
53
|
+
- Managed Identity (using a managed identity to authenticate)
|
|
54
|
+
- Managed Identity ID (using a managed identity to authenticate)
|
|
55
|
+
- Azure CLI (using the Azure CLI to authenticate)
|
|
56
|
+
- Workload Identity (using a workload identity to authenticate)
|
|
57
|
+
|
|
58
|
+
This can be useful for a number of reasons, such as generating a bulk kubeconfig
|
|
59
|
+
file on-the-fly for CI/CD pipelines, or for generating a kubeconfig file for a
|
|
60
|
+
specific cluster in a specific subscription.
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
`akskubeconfig` is implemented in Python. Assuming you have a
|
|
65
|
+
Python interpreter and pip installed you should be able to install with:
|
|
66
|
+
|
|
67
|
+
```shell
|
|
68
|
+
pip install akskubeconfig
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
> This has not yet been widely tested and is currently in a _works on my
|
|
72
|
+
machine_ state.
|
|
73
|
+
|
|
74
|
+
## Usage
|
|
75
|
+
|
|
76
|
+
The simplest usage is to just run the tool and specify an output file for it to write to:
|
|
77
|
+
|
|
78
|
+
```shell
|
|
79
|
+
akskubeconfig -o ~/.kube/config
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
This will generate a set of schemas in a `schemas` directory. The tool
|
|
83
|
+
provides a number of options to modify the output:
|
|
84
|
+
|
|
85
|
+
```shell
|
|
86
|
+
akskubeconfig --help
|
|
87
|
+
usage: akskubeconfig [-h] [-v] [-s SUBSCRIPTIONS] [--client-id CLIENT_ID] [--tenant-id TENANT_ID] [--client-secret CLIENT_SECRET] [--certificate-path CERTIFICATE_PATH]
|
|
88
|
+
[--server-id SERVER_ID] [--environment ENVIRONMENT]
|
|
89
|
+
[--default | --device-flow | --interactive | --sp-secret | --sp-pfx | --managed-identity | --managed-identity-id | --az-cli | --workload-identity --json | --yaml]
|
|
90
|
+
[-m MAX_THREADS] [-o OUTFILE]
|
|
91
|
+
|
|
92
|
+
options:
|
|
93
|
+
-h, --help show this help message and exit
|
|
94
|
+
-v, --verbose Increase output verbosity
|
|
95
|
+
-s SUBSCRIPTIONS, --subscriptions SUBSCRIPTIONS
|
|
96
|
+
A comma separated list of subscription to use. If omitted, all subscriptions will be checked.
|
|
97
|
+
--client-id CLIENT_ID
|
|
98
|
+
Override the client id to write into the kubeconfig. Only applicable if required by the selected authentication flow.
|
|
99
|
+
--tenant-id TENANT_ID
|
|
100
|
+
Override the tenant id to write into the kubeconfig. Only applicable if required by the selected authentication flow.
|
|
101
|
+
--client-secret CLIENT_SECRET
|
|
102
|
+
Override the client secret to write into the kubeconfig. Only applicable if required by the selected authentication flow.
|
|
103
|
+
--certificate-path CERTIFICATE_PATH
|
|
104
|
+
Override the certificate path to write into the kubeconfig. Only applicable if required by the selected authentication flow.
|
|
105
|
+
--server-id SERVER_ID
|
|
106
|
+
Override the server id to write into the kubeconfig.
|
|
107
|
+
--environment ENVIRONMENT
|
|
108
|
+
Override the environment to write into the kubeconfig.
|
|
109
|
+
--default Use the default flow authenticate within the generated kubeconfig (default)
|
|
110
|
+
--device-flow Use device flow to authenticate within the generated kubeconfig
|
|
111
|
+
--interactive Use the interactive web browser flow to authenticate within the generated kubeconfig
|
|
112
|
+
--sp-secret Use a service principal secret to authenticate within the generated kubeconfig
|
|
113
|
+
--sp-pfx Use a service principal pfx certificate to authenticate within the generated kubeconfig
|
|
114
|
+
--managed-identity Use a managed identity to authenticate within the generated kubeconfig
|
|
115
|
+
--managed-identity-id
|
|
116
|
+
Use a managed identity to authenticate within the generated kubeconfig
|
|
117
|
+
--az-cli Use the Azure CLI to authenticate within the generated kubeconfig
|
|
118
|
+
--workload-identity Use a workload identity to authenticate within the generated kubeconfig
|
|
119
|
+
--json Output as JSON
|
|
120
|
+
--yaml Output as YAML (default)
|
|
121
|
+
-m MAX_THREADS, --max-threads MAX_THREADS
|
|
122
|
+
Maximum number of threads to use
|
|
123
|
+
-o OUTFILE, --outfile OUTFILE
|
|
124
|
+
Output file
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
<!-- Include: footer.tmpl -->
|
|
128
|
+
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<!-- Space: CLDCOE -->
|
|
2
|
+
<!-- Parent: NIQ Managed Actions -->
|
|
3
|
+
<!-- Type: page -->
|
|
4
|
+
<!-- Layout: article -->
|
|
5
|
+
# akskubeconfig
|
|
6
|
+
<!-- Include: disclaimer.tmpl -->
|
|
7
|
+
<!-- Include: ac:toc -->
|
|
8
|
+
|
|
9
|
+
A utility to generate a kubeconfig file for all AKS clusters in one or more Azure subscriptions.
|
|
10
|
+
|
|
11
|
+
## Why
|
|
12
|
+
|
|
13
|
+
Managing and updating a Kubernetes configuration file for AKS clusters can be a
|
|
14
|
+
nightmare when you manage multiple clusters across multiple subscriptions. This
|
|
15
|
+
tool aims to simplify the process by generating a kubeconfig file for all AKS
|
|
16
|
+
clusters that you have access to in all subscriptions that you have access to.
|
|
17
|
+
|
|
18
|
+
While checking all subscriptions is default behavior, you can also specify a
|
|
19
|
+
list of subscriptions to check. This can be useful if you have access to a large
|
|
20
|
+
number of subscriptions and only want to check a subset of them.
|
|
21
|
+
|
|
22
|
+
It also supports generating that kubeconfig file using a number of different
|
|
23
|
+
authentication flows, including:
|
|
24
|
+
|
|
25
|
+
- Default (using the default authentication flow)
|
|
26
|
+
- Device Flow (using the device flow authentication flow)
|
|
27
|
+
- Interactive (using the interactive web browser authentication flow)
|
|
28
|
+
- Service Principal Secret (using a service principal secret to authenticate)
|
|
29
|
+
- Service Principal PFX (using a service principal pfx certificate to authenticate)
|
|
30
|
+
- Managed Identity (using a managed identity to authenticate)
|
|
31
|
+
- Managed Identity ID (using a managed identity to authenticate)
|
|
32
|
+
- Azure CLI (using the Azure CLI to authenticate)
|
|
33
|
+
- Workload Identity (using a workload identity to authenticate)
|
|
34
|
+
|
|
35
|
+
This can be useful for a number of reasons, such as generating a bulk kubeconfig
|
|
36
|
+
file on-the-fly for CI/CD pipelines, or for generating a kubeconfig file for a
|
|
37
|
+
specific cluster in a specific subscription.
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
`akskubeconfig` is implemented in Python. Assuming you have a
|
|
42
|
+
Python interpreter and pip installed you should be able to install with:
|
|
43
|
+
|
|
44
|
+
```shell
|
|
45
|
+
pip install akskubeconfig
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
> This has not yet been widely tested and is currently in a _works on my
|
|
49
|
+
machine_ state.
|
|
50
|
+
|
|
51
|
+
## Usage
|
|
52
|
+
|
|
53
|
+
The simplest usage is to just run the tool and specify an output file for it to write to:
|
|
54
|
+
|
|
55
|
+
```shell
|
|
56
|
+
akskubeconfig -o ~/.kube/config
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
This will generate a set of schemas in a `schemas` directory. The tool
|
|
60
|
+
provides a number of options to modify the output:
|
|
61
|
+
|
|
62
|
+
```shell
|
|
63
|
+
akskubeconfig --help
|
|
64
|
+
usage: akskubeconfig [-h] [-v] [-s SUBSCRIPTIONS] [--client-id CLIENT_ID] [--tenant-id TENANT_ID] [--client-secret CLIENT_SECRET] [--certificate-path CERTIFICATE_PATH]
|
|
65
|
+
[--server-id SERVER_ID] [--environment ENVIRONMENT]
|
|
66
|
+
[--default | --device-flow | --interactive | --sp-secret | --sp-pfx | --managed-identity | --managed-identity-id | --az-cli | --workload-identity --json | --yaml]
|
|
67
|
+
[-m MAX_THREADS] [-o OUTFILE]
|
|
68
|
+
|
|
69
|
+
options:
|
|
70
|
+
-h, --help show this help message and exit
|
|
71
|
+
-v, --verbose Increase output verbosity
|
|
72
|
+
-s SUBSCRIPTIONS, --subscriptions SUBSCRIPTIONS
|
|
73
|
+
A comma separated list of subscription to use. If omitted, all subscriptions will be checked.
|
|
74
|
+
--client-id CLIENT_ID
|
|
75
|
+
Override the client id to write into the kubeconfig. Only applicable if required by the selected authentication flow.
|
|
76
|
+
--tenant-id TENANT_ID
|
|
77
|
+
Override the tenant id to write into the kubeconfig. Only applicable if required by the selected authentication flow.
|
|
78
|
+
--client-secret CLIENT_SECRET
|
|
79
|
+
Override the client secret to write into the kubeconfig. Only applicable if required by the selected authentication flow.
|
|
80
|
+
--certificate-path CERTIFICATE_PATH
|
|
81
|
+
Override the certificate path to write into the kubeconfig. Only applicable if required by the selected authentication flow.
|
|
82
|
+
--server-id SERVER_ID
|
|
83
|
+
Override the server id to write into the kubeconfig.
|
|
84
|
+
--environment ENVIRONMENT
|
|
85
|
+
Override the environment to write into the kubeconfig.
|
|
86
|
+
--default Use the default flow authenticate within the generated kubeconfig (default)
|
|
87
|
+
--device-flow Use device flow to authenticate within the generated kubeconfig
|
|
88
|
+
--interactive Use the interactive web browser flow to authenticate within the generated kubeconfig
|
|
89
|
+
--sp-secret Use a service principal secret to authenticate within the generated kubeconfig
|
|
90
|
+
--sp-pfx Use a service principal pfx certificate to authenticate within the generated kubeconfig
|
|
91
|
+
--managed-identity Use a managed identity to authenticate within the generated kubeconfig
|
|
92
|
+
--managed-identity-id
|
|
93
|
+
Use a managed identity to authenticate within the generated kubeconfig
|
|
94
|
+
--az-cli Use the Azure CLI to authenticate within the generated kubeconfig
|
|
95
|
+
--workload-identity Use a workload identity to authenticate within the generated kubeconfig
|
|
96
|
+
--json Output as JSON
|
|
97
|
+
--yaml Output as YAML (default)
|
|
98
|
+
-m MAX_THREADS, --max-threads MAX_THREADS
|
|
99
|
+
Maximum number of threads to use
|
|
100
|
+
-o OUTFILE, --outfile OUTFILE
|
|
101
|
+
Output file
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
<!-- Include: footer.tmpl -->
|
|
File without changes
|