Skip to content

Commit

Permalink
[k8s-configuration] Release v1.2.0 with Flux v2 Support (Azure#4100)
Browse files Browse the repository at this point in the history
* 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 (#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 (#75)

* Pin helm version

* Bump version

* Migrate pipeline (#90)

* Disable updates on configuration tests (#89)

* Release k8s-configuration v1.2.0 for Flux v2 Public Preview (#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>
  • Loading branch information
4 people committed Nov 16, 2021
1 parent 84bf6ad commit a9ec99d
Show file tree
Hide file tree
Showing 167 changed files with 30,742 additions and 1,147 deletions.
5 changes: 5 additions & 0 deletions src/k8s-configuration/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Release History
===============

1.2.0
++++++++++++++++++
* Add Flux v2 support with command subgroups
* Add update support to Flux v2 resources

1.1.1
++++++++++++++++++
* Enable helm-operator chart version 1.4.0
Expand Down
60 changes: 53 additions & 7 deletions src/k8s-configuration/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,57 @@ az extension add --name k8s-configuration
```

### Included Features
#### Kubernetes Configuration:
Kubernetes SourceControl Configuration: [more info](https://docs.microsoft.com/en-us/azure/kubernetessconfiguration/)\

#### Flux Configuration (Flux v2):
Flux Configuration (Flux v1) Configuration: [more info](https://docs.microsoft.com/en-us/azure/kubernetessconfiguration/)\
*Examples:*

##### Create a Flux Configuration (Flux v2)
```
az k8s-configuration create flux \
--resource-group groupName \
--cluster-name clusterName \
--cluster-type clusterType \
--name configurationName \
--namespace configurationNamespace \
--scope cluster
--kind git \
--url https://github.com/Azure/arc-k8s-demo \
--branch main \
--kustomization name=my-kustomization
```

##### Get a Flux Configuration (Flux v2)
```
az k8s-configuration flux show \
--resource-group groupName \
--cluster-name clusterName \
--cluster-type clusterType \
--name configurationName
```

##### Delete a Flux Configuration (Flux v2)
```
az k8s-configuration flux delete \
--resource-group groupName \
--cluster-name clusterName \
--cluster-type clusterType \
--name configurationName
```

##### List all Flux Configuration (Flux v2) on a cluster
```
az k8s-configuration flux list \
--resource-group groupName \
--cluster-name clusterName \
--cluster-type clusterType
```

#### Source Control Configuration (Flux v1):
Source Control Configuration (Flux v1) Configuration: [more info](https://docs.microsoft.com/en-us/azure/kubernetessconfiguration/)\
*Examples:*

##### Create a KubernetesConfiguration
##### Create a Source Control Configuration (Flux v1)
```
az k8s-configuration create \
--resource-group groupName \
Expand All @@ -31,7 +77,7 @@ az k8s-configuration create \
--helm-operator-params chartParameters
```

##### Get a KubernetesConfiguration
##### Get a Source Control Configuration (Flux v1)
```
az k8s-configuration show \
--resource-group groupName \
Expand All @@ -40,7 +86,7 @@ az k8s-configuration show \
--name configurationName
```

##### Delete a KubernetesConfiguration
##### Delete a Source Control Configuration (Flux v1)
```
az k8s-configuration delete \
--resource-group groupName \
Expand All @@ -49,7 +95,7 @@ az k8s-configuration delete \
--name configurationName
```

##### Update a KubernetesConfiguration
##### Update a Source Control Configuration (Flux v1)
```
az k8s-configuration create \
--resource-group groupName \
Expand All @@ -63,7 +109,7 @@ az k8s-configuration create \
--helm-operator-params chartParameters
```

##### List all KubernetesConfigurations of a cluster
##### List all Source Control Configuration (Flux v1) on a cluster
```
az k8s-configuration list \
--resource-group groupName \
Expand Down
8 changes: 4 additions & 4 deletions src/k8s-configuration/azext_k8s_configuration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ class K8sConfigurationCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_k8s_configuration._client_factory import cf_k8s_configuration
from azext_k8s_configuration._client_factory import k8s_configuration_client
k8s_configuration_custom = CliCommandType(
operations_tmpl='azext_k8s_configuration.custom#{}',
client_factory=cf_k8s_configuration)
super(K8sConfigurationCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=k8s_configuration_custom)
client_factory=k8s_configuration_client)
super().__init__(cli_ctx=cli_ctx,
custom_command_type=k8s_configuration_custom)

def load_command_table(self, args):
from azext_k8s_configuration.commands import load_command_table
Expand Down
38 changes: 33 additions & 5 deletions src/k8s-configuration/azext_k8s_configuration/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,45 @@
# --------------------------------------------------------------------------------------------

from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azure.cli.core.profiles import ResourceType
from . import consts


def cf_k8s_configuration(cli_ctx, *_):
def k8s_configuration_client(cli_ctx, **kwargs):
from azext_k8s_configuration.vendored_sdks import SourceControlConfigurationClient
return get_mgmt_service_client(cli_ctx, SourceControlConfigurationClient)
return get_mgmt_service_client(cli_ctx, SourceControlConfigurationClient, **kwargs)


def cf_k8s_configuration_operation(cli_ctx, _):
return cf_k8s_configuration(cli_ctx).source_control_configurations
def k8s_configuration_fluxconfig_client(cli_ctx, *_):
return k8s_configuration_client(cli_ctx, api_version=consts.FLUXCONFIG_API_VERSION).flux_configurations


def _resource_providers_client(cli_ctx):
def k8s_configuration_sourcecontrol_client(cli_ctx, *_):
return k8s_configuration_client(
cli_ctx,
api_version=consts.SOURCE_CONTROL_API_VERSION
).source_control_configurations


def k8s_configuration_extension_client(cli_ctx, *_):
return k8s_configuration_client(cli_ctx, api_version=consts.EXTENSION_API_VERSION).extensions


def resource_providers_client(cli_ctx):
from azure.mgmt.resource import ResourceManagementClient
return get_mgmt_service_client(cli_ctx, ResourceManagementClient).providers


def cf_resource_groups(cli_ctx, subscription_id=None):
return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES,
subscription_id=subscription_id).resource_groups


def cf_resources(cli_ctx, subscription_id=None):
return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES,
subscription_id=subscription_id).resources


def cf_log_analytics(cli_ctx, subscription_id=None):
from azure.mgmt.loganalytics import LogAnalyticsManagementClient # pylint: disable=no-name-in-module
return get_mgmt_service_client(cli_ctx, LogAnalyticsManagementClient, subscription_id=subscription_id)
25 changes: 0 additions & 25 deletions src/k8s-configuration/azext_k8s_configuration/_format.py

This file was deleted.

140 changes: 123 additions & 17 deletions src/k8s-configuration/azext_k8s_configuration/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@

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


helps['k8s-configuration'] = """
type: group
short-summary: Commands to manage Kubernetes configuration.
short-summary: Commands to manage resources from Microsoft.KubernetesConfiguration.
"""

helps['k8s-configuration create'] = """
type: command
short-summary: Create a Kubernetes configuration.
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").
examples:
- name: Create a Kubernetes configuration
- name: Create a Flux v1 Kubernetes configuration
text: |-
az k8s-configuration create --resource-group MyResourceGroup --cluster-name MyClusterName \\
--cluster-type connectedClusters --name MyGitConfig --operator-instance-name OperatorInst01 \\
Expand All @@ -29,42 +28,149 @@

helps['k8s-configuration list'] = """
type: command
short-summary: List Kubernetes configurations.
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").
examples:
- name: List all Kubernetes configurations of a cluster
- name: List Flux v1 Kubernetes configuration
text: |-
az k8s-configuration list --resource-group MyResourceGroup --cluster-name MyClusterName \\
--cluster-type connectedClusters
"""

helps['k8s-configuration delete'] = """
type: command
short-summary: Delete a Kubernetes configuration.
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").
examples:
- name: Delete a Kubernetes configuration
- name: Delete a Flux v1 Kubernetes configuration
text: |-
az k8s-configuration delete --resource-group MyResourceGroup --cluster-name MyClusterName \\
--cluster-type connectedClusters --name MyConfigurationName
"""

helps['k8s-configuration show'] = """
type: command
short-summary: Show details of a Kubernetes configuration.
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").
examples:
- name: Show a Kubernetes configuration
- name: Show details of a Flux v1 Kubernetes configuration
text: |-
az k8s-configuration show --resource-group MyResourceGroup --cluster-name MyClusterName \\
--cluster-type connectedClusters --name MyConfigurationName
"""

helps['k8s-configuration update'] = """
helps['k8s-configuration flux'] = """
type: group
short-summary: Commands to manage Flux v2 Kubernetes configurations.
"""

helps['k8s-configuration flux create'] = """
type: command
short-summary: Create a Kubernetes Flux v2 Configuration.
examples:
- name: Create a Kubernetes v2 Flux Configuration
text: |-
az k8s-configuration flux create --resource-group my-resource-group \\
--cluster-name mycluster --cluster-type connectedClusters \\
--name myconfig --scope cluster --namespace my-namespace \\
--kind git --url https://github.com/Azure/arc-k8s-demo \\
--branch main --kustomization name=my-kustomization
"""

helps['k8s-configuration flux update'] = """
type: command
short-summary: Update a Kubernetes Flux v2 Configuration.
examples:
- name: Update a Kubernetes v2 Flux Configuration
text: |-
az k8s-configuration flux update --resource-group my-resource-group \\
--cluster-name mycluster --cluster-type connectedClusters --name myconfig \\
--url https://github.com/Azure/arc-k8s-demo --branch main \\
--kustomization name=my-kustomization path=./my/new-path
"""

helps['k8s-configuration flux list'] = """
type: command
short-summary: List Kubernetes Flux v2 Configurations.
examples:
- name: List all Kubernetes Flux v2 Configurations on a cluster
text: |-
az k8s-configuration flux list --resource-group my-resource-group \\
--cluster-name mycluster --cluster-type connectedClusters
"""

helps['k8s-configuration flux show'] = """
type: command
short-summary: Show a Kubernetes Flux v2 Configuration.
examples:
- name: Show details of a Kubernetes Flux v2 Configuration
text: |-
az k8s-configuration flux show --resource-group my-resource-group \\
--cluster-name mycluster --cluster-type connectedClusters --name myconfig
"""

helps['k8s-configuration flux delete'] = """
type: command
short-summary: Delete a Kubernetes Flux v2 Configuration.
examples:
- name: Delete an existing Kubernetes Flux v2 Configuration
text: |-
az k8s-configuration flux delete --resource-group my-resource-group \\
--cluster-name mycluster --cluster-type connectedClusters --name myconfig
"""

helps['k8s-configuration flux kustomization'] = """
type: group
short-summary: Commands to manage Kustomizations associated with Flux v2 Kubernetes configurations.
"""

helps['k8s-configuration flux kustomization create'] = """
type: command
short-summary: Create a Kustomization associated with a Kubernetes Flux v2 Configuration.
examples:
- name: Create a Kustomization associated wiht a Kubernetes v2 Flux Configuration
text: |-
az k8s-configuration flux kustomization create --resource-group my-resource-group \\
--cluster-name mycluster --cluster-type connectedClusters --name myconfig \\
--kustomization-name my-kustomization-2 --path ./my/path --prune --force
"""

helps['k8s-configuration flux kustomization update'] = """
type: command
short-summary: Update a Kustomization associated with a Kubernetes Flux v2 Configuration.
examples:
- name: Update a Kustomization associated with a Kubernetes v2 Flux Configuration
text: |-
az k8s-configuration flux kustomization update --resource-group my-resource-group \\
--cluster-name mycluster --cluster-type connectedClusters --name myconfig \\
--kustomization-name my-kustomization --path ./my/new-path --prune --force
"""

helps['k8s-configuration flux kustomization list'] = """
type: command
short-summary: List Kustomizations associated with a Kubernetes Flux v2 Configuration.
examples:
- name: List all Kustomizations associated with a Kubernetes Flux v2 Configuration on a cluster
text: |-
az k8s-configuration flux kustomization list --resource-group my-resource-group \\
--cluster-name mycluster --name myconfig --cluster-type connectedClusters
"""

helps['k8s-configuration flux kustomization show'] = """
type: command
short-summary: Show a Kustomization associated with a Flux v2 Configuration.
examples:
- name: Show details of a Kustomization associated with a Kubernetes Flux v2 Configuration
text: |-
az k8s-configuration flux kustomization show --resource-group my-resource-group \\
--cluster-name mycluster --cluster-type connectedClusters --name myconfig \\
--kustomization-name my-kustomization
"""

helps['k8s-configuration flux kustomization delete'] = """
type: command
short-summary: Update a Kubernetes configuration.
short-summary: Delete a Kustomization associated with a Kubernetes Flux v2 Configuration.
examples:
- name: Update an existing Kubernetes configuration
- name: Delete an existing Kustomization associated with a Kubernetes Flux v2 Configuration
text: |-
az k8s-configuration update --resource-group MyResourceGroup --cluster-name MyClusterName \\
--cluster-type connectedClusters --name MyConfigurationName --enable-helm-operator \\
--repository-url git://github.com/fluxHowTo/flux-get-started --operator-params "'--git-readonly'" \\
--helm-operator-chart-version 1.4.0 --helm-operator-params '--set helm.versions=v3'
az k8s-configuration flux kustomization delete --resource-group my-resource-group \\
--cluster-name mycluster --cluster-type connectedClusters --name myconfig \\
--kustomization-name my-kustomization
"""
Loading

0 comments on commit a9ec99d

Please sign in to comment.