Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[k8s-extension] Update extension CLI to v1.5.3 #7071

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
3cc8452
Kubernetes Data Protection Extension CLI (#173)
Miraj50 Aug 25, 2022
6c56613
{AKS - ARC} fix: Update DCR creation to Clusters resource group inste…
bragi92 Sep 28, 2022
083ed6d
Add self-signed cert to fix PR gate for azureml extension
Sep 27, 2022
0a6208d
adding the api version to the operation definition in the client factory
deeksha345 Sep 29, 2022
2121a2e
Merge pull request #181 from AzureArcForKubernetes/deesharma/exttypes
deeksha345 Sep 29, 2022
9c6835c
bump k8s-extension version to 1.3.6
deeksha345 Sep 29, 2022
1aaef92
Merge pull request #182 from AzureArcForKubernetes/release-1.3.6
deeksha345 Sep 29, 2022
700bee5
adding tests for all 4 extension types calls
deeksha345 Sep 30, 2022
efd86d4
adding to test config file
deeksha345 Sep 30, 2022
8dcef49
updating the api version for extension types to be the correct versio…
deeksha345 Sep 30, 2022
2ecb63a
add test case for flux extension (#184)
bavneetsingh16 Oct 3, 2022
f1c9348
Merge branch 'k8s-extension/public' into deesharma/exttypestests
deeksha345 Oct 5, 2022
5c57791
Merge pull request #183 from AzureArcForKubernetes/deesharma/exttypes…
deeksha345 Oct 5, 2022
84dcc92
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
deeksha345 Oct 5, 2022
4ae3aa6
bump k8s-extension version to 1.3.6
deeksha345 Oct 5, 2022
0213a71
bump k8s-extension version to 1.3.6
deeksha345 Oct 6, 2022
a2a8be4
Merge pull request #186 from AzureArcForKubernetes/release-1.3.6
deeksha345 Oct 6, 2022
ef3e79f
adding upstream test for extension types
deeksha345 Oct 17, 2022
eeadb2b
Merge pull request #189 from AzureArcForKubernetes/deesharma/addingex…
deeksha345 Oct 17, 2022
0378ecf
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
deeksha345 Oct 17, 2022
929928f
updating history.rst
deeksha345 Oct 17, 2022
374edcf
Merge pull request #190 from AzureArcForKubernetes/release-1.3.6
deeksha345 Oct 18, 2022
5b6b4dc
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
deeksha345 Oct 18, 2022
e95cd6e
Merge branch 'k8s-extension/public' into release-1.3.6
deeksha345 Oct 18, 2022
477613d
Merge pull request #191 from AzureArcForKubernetes/release-1.3.6
deeksha345 Oct 18, 2022
cbd30bf
[Dapr] Prompt user for existing Dapr installation during extension cr…
shubham1172 Nov 10, 2022
5d8592e
Merge branch 'main' of github.com:Azure/azure-cli-extensions into rel…
Nov 15, 2022
155fb01
bump k8s-extension version to 1.3.7
Nov 15, 2022
0d74a15
Merge branch 'main' of github.com:Azure/azure-cli-extensions into rel…
Nov 16, 2022
c88e8ef
Merge branch 'main' of github.com:Azure/azure-cli-extensions into rel…
Nov 18, 2022
464cca7
Merge pull request #196 from AzureArcForKubernetes/release-1.3.7
bavneetsingh16 Nov 18, 2022
0487616
[Dapr] Disable applying CRDs during a downgrade (#193)
shubham1172 Nov 28, 2022
d54d6ab
ContainerInsights extension - Add dataCollectionSettings configurati…
ganga1980 Dec 2, 2022
b2f1319
Upgrade Python version from 3.6 to 3.7 (#203)
NarayanThiru Dec 15, 2022
ee8a070
[Dapr] Do not apply CRD hook when version is unchanged or auto-upgrad…
shubham1172 Dec 16, 2022
e054268
add dummy key for amalogs as well
Dec 29, 2022
4a6fcdb
Merge branch 'k8s-extension/public' into user/amagraw/fix-bug/rename
pfrcks Dec 30, 2022
9b65294
Merge pull request #207 from pfrcks/user/amagraw/fix-bug/rename
deeksha345 Dec 30, 2022
887661d
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
deeksha345 Jan 12, 2023
beffb3f
bump k8s-extension version to 1.3.8
deeksha345 Jan 12, 2023
f6e39ca
Merge branch 'k8s-extension/public' into release-1.3.8
deeksha345 Jan 12, 2023
6015026
Adding GA api version 2022-11-01 exposing isSystemExtension and suppo…
Nov 18, 2022
97c808f
Seperate args for plan name, product and publisher
Dec 13, 2022
d35686c
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
deeksha345 Jan 13, 2023
c6d351f
Merge branch 'release-1.3.8' of https://github.com/AzureArcForKuberne…
deeksha345 Jan 13, 2023
0cd6017
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
deeksha345 Jan 18, 2023
1b51c5e
updating cassete file
Jan 12, 2023
c1f8614
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
deeksha345 Jan 19, 2023
2ff27e9
Merge pull request #199 from AzureArcForKubernetes/ariflakhani/2022-1…
Arif-lakhani Jan 20, 2023
e10938b
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
deeksha345 Jan 23, 2023
2fb41e7
Merge branch 'k8s-extension/public' into release-1.3.8
deeksha345 Jan 23, 2023
8a48eea
updating HISTORY.rst
deeksha345 Jan 23, 2023
601d4c7
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
deeksha345 Jan 23, 2023
8319907
Merge pull request #209 from AzureArcForKubernetes/release-1.3.8
deeksha345 Jan 23, 2023
942738f
Deprecate longer parameter names when accepting config settings (#213)
Arif-lakhani Jan 31, 2023
f122f93
merge from upstream branch
Jan 31, 2023
9aa7d3d
Release 1.3.9
Jan 31, 2023
398f140
Merge pull request #214 from AzureArcForKubernetes/release/1.3.9
Arif-lakhani Jan 31, 2023
2473565
make containerinsights dcr name consistent (#211)
ganga1980 Feb 2, 2023
0845f61
[Dapr] Update version comparison logic to use semver based comparison…
shubham1172 Feb 17, 2023
ffb8a95
bump k8s-extension version to 1.4.0 (#220)
bavneetsingh16 Feb 17, 2023
c957325
Revert "bump k8s-extension version to 1.4.0 (#220)" (#222)
bavneetsingh16 Feb 17, 2023
9c0c41a
Merge branch 'main' of github.com:Azure/azure-cli-extensions into new…
Feb 18, 2023
de4f530
[k8s-extension] Update extension CLI to v1.4.0
Feb 18, 2023
e67bfda
Merge pull request #223 from AzureArcForKubernetes/new_release
bavneetsingh16 Feb 18, 2023
b0ee4c2
sync with upstream cli repo
Mar 22, 2023
4ced5e8
update release history
Mar 22, 2023
f30b5c9
fix openservice mesh cli testcase issue
Mar 22, 2023
03d9b63
Merge pull request #225 from AzureArcForKubernetes/sync_cli_upstream
bavneetsingh16 Mar 22, 2023
e09dcc6
Zetia/fix ssl secret flag (#224)
zetiaatgithub Mar 22, 2023
db556d2
feat: public preview support for microsoft.azuremonitor.containers.me…
bragi92 May 19, 2023
87a25a8
Merge branch 'main' of github.com:Azure/azure-cli-extensions into rel…
May 19, 2023
3a154e9
Merge pull request #229 from AzureArcForKubernetes/release-1.4.1
bavneetsingh16 May 20, 2023
4f2b74c
remove redundant extension test (#230)
bavneetsingh16 May 20, 2023
6e583a9
ci MSI default for arc cluster (#231)
wanlonghenry May 31, 2023
b295046
Merge branch 'main' of github.com:Azure/azure-cli-extensions into rel…
Jun 23, 2023
029ce31
bump k8s-extension version to 1.4.2
Jun 23, 2023
30a373b
Merge pull request #235 from AzureArcForKubernetes/release-1.4.2
bavneetsingh16 Jun 23, 2023
dfd1139
ContainerInsights extension - Extend dataCollectionSettings config se…
ganga1980 Jun 30, 2023
a33424b
Generated files for 2023-05-01-preview
Jun 30, 2023
a7fa6eb
Support for 2023-05-01-preview
Jul 5, 2023
290f24c
Rename get to show
Jul 5, 2023
4f6da18
Added ExtensionType api test cases
Jul 17, 2023
5ff7d66
ContainerInsights extension - Extend dataCollectionSettings with cont…
wanlonghenry Jul 18, 2023
57679f8
Fix for Liniting issues
Jul 19, 2023
9beb747
Fixing test cases
Jul 19, 2023
1f7b9ce
comment failing test cases
Jul 24, 2023
42d8b15
[k8s-extension] add kind tag in DCR creation (#240)
wanlonghenry Jul 25, 2023
e9aebbc
Use semver package (#241)
shubham1172 Jul 28, 2023
e36dfad
bump k8s-extension version to 1.4.3
Jul 28, 2023
2561f35
Merge pull request #243 from AzureArcForKubernetes/release-1.4.3
bavneetsingh16 Jul 28, 2023
3a2d4a8
Reverting commented test cases
Jul 25, 2023
4fa705d
Add support to skip provisioning of prerequisites for Azure Monitor K…
ms-hujia Aug 1, 2023
980d53b
{ARC} fix: update logic to sanitize cluster name for dc* objects (#242)
bragi92 Aug 1, 2023
29f1210
Fix osm-arc version check for CI tags (#244)
nshankar13 Aug 2, 2023
f230c8e
New cassette file
Aug 3, 2023
5091eaa
Remove unused propeties from table format
Aug 3, 2023
c2ac205
Merge branch 'k8s-extension/public' into arif/2021_05_01_preview
Arif-lakhani Aug 3, 2023
a122362
Merge pull request #236 from AzureArcForKubernetes/arif/2021_05_01_pr…
Arif-lakhani Aug 10, 2023
740fa4d
Merge branch 'main' of github.com:Azure/azure-cli-extensions into rel…
Aug 11, 2023
5ac1d97
bump k8s-extension version 1.4.3
Aug 11, 2023
e1250ee
Merge pull request #246 from AzureArcForKubernetes/release-new-1.4.3
bavneetsingh16 Aug 11, 2023
8df0be1
Add old commands back with deprecated status
Aug 11, 2023
aebbef4
Fix linting issues
Aug 14, 2023
a74f76d
Merge pull request #247 from AzureArcForKubernetes/ariflakhani/deprecate
Arif-lakhani Aug 14, 2023
9f8159c
Reverting changes for extensions type api
Aug 22, 2023
7166e84
change the location for test runs and arc clusters
Aug 23, 2023
6be2701
Merge pull request #249 from AzureArcForKubernetes/revertextensionstype
Arif-lakhani Aug 23, 2023
584815d
[k8s-extension] create new cli release - v1.4.3 (#250)
bavneetsingh16 Aug 23, 2023
aa77ff2
Revert "[k8s-extension] create new cli release - v1.4.3 (#250)" (#251)
bavneetsingh16 Aug 23, 2023
7944db5
Merge branch 'main' of github.com:Azure/azure-cli-extensions into new…
Aug 23, 2023
96beb6f
[k8s-extension] Update extension CLI to v1.4.3
Aug 23, 2023
b79d107
Merge pull request #253 from AzureArcForKubernetes/new_cli-1.4.3
bavneetsingh16 Aug 24, 2023
7786f2a
Drop relay sdk (#254)
necusjz Sep 1, 2023
af2d1b9
bump k8s-extension version to 1.4.4
Sep 1, 2023
ef01ddd
update readme
Sep 1, 2023
35d9eba
Merge pull request #255 from AzureArcForKubernetes/release-1.4.4
bavneetsingh16 Sep 1, 2023
2c4c1de
remove useless snippets (#256)
necusjz Sep 2, 2023
1fef154
Add generated files for 2023-05-01
Sep 18, 2023
9902d52
Update extensionsType api to 2023-05-01-preview
Sep 18, 2023
a64f0e4
Merge pull request #258 from AzureArcForKubernetes/2023-05-01
Arif-lakhani Sep 18, 2023
bf020ff
Update OSM-Arc version check for beta and CI tags (#257)
nshankar13 Sep 19, 2023
c4adf5f
Merge branch 'main' of github.com:Azure/azure-cli-extensions into rel…
Sep 19, 2023
57db317
bump k8s-extension version to 1.5.0
Sep 19, 2023
5268aa9
Merge pull request #259 from AzureArcForKubernetes/release-1.4.6
bavneetsingh16 Sep 20, 2023
6adb8f6
add deprecated params for extension types
Sep 20, 2023
259feec
Merge pull request #260 from AzureArcForKubernetes/DeprecatedParams
Arif-lakhani Sep 20, 2023
cb846e7
Add breaking change details to the history
Sep 25, 2023
1575dbf
Merge pull request #261 from AzureArcForKubernetes/DeprecatedParams
Arif-lakhani Sep 25, 2023
41f9f93
use the recomended param for flag
Sep 27, 2023
29ad71d
Merge pull request #262 from AzureArcForKubernetes/DeprecatedParams
Arif-lakhani Sep 27, 2023
40fd25d
Add WorkloadIAM extension support and tests (#265)
AntonioND Dec 8, 2023
fdbcb63
bump k8s-extension version to 1.5.3
Dec 8, 2023
59b6885
update readme and cli version
Dec 8, 2023
2ac9710
Merge pull request #266 from AzureArcForKubernetes/release-1.5.3
bavneetsingh16 Dec 8, 2023
44267c4
[k8s-extension] Update extension CLI to v1.5.3
Dec 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/k8s-extension/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

1.5.3
++++++++++++++++++
* Add WorkloadIAM extension support and tests.

1.5.2
++++++++++++++++++
* Update help text on configuration-settings and configuration-protected-settings properties.
Expand Down
2 changes: 2 additions & 0 deletions src/k8s-extension/azext_k8s_extension/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from .partner_extensions.AzureMLKubernetes import AzureMLKubernetes
from .partner_extensions.DataProtectionKubernetes import DataProtectionKubernetes
from .partner_extensions.Dapr import Dapr
from .partner_extensions.WorkloadIAM import WorkloadIAM
from .partner_extensions.DefaultExtension import (
DefaultExtension,
user_confirmation_factory,
Expand All @@ -51,6 +52,7 @@ def ExtensionFactory(extension_name):
"microsoft.azureml.kubernetes": AzureMLKubernetes,
"microsoft.dapr": Dapr,
"microsoft.dataprotection.kubernetes": DataProtectionKubernetes,
"microsoft.workloadiam": WorkloadIAM,
}

# Return the extension if we find it in the map, else return the default
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

import subprocess

from knack.log import get_logger
from knack.util import CLIError

from azure.cli.core.azclierror import InvalidArgumentValueError

from ..vendored_sdks.models import (Extension, Scope, ScopeCluster)

from .DefaultExtension import DefaultExtension

logger = get_logger(__name__)

# The user settings are case-insensitive
CONFIG_SETTINGS_USER_TRUST_DOMAIN = 'trustdomain'
CONFIG_SETTINGS_USER_LOCAL_AUTHORITY = 'localauthority'
CONFIG_SETTINGS_USER_TENANT_ID = 'tenantid'
CONFIG_SETTINGS_USER_JOIN_TOKEN = 'jointoken'

CONFIG_SETTINGS_HELM_TRUST_DOMAIN = 'global.workload-iam.trustDomain'
CONFIG_SETTINGS_HELM_TENANT_ID = 'global.workload-iam.tenantID'
CONFIG_SETTINGS_HELM_JOIN_TOKEN = 'workload-iam-local-authority.localAuthorityArgs.joinToken'


class WorkloadIAM(DefaultExtension):

def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_type, cluster_rp,
extension_type, scope, auto_upgrade_minor_version, release_train, version, target_namespace,
release_namespace, configuration_settings, configuration_protected_settings,
configuration_settings_file, configuration_protected_settings_file,
plan_name, plan_publisher, plan_product):
"""
Create method for ExtensionType 'microsoft.workloadiam'.
"""

# Ensure that the values provided by the user for generic values of Arc extensions are
# valid, set sensible default values if not.
if release_train is None:
# TODO - Set this to 'stable' when the extension is ready
release_train = 'preview'

scope = scope.lower()
if scope is None:
scope = 'cluster'
elif scope != 'cluster':
raise InvalidArgumentValueError(
f"Invalid scope '{scope}'. This extension can only be installed at 'cluster' scope.")

# Scope is always cluster
scope_cluster = ScopeCluster(release_namespace=release_namespace)
ext_scope = Scope(cluster=scope_cluster, namespace=None)

# Create new dictionary where the keys of the user settings are all lowercase (but leave the
# others alone in case they are specific settings that have to be passed to the Helm chart).
validated_settings = dict()
all_user_settings = [CONFIG_SETTINGS_USER_TRUST_DOMAIN, CONFIG_SETTINGS_USER_TENANT_ID,
CONFIG_SETTINGS_USER_LOCAL_AUTHORITY, CONFIG_SETTINGS_USER_JOIN_TOKEN]
for key, value in configuration_settings.items():
if key.lower() in all_user_settings:
validated_settings[key.lower()] = value
else:
validated_settings[key] = value
config_settings = validated_settings

# Get user configuration values and remove them from the dictionary so that they aren't
# passed to the Helm chart
trust_domain = config_settings.pop(CONFIG_SETTINGS_USER_TRUST_DOMAIN, None)
tenant_id = config_settings.pop(CONFIG_SETTINGS_USER_TENANT_ID, None)
local_authority = config_settings.pop(CONFIG_SETTINGS_USER_LOCAL_AUTHORITY, None)
join_token = config_settings.pop(CONFIG_SETTINGS_USER_JOIN_TOKEN, None)

# A trust domain name is always required
if trust_domain is None:
raise InvalidArgumentValueError(
"Invalid configuration settings. Please provide a trust domain name.")

if tenant_id is None:
raise InvalidArgumentValueError(
"Invalid configuration settings. Please provide a tenant ID.")

# If the user hasn't provided a join token, create one
if join_token is None:
if local_authority is None:
raise InvalidArgumentValueError(
"Invalid configuration settings. Either a join token or a local authority name "
"must be provided.")
join_token = self.get_join_token(trust_domain, local_authority)
else:
logger.info("Join token is provided")

# Save configuration setting values to overwrite values in the Helm chart
configuration_settings[CONFIG_SETTINGS_HELM_TRUST_DOMAIN] = trust_domain
configuration_settings[CONFIG_SETTINGS_HELM_TENANT_ID] = tenant_id
configuration_settings[CONFIG_SETTINGS_HELM_JOIN_TOKEN] = join_token

logger.debug("Configuration settings value for Helm: %s" % str(configuration_settings))

create_identity = True
extension = Extension(
extension_type=extension_type,
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
version=version,
scope=ext_scope,
configuration_settings=configuration_settings,
configuration_protected_settings=configuration_protected_settings
)
return extension, name, create_identity

def get_join_token(self, trust_domain, local_authority):
"""
Invoke the az command to obtain a join token.
"""

logger.info("Getting a join token from the control plane")

# Invoke az workload-iam command to obtain the join token
cmd = [
"az", "workload-iam", "local-authority", "attestation-method", "create",
"--td", trust_domain,
"--la", local_authority,
"--type", "joinTokenAttestationMethod",
"--query", "singleUseToken",
"--dn", "myJoinToken",
]
cmd_str = " ".join(cmd)

try:
# Note: We can't use get_default_cli() here because its invoke() method
# always prints the console output, which we want to avoid.
result = subprocess.run(cmd, capture_output=True, shell=True)
except Exception as e:
logger.error(f"Error while generating a join token: {cmd_str}")
raise e

if result.returncode != 0:
raise CLIError(f"Failed to generate a join token (exit code {result.returncode}): {cmd_str}")

try:
# Strip double quotes from the output
command_output = result.stdout.decode("utf-8")
token = command_output.strip("\r\n").strip("\"")
except Exception as e:
logger.error(f"Failed to parse output of join token command: {cmd_str}")
raise e

return token
Loading