diff --git a/linter_exclusions.yml b/linter_exclusions.yml index 30bf25317b0..f3d61b9d04f 100644 --- a/linter_exclusions.yml +++ b/linter_exclusions.yml @@ -1166,6 +1166,9 @@ iot central user update: central_dns_suffix: rule_exclusions: - no_parameter_defaults_for_update_commands +iot device-update update: + rule_exclusions: + - require_wait_command_if_no_wait iot dps enrollment update: parameters: auth_type_dataplane: diff --git a/src/aks-preview/HISTORY.rst b/src/aks-preview/HISTORY.rst index 9f3ce8eafcc..885057ebb50 100644 --- a/src/aks-preview/HISTORY.rst +++ b/src/aks-preview/HISTORY.rst @@ -12,6 +12,8 @@ To release a new version, please select a new version number (usually plus 1 to Pending +++++++ * [BREAKING CHANGE] Since the service no longer supports updating source resource id for role binding, so remove --source-resource-id of `aks trustedaccess rolebinding update` command +* change rolebinding create command parameter roles to comma-seperated +* Upgrade kollect command to use Periscope version 0.0.10 supporting enhanced Windows log collection. 0.5.93 ++++++ diff --git a/src/aks-preview/azext_aks_preview/_consts.py b/src/aks-preview/azext_aks_preview/_consts.py index bffecaa522d..742948b46bf 100644 --- a/src/aks-preview/azext_aks_preview/_consts.py +++ b/src/aks-preview/azext_aks_preview/_consts.py @@ -178,8 +178,8 @@ CONST_PERISCOPE_REPO_ORG = "azure" CONST_PERISCOPE_CONTAINER_REGISTRY = "mcr.microsoft.com" -CONST_PERISCOPE_RELEASE_TAG = "v0.9" -CONST_PERISCOPE_IMAGE_VERSION = "0.0.9" +CONST_PERISCOPE_RELEASE_TAG = "0.0.10" +CONST_PERISCOPE_IMAGE_VERSION = "0.0.10" CONST_PERISCOPE_NAMESPACE = "aks-periscope" CONST_AZURE_KEYVAULT_NETWORK_ACCESS_PUBLIC = "Public" diff --git a/src/aks-preview/azext_aks_preview/_help.py b/src/aks-preview/azext_aks_preview/_help.py index 39c923358ac..3f1f8ba3262 100644 --- a/src/aks-preview/azext_aks_preview/_help.py +++ b/src/aks-preview/azext_aks_preview/_help.py @@ -1837,7 +1837,7 @@ examples: - name: Create a new trusted access role binding - text: az aks trustedaccess rolebinding create -g myResourceGroup --cluster-name myCluster -n bindingName -s /subscriptions/0000/resourceGroups/myResourceGroup/providers/Microsoft.Demo/samples --roles Microsoft.Demo/samples/reader Microsoft.Demo/samples/writer + text: az aks trustedaccess rolebinding create -g myResourceGroup --cluster-name myCluster -n bindingName -s /subscriptions/0000/resourceGroups/myResourceGroup/providers/Microsoft.Demo/samples --roles Microsoft.Demo/samples/reader,Microsoft.Demo/samples/writer """ helps['aks trustedaccess rolebinding update'] = """ diff --git a/src/aks-preview/azext_aks_preview/_params.py b/src/aks-preview/azext_aks_preview/_params.py index d834db88fb1..f72a259bc5b 100644 --- a/src/aks-preview/azext_aks_preview/_params.py +++ b/src/aks-preview/azext_aks_preview/_params.py @@ -703,11 +703,11 @@ def load_arguments(self, _): '--name', '-n'], required=True, help='The role binding name.') with self.argument_context('aks trustedaccess rolebinding create') as c: - c.argument('roles', nargs='*', help='space-separated roles: Microsoft.Demo/samples/reader Microsoft.Demo/samples/writer ...') + c.argument('roles', help='comma-separated roles: Microsoft.Demo/samples/reader,Microsoft.Demo/samples/writer,...') c.argument('source_resource_id', options_list=['--source-resource-id', '-s'], help='The source resource id of the binding') with self.argument_context('aks trustedaccess rolebinding update') as c: - c.argument('roles', nargs='*', help='space-separated roles: Microsoft.Demo/samples/reader Microsoft.Demo/samples/writer ...') + c.argument('roles', help='comma-separated roles: Microsoft.Demo/samples/reader,Microsoft.Demo/samples/writer,...') def _get_default_install_location(exe_name): diff --git a/src/aks-preview/azext_aks_preview/aks_diagnostics.py b/src/aks-preview/azext_aks_preview/aks_diagnostics.py index 7b09b6c7dfb..3b278e1a170 100644 --- a/src/aks-preview/azext_aks_preview/aks_diagnostics.py +++ b/src/aks-preview/azext_aks_preview/aks_diagnostics.py @@ -12,13 +12,15 @@ import time from azure.cli.core.commands.client_factory import get_mgmt_service_client, get_subscription_id +from enum import Flag, auto from knack.log import get_logger from knack.prompting import prompt_y_n from knack.util import CLIError from msrestazure.azure_exceptions import CloudError +from packaging import version from tabulate import tabulate -from azext_aks_preview._client_factory import get_storage_client +from azext_aks_preview._client_factory import cf_agent_pools, get_storage_client from azext_aks_preview._consts import ( CONST_CONTAINER_NAME_MAX_LENGTH, @@ -34,6 +36,11 @@ logger = get_logger(__name__) +class ClusterFeatures(Flag): + NONE = 0 + WIN_HPC = auto() + + # pylint: disable=line-too-long def aks_kollect_cmd(cmd, # pylint: disable=too-many-statements,too-many-locals client, @@ -137,7 +144,10 @@ def aks_kollect_cmd(cmd, # pylint: disable=too-many-statements,too-many-local container_name = _generate_container_name(mc.fqdn, mc.private_fqdn) sas_token = sas_token.strip('?') - kustomize_yaml = _get_kustomize_yaml(storage_account_name, sas_token, container_name, container_logs, kube_objects, node_logs, node_logs_windows) + cluster_features = _get_cluster_features(cmd.cli_ctx, resource_group_name, name) + + run_id = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H-%M-%SZ") + kustomize_yaml = _get_kustomize_yaml(storage_account_name, sas_token, container_name, run_id, cluster_features, container_logs, kube_objects, node_logs, node_logs_windows) kustomize_folder = tempfile.mkdtemp() kustomize_file_path = os.path.join(kustomize_folder, "kustomization.yaml") try: @@ -227,11 +237,20 @@ def aks_kanalyze_cmd(client, resource_group_name: str, name: str) -> None: def _get_kustomize_yaml(storage_account_name, sas_token, container_name, + run_id, + cluster_features, container_logs=None, kube_objects=None, node_logs_linux=None, node_logs_windows=None): + components = { + 'win-hpc': bool(cluster_features & ClusterFeatures.WIN_HPC) + } + + component_content = "\n".join(f'- https://github.com/{CONST_PERISCOPE_REPO_ORG}/aks-periscope//deployment/components/{c}?ref={CONST_PERISCOPE_RELEASE_TAG}' for c, enabled in components.items() if enabled) + diag_config_vars = { + 'DIAGNOSTIC_RUN_ID': run_id, 'DIAGNOSTIC_CONTAINERLOGS_LIST': container_logs, 'DIAGNOSTIC_KUBEOBJECTS_LIST': kube_objects, 'DIAGNOSTIC_NODELOGS_LIST_LINUX': node_logs_linux, @@ -247,6 +266,9 @@ def _get_kustomize_yaml(storage_account_name, resources: - https://github.com/{CONST_PERISCOPE_REPO_ORG}/aks-periscope//deployment/base?ref={CONST_PERISCOPE_RELEASE_TAG} +components: +{component_content} + namespace: {CONST_PERISCOPE_NAMESPACE} images: @@ -313,6 +335,26 @@ def _generate_container_name(fqdn: str, private_fqdn: str) -> str: return container_name +def _get_cluster_features(cli_ctx, resource_group_name, cluster_name): + agent_pool_client = cf_agent_pools(cli_ctx) + agent_pool_items = agent_pool_client.list(resource_group_name, cluster_name) + agent_pools = list(agent_pool_items) + + features = ClusterFeatures.NONE + if _is_windows_hpc_supported(agent_pools): + features |= ClusterFeatures.WIN_HPC + + return features + + +def _is_windows_hpc_supported(agent_pools): + # https://docs.microsoft.com/en-us/rest/api/aks/agent-pools/list?tabs=HTTP#agentpool + # The full (major.minor.patch) version *may* be stored in currentOrchestratorVersion. + # If not, it'll be in orchestratorVersion. + windows_k8s_versions = [p.current_orchestrator_version or p.orchestrator_version for p in agent_pools if p.os_type.casefold() == "Windows".casefold()] + return all([version.parse(v) >= version.parse("1.23.0") for v in windows_k8s_versions]) + + def _display_diagnostics_report(temp_kubeconfig_path): # pylint: disable=too-many-statements if not which('kubectl'): raise CLIError('Can not find kubectl executable in PATH') diff --git a/src/aks-preview/azext_aks_preview/custom.py b/src/aks-preview/azext_aks_preview/custom.py index 16e601a906a..da4a0c58d42 100644 --- a/src/aks-preview/azext_aks_preview/custom.py +++ b/src/aks-preview/azext_aks_preview/custom.py @@ -2225,7 +2225,8 @@ def aks_trustedaccess_role_binding_create(cmd, client, resource_group_name, clus resource_type=CUSTOM_MGMT_AKS_PREVIEW, operation_group="trusted_access_role_bindings", ) - roleBinding = TrustedAccessRoleBinding(source_resource_id=source_resource_id, roles=roles) + roleList = roles.split(',') + roleBinding = TrustedAccessRoleBinding(source_resource_id=source_resource_id, roles=roleList) return client.create_or_update(resource_group_name, cluster_name, role_binding_name, roleBinding) diff --git a/src/index.json b/src/index.json index 17afef093c7..b7d6b037dd0 100644 --- a/src/index.json +++ b/src/index.json @@ -11713,6 +11713,79 @@ "version": "0.16.1" }, "sha256Digest": "d6c814af4bdc4020bbb2971f718796fac0e12a4319258e6704d711c2f9adca38" + }, + { + "downloadUrl": "https://github.com/Azure/azure-iot-cli-extension/releases/download/v0.17.0/azure_iot-0.17.0-py3-none-any.whl", + "filename": "azure_iot-0.17.0-py3-none-any.whl", + "metadata": { + "azext.minCliCoreVersion": "2.30.0", + "classifiers": [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "License :: OSI Approved :: MIT License" + ], + "extensions": { + "python.details": { + "contacts": [ + { + "email": "iotupx@microsoft.com", + "name": "Microsoft", + "role": "author" + } + ], + "document_names": { + "description": "DESCRIPTION.rst" + }, + "project_urls": { + "Home": "https://github.com/azure/azure-iot-cli-extension" + } + } + }, + "extras": [ + "uamqp" + ], + "generator": "bdist_wheel (0.30.0)", + "license": "MIT", + "metadata_version": "2.0", + "name": "azure-iot", + "requires_python": ">=3.7", + "run_requires": [ + { + "requires": [ + "azure-core (<2.0.0,<2.0.0azure-mgmt-core>=1.3.0,>=1.24.0)", + "azure-iot-device (~=2.11)", + "jsonschema (~=3.2.0)", + "msrest (>=0.6.21)", + "msrestazure (<2.0.0,>=0.6.3)", + "packaging", + "tqdm (~=4.62)" + ] + }, + { + "extra": "uamqp", + "requires": [ + "uamqp (~=1.2)" + ] + }, + { + "environment": "python_version < \"3.8\"", + "requires": [ + "importlib-metadata" + ] + } + ], + "summary": "The Azure IoT extension for Azure CLI.", + "version": "0.17.0" + }, + "sha256Digest": "924d4cf255efe8a8950d968ed474be42b9da790c46381893a1d2892fdf72281e" } ], "azurestackhci": [ @@ -25285,6 +25358,48 @@ "version": "1.3.1" }, "sha256Digest": "c6231d4bf4f05b5e9f169ddc8dd278113b4c8dcedb3506684641f09d1dfb36ce" + }, + { + "downloadUrl": "https://azcliprod.blob.core.windows.net/cli-extensions/k8s_extension-1.3.2-py3-none-any.whl", + "filename": "k8s_extension-1.3.2-py3-none-any.whl", + "metadata": { + "azext.minCliCoreVersion": "2.24.0", + "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" + ], + "extensions": { + "python.details": { + "contacts": [ + { + "email": "azpycli@microsoft.com", + "name": "Microsoft Corporation", + "role": "author" + } + ], + "document_names": { + "description": "DESCRIPTION.rst" + }, + "project_urls": { + "Home": "https://github.com/Azure/azure-cli-extensions/tree/main/src/k8s-extension" + } + } + }, + "generator": "bdist_wheel (0.30.0)", + "license": "MIT", + "metadata_version": "2.0", + "name": "k8s-extension", + "summary": "Microsoft Azure Command-Line Tools K8s-extension Extension", + "version": "1.3.2" + }, + "sha256Digest": "f081a5501ade1d6aa9eb62b3fb58de78adb614031c6bbd48b1d8c2af0af1197a" } ], "k8sconfiguration": [ diff --git a/src/k8s-extension/HISTORY.rst b/src/k8s-extension/HISTORY.rst index 50684dd4731..5e4d977b057 100644 --- a/src/k8s-extension/HISTORY.rst +++ b/src/k8s-extension/HISTORY.rst @@ -3,6 +3,10 @@ Release History =============== +1.3.3 +++++++++++++++++++ +* microsoft.azuremonitor.containers: add condition to use different api version for provisioned clusters + 1.3.2 ++++++++++++++++++ * Create identity for Appliances clusters diff --git a/src/k8s-extension/setup.py b/src/k8s-extension/setup.py index 968417737e4..295ea4718f9 100644 --- a/src/k8s-extension/setup.py +++ b/src/k8s-extension/setup.py @@ -33,7 +33,7 @@ # TODO: Add any additional SDK dependencies here DEPENDENCIES = [] -VERSION = "1.3.2" +VERSION = "1.3.3" with open("README.rst", "r", encoding="utf-8") as f: README = f.read()