Skip to content

Commit

Permalink
Release k8s-configuration v1.2.0 for Flux v2 Public Preview (#86)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jonathan-innis authored Nov 12, 2021
1 parent d011762 commit 5482780
Show file tree
Hide file tree
Showing 177 changed files with 31,154 additions and 1,284 deletions.
8 changes: 0 additions & 8 deletions .github/pull.yml

This file was deleted.

22 changes: 11 additions & 11 deletions src/dataprotection/azext_dataprotection/manual/version.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

VERSION = "0.2.0"
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

VERSION = "0.2.0"
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.

Loading

0 comments on commit 5482780

Please sign in to comment.