Skip to content

Commit a9ec99d

Browse files
jonathan-innisyuyue9284Yue Yuliakaz
authored
[k8s-configuration] Release v1.2.0 with Flux v2 Support (Azure#4100)
* Create pull.yml * Update pull.yml * Update azure-pipelines.yml * Initial commit of k8s-extension * Update CODEOWNERS * Update azure-pipelines.yml * Create pull.yml * Update pull.yml * Update pull.yml * Update pipelines file * Update k8s-configuration name * Update test script params * Update pipeline file * Remove codeowners * Update pipelines file * Update CODEOWNERS * Update private preview pipelines * Remove open service mesh from public release * Update pipeline files * Update custom pipelines files * Add publish step to k8s-configuration * Update pipeline to publish extension * Update public extension pipeline * Change condition variable * Update pipeline naming * Add version to public preview/private preview * Update pipelines * Add different testing based on private branch * Add annotations to extension model * Update k8s-custom-pipelines.yml * Update SDKs with Updated Swagger Spec for 2020-07-01-preview (#13) * Update sdks with updated swagger spec * Update version and history rst * Reorder release history timeline * Fix ExtensionInstanceForCreate for import * remove py2 bdist support * Add custom table formatting * Remove unnecessary files * Fix style issues * Fix branch based on comments * Update identity piece manually * Don't handle defaults at the CLI level * Remove defaults from CLI client * Check null target namespace with namespace scope * Update style * Add cassandra operator and location to model * Stage Public Version of k8s-extension 0.2.0 for official release (#15) * Create pull.yml * Update pull.yml * Update azure-pipelines.yml * Initial commit of k8s-extension * Update pipelines file * Update CODEOWNERS * Update private preview pipelines * Remove open service mesh from public release * Update pipeline files * Update public extension pipeline * Change condition variable * Add version to public preview/private preview * Update pipelines * Add different testing based on private branch * Add annotations to extension model * Update k8s-custom-pipelines.yml * Update SDKs with Updated Swagger Spec for 2020-07-01-preview (#13) * Update sdks with updated swagger spec * Update version and history rst * Reorder release history timeline * Fix ExtensionInstanceForCreate for import * remove py2 bdist support * Add custom table formatting * Remove unnecessary files * Fix style issues * Fix branch based on comments * Update identity piece manually * Don't handle defaults at the CLI level * Remove defaults from CLI client * Check null target namespace with namespace scope * Update style * Add cassandra operator and location to model Co-authored-by: action@github.com <Action - Fork Sync> * Remove custom pipelines file * Update extension description, remove private const * Update pipeline file * Disable check ref docs * Disable refs docs * Update to include better create warning logs and remove update context (#20) * Update to include better create warning logs and remove update context * Remove help text for update * Fix spelling error * Update message * Fix k8s-extension conflict with private version * Fix style errors * Fix filename * add customization for microsoft.azureml.kubernetes (#23) * add customization for microsoft.azureml.kubernetes * Update release history Co-authored-by: Yue Yu <yuyu3@microsoft.com> Co-authored-by: jonathan-innis <jonathan.innis.ji@gmail.com> * Add E2E Testing from Separate branch into internal code (#26) * Add internal e2e testing * Change to testing folder * Inference CLI validation for Scoring FE (#24) * cli validation starter * added the call to the fe validation function * nodeport validation not required * test fix Co-authored-by: Jonathan Innis <jonathan.innis.ji@gmail.com> * legal warning added (#27) * Remove deprecated method logger.warn * Update k8s-custom-pipelines.yml for Azure Pipelines * Update k8s-custom-pipelines.yml for Azure Pipelines * Add Azure Defender to E2E testing (#28) * Add azure defender testing to e2e * Remove the debug flag * Add configuration testing * Fix pipeline failures * Make test script more intuitive * Remove parameter from testing * Add some debug * Fix wrong location for k8s config whl * Fix pip install upgrade issue * Fix pip install upgrade issue * Add Check for Provider Registration and Refactor (#19) * Add check for provider registration and refactor * Fix bug in checking registration * Add license header to utils * Update private key check and error messaging * Update based on refactoring * Fix failing tests * Add provider registration check * Create a test for uppercase url, address comments * Add blank line to fix style check * Testing increase to ubuntu-latest * Update k8s-configuration Models to Track2 (Azure#63) * Update models to track2 * Increase k8s-configuration version number * Update kind version * Change error to warning because of DSA failure * Upgrade helm operator chart version (Azure#75) * Pin helm version * Bump version * Migrate pipeline (Azure#90) * Disable updates on configuration tests (Azure#89) * Release k8s-configuration v1.2.0 for Flux v2 Public Preview (Azure#86) * Scaffold out the k8s-config package * Base implementation of CLI commands * Add create scenario and cleanup in consts * Add help text to commands, params * Add other clients to client factory * Automatically installing the flux extension * Move flux and extension into modules * Updated the versioned sdks * Push working command for testing * Update to multi api versioned sdk * Support other extension methods * Fix nullity check * Add source control provider * Add scc commands * Add defer logic for create with cache * Use default extension with identity * Fix identity creation * Add kustomization caching * Add formatters * Add scc provider * Add help text for k8s-config fluxv1 * Add help text for extension * Allow force delete of extension and fluxconfiguration * Add location to the extension model * Update with latest from k8s-extension * Add k8s-config testing * Add license header * Fix all style issues * Update codeowners file * Validate data before checking cluster compliance * No kustomizations warning * Fix identity issue in 2020-07-01 * Fix k8s regex * Fix configuration name regex validation * Fix name length validation * Adding some validation warnings * Add protected settings to request * Exclude private test path * Add suspend functionality * Add correct values to build Kustomization * Add no_wait * Fix style issues * Use base64 encoded httpsUser * Fix formatting error and base64 encoding error * Fix style issues * Fix force * Updated help text * Style fixes * Increase namespace maximum len * Add managed cluster support to k8s-config * Custom confirmation when prune is enabled * Add flux commands to existing k8s-configuration * Remove extension provider from CLI * Fix style issues * Override extension variables * Strip newlines from known_hosts file * Update help text and validators * Strip newlines from known hosts * Add provisioning state check for flux extension * Pin helm version * Remove validation from create command * Add patch support with new SDK * Add implementation for CRUD of source and kustomization * Fix errors on patch * Fix some bugs in patching properties * Add fixes for patch in k8s-configuraiton * Change duration formatting in table output * Add validation and conversion for durations * Bump verison and fix typo * Fix bug with dependencies * Fix linter and style issues * Fix delete prune check * Add flux testing * Create separate jobs for scenarios * Update error text * Remove unneeded files * Fix filepath suggestion from CLI team * Fix unneeded file edit Co-authored-by: action@github.com <Action - Fork Sync> Co-authored-by: yuyue9284 <15863499+yuyue9284@users.noreply.github.com> Co-authored-by: Yue Yu <yuyu3@microsoft.com> Co-authored-by: Lia Kazakova <58274127+liakaz@users.noreply.github.com>
1 parent 84bf6ad commit a9ec99d

167 files changed

Lines changed: 30742 additions & 1147 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/k8s-configuration/HISTORY.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
Release History
44
===============
55

6+
1.2.0
7+
++++++++++++++++++
8+
* Add Flux v2 support with command subgroups
9+
* Add update support to Flux v2 resources
10+
611
1.1.1
712
++++++++++++++++++
813
* Enable helm-operator chart version 1.4.0

src/k8s-configuration/README.rst

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,57 @@ az extension add --name k8s-configuration
1111
```
1212

1313
### Included Features
14-
#### Kubernetes Configuration:
15-
Kubernetes SourceControl Configuration: [more info](https://docs.microsoft.com/en-us/azure/kubernetessconfiguration/)\
14+
15+
#### Flux Configuration (Flux v2):
16+
Flux Configuration (Flux v1) Configuration: [more info](https://docs.microsoft.com/en-us/azure/kubernetessconfiguration/)\
17+
*Examples:*
18+
19+
##### Create a Flux Configuration (Flux v2)
20+
```
21+
az k8s-configuration create flux \
22+
--resource-group groupName \
23+
--cluster-name clusterName \
24+
--cluster-type clusterType \
25+
--name configurationName \
26+
--namespace configurationNamespace \
27+
--scope cluster
28+
--kind git \
29+
--url https://github.com/Azure/arc-k8s-demo \
30+
--branch main \
31+
--kustomization name=my-kustomization
32+
```
33+
34+
##### Get a Flux Configuration (Flux v2)
35+
```
36+
az k8s-configuration flux show \
37+
--resource-group groupName \
38+
--cluster-name clusterName \
39+
--cluster-type clusterType \
40+
--name configurationName
41+
```
42+
43+
##### Delete a Flux Configuration (Flux v2)
44+
```
45+
az k8s-configuration flux delete \
46+
--resource-group groupName \
47+
--cluster-name clusterName \
48+
--cluster-type clusterType \
49+
--name configurationName
50+
```
51+
52+
##### List all Flux Configuration (Flux v2) on a cluster
53+
```
54+
az k8s-configuration flux list \
55+
--resource-group groupName \
56+
--cluster-name clusterName \
57+
--cluster-type clusterType
58+
```
59+
60+
#### Source Control Configuration (Flux v1):
61+
Source Control Configuration (Flux v1) Configuration: [more info](https://docs.microsoft.com/en-us/azure/kubernetessconfiguration/)\
1662
*Examples:*
1763

18-
##### Create a KubernetesConfiguration
64+
##### Create a Source Control Configuration (Flux v1)
1965
```
2066
az k8s-configuration create \
2167
--resource-group groupName \
@@ -31,7 +77,7 @@ az k8s-configuration create \
3177
--helm-operator-params chartParameters
3278
```
3379

34-
##### Get a KubernetesConfiguration
80+
##### Get a Source Control Configuration (Flux v1)
3581
```
3682
az k8s-configuration show \
3783
--resource-group groupName \
@@ -40,7 +86,7 @@ az k8s-configuration show \
4086
--name configurationName
4187
```
4288

43-
##### Delete a KubernetesConfiguration
89+
##### Delete a Source Control Configuration (Flux v1)
4490
```
4591
az k8s-configuration delete \
4692
--resource-group groupName \
@@ -49,7 +95,7 @@ az k8s-configuration delete \
4995
--name configurationName
5096
```
5197

52-
##### Update a KubernetesConfiguration
98+
##### Update a Source Control Configuration (Flux v1)
5399
```
54100
az k8s-configuration create \
55101
--resource-group groupName \
@@ -63,7 +109,7 @@ az k8s-configuration create \
63109
--helm-operator-params chartParameters
64110
```
65111

66-
##### List all KubernetesConfigurations of a cluster
112+
##### List all Source Control Configuration (Flux v1) on a cluster
67113
```
68114
az k8s-configuration list \
69115
--resource-group groupName \

src/k8s-configuration/azext_k8s_configuration/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ class K8sConfigurationCommandsLoader(AzCommandsLoader):
1212

1313
def __init__(self, cli_ctx=None):
1414
from azure.cli.core.commands import CliCommandType
15-
from azext_k8s_configuration._client_factory import cf_k8s_configuration
15+
from azext_k8s_configuration._client_factory import k8s_configuration_client
1616
k8s_configuration_custom = CliCommandType(
1717
operations_tmpl='azext_k8s_configuration.custom#{}',
18-
client_factory=cf_k8s_configuration)
19-
super(K8sConfigurationCommandsLoader, self).__init__(cli_ctx=cli_ctx,
20-
custom_command_type=k8s_configuration_custom)
18+
client_factory=k8s_configuration_client)
19+
super().__init__(cli_ctx=cli_ctx,
20+
custom_command_type=k8s_configuration_custom)
2121

2222
def load_command_table(self, args):
2323
from azext_k8s_configuration.commands import load_command_table

src/k8s-configuration/azext_k8s_configuration/_client_factory.py

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,45 @@
44
# --------------------------------------------------------------------------------------------
55

66
from azure.cli.core.commands.client_factory import get_mgmt_service_client
7+
from azure.cli.core.profiles import ResourceType
8+
from . import consts
79

810

9-
def cf_k8s_configuration(cli_ctx, *_):
11+
def k8s_configuration_client(cli_ctx, **kwargs):
1012
from azext_k8s_configuration.vendored_sdks import SourceControlConfigurationClient
11-
return get_mgmt_service_client(cli_ctx, SourceControlConfigurationClient)
13+
return get_mgmt_service_client(cli_ctx, SourceControlConfigurationClient, **kwargs)
1214

1315

14-
def cf_k8s_configuration_operation(cli_ctx, _):
15-
return cf_k8s_configuration(cli_ctx).source_control_configurations
16+
def k8s_configuration_fluxconfig_client(cli_ctx, *_):
17+
return k8s_configuration_client(cli_ctx, api_version=consts.FLUXCONFIG_API_VERSION).flux_configurations
1618

1719

18-
def _resource_providers_client(cli_ctx):
20+
def k8s_configuration_sourcecontrol_client(cli_ctx, *_):
21+
return k8s_configuration_client(
22+
cli_ctx,
23+
api_version=consts.SOURCE_CONTROL_API_VERSION
24+
).source_control_configurations
25+
26+
27+
def k8s_configuration_extension_client(cli_ctx, *_):
28+
return k8s_configuration_client(cli_ctx, api_version=consts.EXTENSION_API_VERSION).extensions
29+
30+
31+
def resource_providers_client(cli_ctx):
1932
from azure.mgmt.resource import ResourceManagementClient
2033
return get_mgmt_service_client(cli_ctx, ResourceManagementClient).providers
34+
35+
36+
def cf_resource_groups(cli_ctx, subscription_id=None):
37+
return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES,
38+
subscription_id=subscription_id).resource_groups
39+
40+
41+
def cf_resources(cli_ctx, subscription_id=None):
42+
return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES,
43+
subscription_id=subscription_id).resources
44+
45+
46+
def cf_log_analytics(cli_ctx, subscription_id=None):
47+
from azure.mgmt.loganalytics import LogAnalyticsManagementClient # pylint: disable=no-name-in-module
48+
return get_mgmt_service_client(cli_ctx, LogAnalyticsManagementClient, subscription_id=subscription_id)

