Skip to content

Commit

Permalink
[k8s-configuration] Release v1.3.0 with deployed-object support (Azur…
Browse files Browse the repository at this point in the history
…e#4163)

* 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

* Fix filepath suggestion from CLI team

* Fix unneeded file edit

* Add a Deployed Object List to the Flux CLI (#91)

* Enable a deployed object list on the CLI

* Show detail when extension install fails

* Bump version

* Remove unneeded files

* Update deployed object format (#93)

* Fix help text for consistency

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 authored Dec 5, 2021

Verified

This commit was signed with the committer’s verified signature. The key has expired.
johanneswuerbach Johannes Würbach
1 parent b45ca40 commit 2435c8f
Showing 9 changed files with 226 additions and 67 deletions.
5 changes: 5 additions & 0 deletions src/k8s-configuration/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -3,6 +3,11 @@
Release History
===============

1.3.0
++++++++++++++++++
* Add `deployed-object` command group for showing deployed Flux objects from configuration
* Show extension error when `microsoft.flux` extension is in a failed state

1.2.0
++++++++++++++++++
* Add Flux v2 support with command subgroups
140 changes: 103 additions & 37 deletions src/k8s-configuration/azext_k8s_configuration/_help.py
Original file line number Diff line number Diff line change
@@ -6,12 +6,16 @@

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

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

helps['k8s-configuration create'] = """
helps[
"k8s-configuration create"
] = """
type: command
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:
@@ -26,7 +30,9 @@
--ssh-known-hosts '' --ssh-known-hosts-file ''
"""

helps['k8s-configuration list'] = """
helps[
"k8s-configuration list"
] = """
type: command
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:
@@ -36,7 +42,9 @@
--cluster-type connectedClusters
"""

helps['k8s-configuration delete'] = """
helps[
"k8s-configuration delete"
] = """
type: command
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:
@@ -46,7 +54,9 @@
--cluster-type connectedClusters --name MyConfigurationName
"""

helps['k8s-configuration show'] = """
helps[
"k8s-configuration show"
] = """
type: command
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:
@@ -56,16 +66,20 @@
--cluster-type connectedClusters --name MyConfigurationName
"""

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

helps['k8s-configuration flux create'] = """
helps[
"k8s-configuration flux create"
] = """
type: command
short-summary: Create a Kubernetes Flux v2 Configuration.
short-summary: Create a Flux v2 Kubernetes configuration.
examples:
- name: Create a Kubernetes v2 Flux Configuration
- name: Create a Flux v2 Kubernetes configuration
text: |-
az k8s-configuration flux create --resource-group my-resource-group \\
--cluster-name mycluster --cluster-type connectedClusters \\
@@ -74,103 +88,155 @@
--branch main --kustomization name=my-kustomization
"""

helps['k8s-configuration flux update'] = """
helps[
"k8s-configuration flux update"
] = """
type: command
short-summary: Update a Kubernetes Flux v2 Configuration.
short-summary: Update a Flux v2 Kubernetes configuration.
examples:
- name: Update a Kubernetes v2 Flux Configuration
- name: Update a Flux v2 Kubernetes 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'] = """
helps[
"k8s-configuration flux list"
] = """
type: command
short-summary: List Kubernetes Flux v2 Configurations.
short-summary: List all Flux v2 Kubernetes configurations.
examples:
- name: List all Kubernetes Flux v2 Configurations on a cluster
- name: List Flux v2 Kubernetes 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'] = """
helps[
"k8s-configuration flux show"
] = """
type: command
short-summary: Show a Kubernetes Flux v2 Configuration.
short-summary: Show a Flux v2 Kubernetes configuration.
examples:
- name: Show details of a Kubernetes Flux v2 Configuration
- name: Show details of a Flux v2 Kubernetes 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'] = """
helps[
"k8s-configuration flux delete"
] = """
type: command
short-summary: Delete a Kubernetes Flux v2 Configuration.
short-summary: Delete a Flux v2 Kubernetes configuration.
examples:
- name: Delete an existing Kubernetes Flux v2 Configuration
- name: Delete an existing Flux v2 Kubernetes 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'] = """
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'] = """
helps[
"k8s-configuration flux kustomization create"
] = """
type: command
short-summary: Create a Kustomization associated with a Kubernetes Flux v2 Configuration.
short-summary: Create a Kustomization associated with a Flux v2 Kubernetes configuration.
examples:
- name: Create a Kustomization associated wiht a Kubernetes v2 Flux Configuration
- name: Create a Kustomization associated with a Flux v2 Kubernetes 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'] = """
helps[
"k8s-configuration flux kustomization update"
] = """
type: command
short-summary: Update a Kustomization associated with a Kubernetes Flux v2 Configuration.
short-summary: Update a Kustomization associated with a Flux v2 Kubernetes configuration.
examples:
- name: Update a Kustomization associated with a Kubernetes v2 Flux Configuration
- name: Update a Kustomization associated with a Flux v2 Kubernetes 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'] = """
helps[
"k8s-configuration flux kustomization list"
] = """
type: command
short-summary: List Kustomizations associated with a Kubernetes Flux v2 Configuration.
short-summary: List Kustomizations associated with a Flux v2 Kubernetes configuration.
examples:
- name: List all Kustomizations associated with a Kubernetes Flux v2 Configuration on a cluster
- name: List all Kustomizations associated with a Flux v2 Kubernetes configuration
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'] = """
helps[
"k8s-configuration flux kustomization show"
] = """
type: command
short-summary: Show a Kustomization associated with a Flux v2 Configuration.
short-summary: Show a Kustomization associated with a Flux v2 Kubernetes configuration.
examples:
- name: Show details of a Kustomization associated with a Kubernetes Flux v2 Configuration
- name: Show details of a Kustomization associated with a Flux v2 Kubernetes 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'] = """
helps[
"k8s-configuration flux kustomization delete"
] = """
type: command
short-summary: Delete a Kustomization associated with a Kubernetes Flux v2 Configuration.
short-summary: Delete a Kustomization associated with a Flux v2 Kubernetes configuration.
examples:
- name: Delete an existing Kustomization associated with a Kubernetes Flux v2 Configuration
- name: Delete an existing Kustomization associated with a Flux v2 Kubernetes configuration
text: |-
az k8s-configuration flux kustomization delete --resource-group my-resource-group \\
--cluster-name mycluster --cluster-type connectedClusters --name myconfig \\
--kustomization-name my-kustomization
"""

helps[
"k8s-configuration flux deployed-object"
] = """
type: group
short-summary: Commands to see deployed objects associated with Flux v2 Kubernetes configurations.
"""

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

helps[
"k8s-configuration flux deployed-object show"
] = """
type: command
short-summary: Show a deployed object associated with a Flux v2 Kubernetes configuration.
examples:
- name: Show details of a deployed object associated with a Flux v2 Kubernetes configuration
text: |-
az k8s-configuration flux deployed-object show --resource-group my-resource-group \\
--cluster-name mycluster --cluster-type connectedClusters --name myconfig \\
--object-name my-object --object-namespace my-namespace --object-kind GitRepository
"""
9 changes: 9 additions & 0 deletions src/k8s-configuration/azext_k8s_configuration/_params.py
Original file line number Diff line number Diff line change
@@ -118,6 +118,15 @@ def load_arguments(self, _):
options_list=['--yes', '-y'],
help='Do not prompt for confirmation')

with self.argument_context('k8s-configuration flux deployed-object show') as c:
c.argument('object_name',
help='Name of the object deployed by the configuration on the cluster.')
c.argument('object_namespace',
help='Namespace of the object deployed by the configuration on the cluster.')
c.argument('object_kind',
arg_type=get_enum_type(['GitRepository', 'Bucket', 'HelmRepository', 'HelmChart', 'HelmRelease', 'Kustomization']),
help='Kind of the object deployed by the configuration on the cluster.')

with self.argument_context('k8s-configuration') as c:
c.argument('name',
options_list=['--name', '-n'],
6 changes: 6 additions & 0 deletions src/k8s-configuration/azext_k8s_configuration/commands.py
Original file line number Diff line number Diff line change
@@ -10,6 +10,8 @@
k8s_configuration_sourcecontrol_client
)
from .format import (
fluxconfig_deployed_object_list_table_format,
fluxconfig_deployed_object_show_table_format,
fluxconfig_list_table_format,
fluxconfig_show_table_format,
fluxconfig_kustomization_list_table_format,
@@ -44,6 +46,10 @@ def load_command_table(self, _):
g.custom_command('list', 'flux_config_list_kustomization', table_transformer=fluxconfig_kustomization_list_table_format)
g.custom_show_command('show', 'flux_config_show_kustomization', table_transformer=fluxconfig_kustomization_show_table_format)

with self.command_group('k8s-configuration flux deployed-object', k8s_configuration_fluxconfig_sdk, client_factory=k8s_configuration_fluxconfig_client, is_preview=True) as g:
g.custom_command('list', 'flux_config_list_deployed_object', table_transformer=fluxconfig_deployed_object_list_table_format)
g.custom_show_command('show', 'flux_config_show_deployed_object', table_transformer=fluxconfig_deployed_object_show_table_format)

with self.command_group('k8s-configuration', k8s_configuration_sourcecontrol_sdk, client_factory=k8s_configuration_sourcecontrol_client) as g:
g.custom_command('create', 'sourcecontrol_create', deprecate_info=self.deprecate(redirect='k8s-configuration flux create'))
g.custom_command('list', 'sourcecontrol_list', table_transformer=sourcecontrol_list_table_format, deprecate_info=self.deprecate(redirect='k8s-configuration flux list'))
3 changes: 3 additions & 0 deletions src/k8s-configuration/azext_k8s_configuration/consts.py
Original file line number Diff line number Diff line change
@@ -64,6 +64,9 @@
SHOW_KUSTOMIZATION_NO_EXIST_ERROR = "Error! Kustomization with name '{0}' does not exist on configuration '{1}'."
SHOW_KUSTOMIZATION_NO_EXIST_HELP = "You can view all kustomizations on a configuration with 'az k8s-configuration flux kustomization list'"

SHOW_DEPLOYED_OBJECT_NO_EXIST_ERROR = "Error! Deployed object with name '{0}', namespace '{1}', and kind '{2}' does not exist on configuration '{3}'."
SHOW_DEPLOYED_OBJECT_NO_EXIST_HELP = "You can view all deployed objects on a configuration with 'az k8s-configuration flux deployed-object list'"

SSH_PRIVATE_KEY_WITH_HTTP_URL_ERROR = "Error! An --ssh-private-key cannot be used with an http(s) url"
SSH_PRIVATE_KEY_WITH_HTTP_URL_HELP = "Verify the url provided is a valid ssh url and not an http(s) url"

14 changes: 14 additions & 0 deletions src/k8s-configuration/azext_k8s_configuration/custom.py
Original file line number Diff line number Diff line change
@@ -121,6 +121,20 @@ def flux_config_show_kustomization(cmd, client, resource_group_name, cluster_typ
return provider.show_kustomization(resource_group_name, cluster_type, cluster_name, name, kustomization_name)


def flux_config_list_deployed_object(cmd, client, resource_group_name, cluster_type, cluster_name, name):

provider = FluxConfigurationProvider(cmd)
return provider.list_deployed_object(resource_group_name, cluster_type, cluster_name, name)


def flux_config_show_deployed_object(cmd, client, resource_group_name, cluster_type, cluster_name, name,
object_name, object_namespace, object_kind):

provider = FluxConfigurationProvider(cmd)
return provider.show_deployed_object(resource_group_name, cluster_type, cluster_name, name,
object_name, object_namespace, object_kind)


def flux_config_delete(cmd, client, resource_group_name, cluster_type,
cluster_name, name, force=False, no_wait=False, yes=False):
provider = FluxConfigurationProvider(cmd)
Loading

0 comments on commit 2435c8f

Please sign in to comment.