diff --git a/src/k8s-configuration/HISTORY.rst b/src/k8s-configuration/HISTORY.rst index 5af7a8a6f3d..4c8d242171b 100644 --- a/src/k8s-configuration/HISTORY.rst +++ b/src/k8s-configuration/HISTORY.rst @@ -3,6 +3,13 @@ Release History =============== +1.4.1 +++++++++++++++++++ +* [BREAKING CHANGE] `--access-key` changed to `--bucket-access-key` +* [BREAKING CHANGE] `--secret-key` changed to `--bucket-secret-key` +* [BREAKING CHANGE] `--insecure` changed to `--bucket-insecure` +* Fix help text for bucket parameters + 1.4.0 ++++++++++++++++++ * Add `--kind bucket` for creation of S3 bucket as source for fluxConfigurations diff --git a/src/k8s-configuration/azext_k8s_configuration/_help.py b/src/k8s-configuration/azext_k8s_configuration/_help.py index 31e14bffda4..8b6c6dc04f8 100644 --- a/src/k8s-configuration/azext_k8s_configuration/_help.py +++ b/src/k8s-configuration/azext_k8s_configuration/_help.py @@ -93,7 +93,7 @@ --name myconfig --scope cluster --namespace my-namespace \\ --kind bucket --url https://bucket-provider.minio.io \\ --bucket-name my-bucket --kustomization name=my-kustomization \\ - --access-key my-access-key --secret-key my-secret-key + --bucket-access-key my-access-key --bucket-secret-key my-secret-key """ helps[ @@ -108,6 +108,11 @@ --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 + - name: Update a Flux v2 Kubernetse configuration with Bucket Source Kind to connect insecurely + text: |- + az k8s-configuration flux update --resource-group my-resource-group \\ + --cluster-name mycluster --cluster-type connectedClusters --name myconfig \\ + --bucket-insecure """ helps[ diff --git a/src/k8s-configuration/azext_k8s_configuration/_params.py b/src/k8s-configuration/azext_k8s_configuration/_params.py index bed4994c216..d763f1c3ee2 100644 --- a/src/k8s-configuration/azext_k8s_configuration/_params.py +++ b/src/k8s-configuration/azext_k8s_configuration/_params.py @@ -137,21 +137,21 @@ def load_arguments(self, _): help="File path to known_hosts contents containing public SSH keys required to access private Git instances", ) c.argument( - "access_key", + "bucket_access_key", arg_group="Bucket Auth", - help="Access Key Id used to authenticate with the bucket url", + help="Access Key ID used to authenticate with the bucket", ) c.argument( - "secret_key", + "bucket_secret_key", arg_group="Bucket Auth", - help="Secret Key used to authenticate with the bucket url", + help="Secret Key used to authenticate with the bucket", ) c.argument( "bucket_name", - help="Name of the S3 bucket at the given url to connect to", + help="Name of the S3 bucket to sync", ) c.argument( - "insecure", + "bucket_insecure", arg_type=get_three_state_flag(), help="Communicate with a bucket without TLS", ) diff --git a/src/k8s-configuration/azext_k8s_configuration/consts.py b/src/k8s-configuration/azext_k8s_configuration/consts.py index 7db604b9c33..192f62d6335 100644 --- a/src/k8s-configuration/azext_k8s_configuration/consts.py +++ b/src/k8s-configuration/azext_k8s_configuration/consts.py @@ -209,9 +209,9 @@ "bucket_name", "sync_interval", "timeout", - "access_key", - "secret_key", - "insecure", + "bucket_access_key", + "bucket_secret_key", + "bucket_insecure", "local_auth_ref", } diff --git a/src/k8s-configuration/azext_k8s_configuration/providers/FluxConfigurationProvider.py b/src/k8s-configuration/azext_k8s_configuration/providers/FluxConfigurationProvider.py index 1faaea717e1..7b86396501b 100644 --- a/src/k8s-configuration/azext_k8s_configuration/providers/FluxConfigurationProvider.py +++ b/src/k8s-configuration/azext_k8s_configuration/providers/FluxConfigurationProvider.py @@ -144,9 +144,9 @@ def create_config( https_ca_cert_file=None, known_hosts=None, known_hosts_file=None, - access_key=None, - secret_key=None, - insecure=False, + bucket_access_key=None, + bucket_secret_key=None, + bucket_insecure=False, suspend=False, kustomization=None, no_wait=False, @@ -175,9 +175,9 @@ def create_config( https_ca_cert_file=https_ca_cert_file, known_hosts=known_hosts, known_hosts_file=known_hosts_file, - access_key=access_key, - secret_key=secret_key, - insecure=insecure, + bucket_access_key=bucket_access_key, + bucket_secret_key=bucket_secret_key, + bucket_insecure=bucket_insecure, ) # This update func is a generated update function that modifies @@ -193,7 +193,7 @@ def create_config( # Get the protected settings and validate the private key value protected_settings = get_protected_settings( - ssh_private_key, ssh_private_key_file, https_key, secret_key + ssh_private_key, ssh_private_key_file, https_key, bucket_secret_key ) if protected_settings and consts.SSH_PRIVATE_KEY_KEY in protected_settings: validate_private_key(protected_settings["sshPrivateKey"]) @@ -256,9 +256,9 @@ def update_config( https_ca_cert_file=None, known_hosts=None, known_hosts_file=None, - access_key=None, - secret_key=None, - insecure=None, + bucket_access_key=None, + bucket_secret_key=None, + bucket_insecure=None, suspend=None, kustomization=None, no_wait=False, @@ -293,9 +293,9 @@ def update_config( https_ca_cert_file=https_ca_cert_file, known_hosts=known_hosts, known_hosts_file=known_hosts_file, - access_key=access_key, - secret_key=secret_key, - insecure=insecure, + bucket_access_key=bucket_access_key, + bucket_secret_key=bucket_secret_key, + bucket_insecure=bucket_insecure, ) # This update func is a generated update function that modifies @@ -324,7 +324,7 @@ def update_config( # Get the protected settings and validate the private key value protected_settings = get_protected_settings( - ssh_private_key, ssh_private_key_file, https_key, secret_key + ssh_private_key, ssh_private_key_file, https_key, bucket_secret_key ) if protected_settings and consts.SSH_PRIVATE_KEY_KEY in protected_settings: validate_private_key(protected_settings["sshPrivateKey"]) @@ -968,15 +968,17 @@ def __init__(self, **kwargs): self.bucket_name = kwargs.get("bucket_name") self.timeout = kwargs.get("timeout") self.sync_interval = kwargs.get("sync_interval") - self.access_key = kwargs.get("access_key") - self.secret_key = kwargs.get("secret_key") + self.bucket_access_key = kwargs.get("bucket_access_key") + self.bucket_secret_key = kwargs.get("bucket_secret_key") self.local_auth_ref = kwargs.get("local_auth_ref") - self.insecure = kwargs.get("insecure") + self.bucket_insecure = kwargs.get("bucket_insecure") def validate(self): super().validate_required_params(**self.kwargs) validate_bucket_url(self.url) - if not ((self.access_key and self.secret_key) or self.local_auth_ref): + if not ( + (self.bucket_access_key and self.bucket_secret_key) or self.local_auth_ref + ): raise RequiredArgumentMissingError( consts.REQUIRED_BUCKET_VALUES_MISSING_ERROR, consts.REQUIRED_BUCKET_VALUES_MISSING_HELP, @@ -995,9 +997,9 @@ def bucket_updater(config): bucket_name=self.bucket_name, timeout_in_seconds=parse_duration(self.timeout), sync_interval_in_seconds=parse_duration(self.sync_interval), - access_key=self.access_key, + access_key=self.bucket_access_key, local_auth_ref=self.local_auth_ref, - insecure=self.insecure, + insecure=self.bucket_insecure, ) config.source_kind = SourceKindType.BUCKET return config @@ -1018,9 +1020,9 @@ def bucket_patch_updater(config): bucket_name=self.bucket_name, timeout_in_seconds=parse_duration(self.timeout), sync_interval_in_seconds=parse_duration(self.sync_interval), - access_key=self.access_key, + access_key=self.bucket_access_key, local_auth_ref=self.local_auth_ref, - insecure=self.insecure, + insecure=self.bucket_insecure, ) if swapped_kind: self.validate() @@ -1032,7 +1034,7 @@ def bucket_patch_updater(config): def get_protected_settings( - ssh_private_key, ssh_private_key_file, https_key, secret_key + ssh_private_key, ssh_private_key_file, https_key, bucket_secret_key ): protected_settings = {} ssh_private_key_data = get_data_from_key_or_file( @@ -1046,8 +1048,8 @@ def get_protected_settings( if https_key: protected_settings[consts.HTTPS_KEY_KEY] = to_base64(https_key) - if secret_key: - protected_settings[consts.BUCKET_SECRET_KEY_KEY] = to_base64(secret_key) + if bucket_secret_key: + protected_settings[consts.BUCKET_SECRET_KEY_KEY] = to_base64(bucket_secret_key) # Return the protected settings dict if there are any values there return protected_settings if len(protected_settings) > 0 else None diff --git a/src/k8s-configuration/setup.py b/src/k8s-configuration/setup.py index 2139b4fbe1b..dfe4c09fb73 100644 --- a/src/k8s-configuration/setup.py +++ b/src/k8s-configuration/setup.py @@ -8,47 +8,49 @@ from codecs import open from setuptools import setup, find_packages + try: from azure_bdist_wheel import cmdclass except ImportError: from distutils import log as logger + logger.warn("Wheel is not available, disabling bdist_wheel hook") -VERSION = '1.4.0' +VERSION = "1.4.1" # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers CLASSIFIERS = [ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'Intended Audience :: System Administrators', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'License :: OSI Approved :: MIT License', + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "License :: OSI Approved :: MIT License", ] DEPENDENCIES = ["pycryptodome~=3.9.8"] -with open('README.rst', 'r', encoding='utf-8') as f: +with open("README.rst", "r", encoding="utf-8") as f: README = f.read() -with open('HISTORY.rst', 'r', encoding='utf-8') as f: +with open("HISTORY.rst", "r", encoding="utf-8") as f: HISTORY = f.read() setup( - name='k8s-configuration', + name="k8s-configuration", version=VERSION, - description='Microsoft Azure Command-Line Tools K8s-configuration Extension', + description="Microsoft Azure Command-Line Tools K8s-configuration Extension", # TODO: Update author and email, if applicable - author='Microsoft Corporation', - author_email='azpycli@microsoft.com', - url='https://github.com/Azure/azure-cli-extensions/tree/master/src/k8s-configuration', - long_description=README + '\n\n' + HISTORY, - license='MIT', + author="Microsoft Corporation", + author_email="azpycli@microsoft.com", + url="https://github.com/Azure/azure-cli-extensions/tree/master/src/k8s-configuration", + long_description=README + "\n\n" + HISTORY, + license="MIT", classifiers=CLASSIFIERS, packages=find_packages(), install_requires=DEPENDENCIES, - package_data={'azext_k8s_configuration': ['azext_metadata.json']}, + package_data={"azext_k8s_configuration": ["azext_metadata.json"]}, )