src/k8s-configuration/azext_k8s_configuration/_format.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/k8s-configuration/azext_k8s_configuration/_help.py

Lines changed: 123 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@
66

77
from knack.help_files import helps # pylint: disable=unused-import
88

9-
109
helps['k8s-configuration'] = """
1110
type: group
12-
short-summary: Commands to manage Kubernetes configuration.
11+
short-summary: Commands to manage resources from Microsoft.KubernetesConfiguration.
1312
"""
1413

1514
helps['k8s-configuration create'] = """
1615
type: command
17-
short-summary: Create a Kubernetes configuration.
16+
short-summary: Create a Flux v1 Kubernetes configuration (This command is for Flux v1, to use the newer Flux v2, run "az k8s-configuration flux create").
1817
examples:
19-
- name: Create a Kubernetes configuration
18+
- name: Create a Flux v1 Kubernetes configuration
2019
text: |-
2120
az k8s-configuration create --resource-group MyResourceGroup --cluster-name MyClusterName \\
2221
--cluster-type connectedClusters --name MyGitConfig --operator-instance-name OperatorInst01 \\
@@ -29,42 +28,149 @@
2928

3029
helps['k8s-configuration list'] = """
3130
type: command
32-
short-summary: List Kubernetes configurations.
31+
short-summary: List Flux v1 Kubernetes configurations (This command is for Flux v1, to use the newer Flux v2, run "az k8s-configuration flux list").
3332
examples:
34-
- name: List all Kubernetes configurations of a cluster
33+
- name: List Flux v1 Kubernetes configuration
3534
text: |-
3635
az k8s-configuration list --resource-group MyResourceGroup --cluster-name MyClusterName \\
3736
--cluster-type connectedClusters
3837
"""
3938

4039
helps['k8s-configuration delete'] = """
4140
type: command
42-
short-summary: Delete a Kubernetes configuration.
41+
short-summary: Delete a Flux v1 Kubernetes configuration (This command is for Flux v1, to use the newer Flux v2, run "az k8s-configuration flux delete").
4342
examples:
44-
- name: Delete a Kubernetes configuration
43+
- name: Delete a Flux v1 Kubernetes configuration
4544
text: |-
4645
az k8s-configuration delete --resource-group MyResourceGroup --cluster-name MyClusterName \\
4746
--cluster-type connectedClusters --name MyConfigurationName
4847
"""
4948

5049
helps['k8s-configuration show'] = """
5150
type: command
52-
short-summary: Show details of a Kubernetes configuration.
51+
short-summary: Show details of a Flux v1 Kubernetes configuration (This command is for Flux v1, to use the newer Flux v2, run "az k8s-configuration flux show").
5352
examples:
54-
- name: Show a Kubernetes configuration
53+
- name: Show details of a Flux v1 Kubernetes configuration
5554
text: |-
5655
az k8s-configuration show --resource-group MyResourceGroup --cluster-name MyClusterName \\
5756
--cluster-type connectedClusters --name MyConfigurationName
5857
"""
5958

60-
helps['k8s-configuration update'] = """
59+
helps['k8s-configuration flux'] = """
60+
type: group
61+
short-summary: Commands to manage Flux v2 Kubernetes configurations.
62+
"""
63+
64+
helps['k8s-configuration flux create'] = """
65+
type: command
66+
short-summary: Create a Kubernetes Flux v2 Configuration.
67+
examples:
68+
- name: Create a Kubernetes v2 Flux Configuration
69+
text: |-
70+
az k8s-configuration flux create --resource-group my-resource-group \\
71+
--cluster-name mycluster --cluster-type connectedClusters \\
72+
--name myconfig --scope cluster --namespace my-namespace \\
73+
--kind git --url https://github.com/Azure/arc-k8s-demo \\
74+
--branch main --kustomization name=my-kustomization
75+
"""
76+
77+
helps['k8s-configuration flux update'] = """
78+
type: command
79+
short-summary: Update a Kubernetes Flux v2 Configuration.
80+
examples:
81+
- name: Update a Kubernetes v2 Flux Configuration
82+
text: |-
83+
az k8s-configuration flux update --resource-group my-resource-group \\
84+
--cluster-name mycluster --cluster-type connectedClusters --name myconfig \\
85+
--url https://github.com/Azure/arc-k8s-demo --branch main \\
86+
--kustomization name=my-kustomization path=./my/new-path
87+
"""
88+
89+
helps['k8s-configuration flux list'] = """
90+
type: command
91+
short-summary: List Kubernetes Flux v2 Configurations.
92+
examples:
93+
- name: List all Kubernetes Flux v2 Configurations on a cluster
94+
text: |-
95+
az k8s-configuration flux list --resource-group my-resource-group \\
96+
--cluster-name mycluster --cluster-type connectedClusters
97+
"""
98+
99+
helps['k8s-configuration flux show'] = """
100+
type: command
101+
short-summary: Show a Kubernetes Flux v2 Configuration.
102+
examples:
103+
- name: Show details of a Kubernetes Flux v2 Configuration
104+
text: |-
105+
az k8s-configuration flux show --resource-group my-resource-group \\
106+
--cluster-name mycluster --cluster-type connectedClusters --name myconfig
107+
"""
108+
109+
helps['k8s-configuration flux delete'] = """
110+
type: command
111+
short-summary: Delete a Kubernetes Flux v2 Configuration.
112+
examples:
113+
- name: Delete an existing Kubernetes Flux v2 Configuration
114+
text: |-
115+
az k8s-configuration flux delete --resource-group my-resource-group \\
116+
--cluster-name mycluster --cluster-type connectedClusters --name myconfig
117+
"""
118+
119+
helps['k8s-configuration flux kustomization'] = """
120+
type: group
121+
short-summary: Commands to manage Kustomizations associated with Flux v2 Kubernetes configurations.
122+
"""
123+
124+
helps['k8s-configuration flux kustomization create'] = """
125+
type: command
126+
short-summary: Create a Kustomization associated with a Kubernetes Flux v2 Configuration.
127+
examples:
128+
- name: Create a Kustomization associated wiht a Kubernetes v2 Flux Configuration
129+
text: |-
130+
az k8s-configuration flux kustomization create --resource-group my-resource-group \\
131+
--cluster-name mycluster --cluster-type connectedClusters --name myconfig \\
132+
--kustomization-name my-kustomization-2 --path ./my/path --prune --force
133+
"""
134+
135+
helps['k8s-configuration flux kustomization update'] = """
136+
type: command
137+
short-summary: Update a Kustomization associated with a Kubernetes Flux v2 Configuration.
138+
examples:
139+
- name: Update a Kustomization associated with a Kubernetes v2 Flux Configuration
140+
text: |-
141+
az k8s-configuration flux kustomization update --resource-group my-resource-group \\
142+
--cluster-name mycluster --cluster-type connectedClusters --name myconfig \\
143+
--kustomization-name my-kustomization --path ./my/new-path --prune --force
144+
"""
145+
146+
helps['k8s-configuration flux kustomization list'] = """
147+
type: command
148+
short-summary: List Kustomizations associated with a Kubernetes Flux v2 Configuration.
149+
examples:
150+
- name: List all Kustomizations associated with a Kubernetes Flux v2 Configuration on a cluster
151+
text: |-
152+
az k8s-configuration flux kustomization list --resource-group my-resource-group \\
153+
--cluster-name mycluster --name myconfig --cluster-type connectedClusters
154+
"""
155+
156+
helps['k8s-configuration flux kustomization show'] = """
157+
type: command
158+
short-summary: Show a Kustomization associated with a Flux v2 Configuration.
159+
examples:
160+
- name: Show details of a Kustomization associated with a Kubernetes Flux v2 Configuration
161+
text: |-
162+
az k8s-configuration flux kustomization show --resource-group my-resource-group \\
163+
--cluster-name mycluster --cluster-type connectedClusters --name myconfig \\
164+
--kustomization-name my-kustomization
165+
"""
166+
167+
helps['k8s-configuration flux kustomization delete'] = """
61168
type: command
62-
short-summary: Update a Kubernetes configuration.
169+
short-summary: Delete a Kustomization associated with a Kubernetes Flux v2 Configuration.
63170
examples:
64-
- name: Update an existing Kubernetes configuration
171+
- name: Delete an existing Kustomization associated with a Kubernetes Flux v2 Configuration
65172
text: |-
66-
az k8s-configuration update --resource-group MyResourceGroup --cluster-name MyClusterName \\
67-
--cluster-type connectedClusters --name MyConfigurationName --enable-helm-operator \\
68-
--repository-url git://github.com/fluxHowTo/flux-get-started --operator-params "'--git-readonly'" \\
69-
--helm-operator-chart-version 1.4.0 --helm-operator-params '--set helm.versions=v3'
173+
az k8s-configuration flux kustomization delete --resource-group my-resource-group \\
174+
--cluster-name mycluster --cluster-type connectedClusters --name myconfig \\
175+
--kustomization-name my-kustomization
70176
"""

0 commit comments

Comments
 (0)