Skip to content

Commit

Permalink
merge Azure/main->calvinsid/main
Browse files Browse the repository at this point in the history
  • Loading branch information
StrawnSC committed May 6, 2022
2 parents 34eab57 + ecccae2 commit 0a32abd
Show file tree
Hide file tree
Showing 112 changed files with 27,255 additions and 1,660 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

/src/dnc/ @alegal

/src/dns-resolver/ @necusjz

/src/edgeorder/ @necusjz

/src/express-route-cross-connection/ @necusjz @kairu-ms @jsntcy
Expand Down
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
- If the issue is to do with Azure CLI 2.0 in-particular, create an issue here at [Azure/azure-cli](https://github.com/Azure/azure-cli/issues)

### Related command
<!--- Please provide the related command with az {command} if you can, so that we can quickly route to the related team for help. --->


### Extension name (the extension in question)


Expand Down
4 changes: 4 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This checklist is used to make sure that common guidelines for a pull request are followed.

### Related command
<!--- Please provide the related command with az {command} if you can, so that we can quickly route to the related person to review. --->


### General Guidelines

- [ ] Have you run `azdev style <YOUR_EXT>` locally? (`pip install azdev` required)
Expand Down
16 changes: 16 additions & 0 deletions linter_exclusions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,22 @@ arcdata dc create:
metrics_ui_public_key_file:
rule_exclusions:
- option_length_too_long
arcdata ad-connector create:
parameters:
domain_service_account_secret:
rule_exclusions:
- option_length_too_long
secondary_domain_controllers:
rule_exclusions:
- option_length_too_long
arcdata ad-connector update:
parameters:
domain_service_account_secret:
rule_exclusions:
- option_length_too_long
secondary_domain_controllers:
rule_exclusions:
- option_length_too_long
sql mi-arc update:
parameters:
preferred_primary_replica:
Expand Down
4 changes: 4 additions & 0 deletions src/aks-preview/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

0.5.66
++++++
* Prompt when no arguments are given to update and nodepool update to see if the customer wants to try goal seek to current settings.

0.5.65
++++++
* Add `--ignore-pod-disruption-budget` flag for `az aks nodepool delete` for ignoring PodDisruptionBudget.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"test_aks_nodepool_add_with_gpu_instance_profile",
"test_aks_create_with_crg_id",
"test_aks_create_and_update_with_http_proxy_config",
"test_aks_snapshot"
"test_aks_snapshot",
"test_aks_custom_kubelet_identity"
]
}
}
42 changes: 22 additions & 20 deletions src/aks-preview/azext_aks_preview/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,48 +14,46 @@
'ContainerServiceClient')


def cf_storage(cli_ctx, subscription_id=None):
return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_STORAGE, subscription_id=subscription_id)


def cf_compute_service(cli_ctx, *_):
return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_COMPUTE)
def get_container_service_client(cli_ctx, **_):
return get_mgmt_service_client(cli_ctx, CUSTOM_MGMT_AKS_PREVIEW)


def cf_container_services(cli_ctx, *_):
return get_container_service_client(cli_ctx).container_services


def get_container_service_client(cli_ctx, **_):
return get_mgmt_service_client(cli_ctx, CUSTOM_MGMT_AKS_PREVIEW)


def cf_managed_clusters(cli_ctx, *_):
return get_mgmt_service_client(cli_ctx, CUSTOM_MGMT_AKS_PREVIEW).managed_clusters
return get_container_service_client(cli_ctx).managed_clusters


def cf_agent_pools(cli_ctx, *_):
return get_mgmt_service_client(cli_ctx, CUSTOM_MGMT_AKS_PREVIEW).agent_pools
return get_container_service_client(cli_ctx).agent_pools


def cf_mc_snapshots_client(cli_ctx, subscription_id=None):
return get_mgmt_service_client(cli_ctx, CUSTOM_MGMT_AKS_PREVIEW, subscription_id=subscription_id).managed_cluster_snapshots
def cf_maintenance_configurations(cli_ctx, *_):
return get_container_service_client(cli_ctx).maintenance_configurations


def cf_mc_snapshots(cli_ctx, *_):
return get_mgmt_service_client(cli_ctx, CUSTOM_MGMT_AKS_PREVIEW).managed_cluster_snapshots
def cf_nodepool_snapshots(cli_ctx, *_):
return get_container_service_client(cli_ctx).snapshots


# TODO: remove this
def cf_nodepool_snapshots_client(cli_ctx, subscription_id=None):
return get_mgmt_service_client(cli_ctx, CUSTOM_MGMT_AKS_PREVIEW, subscription_id=subscription_id).snapshots


def cf_nodepool_snapshots(cli_ctx, *_):
return get_mgmt_service_client(cli_ctx, CUSTOM_MGMT_AKS_PREVIEW).snapshots
def cf_mc_snapshots(cli_ctx, *_):
return get_container_service_client(cli_ctx).managed_cluster_snapshots


def cf_maintenance_configurations(cli_ctx, *_):
return get_mgmt_service_client(cli_ctx, CUSTOM_MGMT_AKS_PREVIEW).maintenance_configurations
# TODO: remove this
def cf_mc_snapshots_client(cli_ctx, subscription_id=None):
return get_mgmt_service_client(cli_ctx, CUSTOM_MGMT_AKS_PREVIEW, subscription_id=subscription_id).managed_cluster_snapshots


def cf_compute_service(cli_ctx, *_):
return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_COMPUTE)


def cf_resource_groups(cli_ctx, subscription_id=None):
Expand All @@ -73,6 +71,10 @@ def cf_container_registry_service(cli_ctx, subscription_id=None):
subscription_id=subscription_id)


def cf_storage(cli_ctx, subscription_id=None):
return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_STORAGE, subscription_id=subscription_id)


def get_auth_management_client(cli_ctx, scope=None, **_):
import re

Expand Down
17 changes: 13 additions & 4 deletions src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
type: bool
short-summary: Skip role assignment for subnet (advanced networking).
long-summary: If specified, please make sure your service principal has the access to your subnet.
- name: --zones -z
type: string array
short-summary: Space-separated list of availability zones where agent nodes will be placed.
- name: --client-secret
type: string
short-summary: Secret associated with the service principal. This argument is required if
Expand Down Expand Up @@ -517,7 +520,8 @@

helps['aks update'] = """
type: command
short-summary: Update a managed Kubernetes cluster properties, such as enable/disable cluster-autoscaler
short-summary: Update the properties of a managed Kubernetes cluster.
long-summary: Update the properties of a managed Kubernetes cluster. Can be used for example to enable/disable cluster-autoscaler. When called with no optional arguments this attempts to move the cluster to its goal state without changing the current cluster configuration. This can be used to move out of a non succeeded state.
parameters:
- name: --enable-cluster-autoscaler -e
type: bool
Expand Down Expand Up @@ -707,6 +711,8 @@
type: string
short-summary: Identifier of Azure Key Vault key.
examples:
- name: Reconcile the cluster back to its current state.
text: az aks update -g MyResourceGroup -n MyManagedCluster
- name: Enable cluster-autoscaler within node count range [1,5]
text: az aks update --enable-cluster-autoscaler --min-count 1 --max-count 5 -g MyResourceGroup -n MyManagedCluster
- name: Disable cluster-autoscaler for an existing cluster
Expand Down Expand Up @@ -990,9 +996,9 @@
type: int
short-summary: The maximum number of pods deployable to a node.
long-summary: If not specified, defaults based on network-plugin. 30 for "azure", 110 for "kubenet", or 250 for "none".
- name: --node-zones --zones -z
- name: --zones -z
type: string array
short-summary: (will be deprecated, use --zones) Availability zones where agent nodes will be placed.
short-summary: Space-separated list of availability zones where agent nodes will be placed.
- name: --vnet-subnet-id
type: string
short-summary: The ID of a subnet in an existing VNet into which to deploy the cluster.
Expand Down Expand Up @@ -1132,7 +1138,8 @@

helps['aks nodepool update'] = """
type: command
short-summary: Update a node pool to enable/disable cluster-autoscaler or change min-count or max-count
short-summary: Update a node pool properties.
long-summary: Update a node pool to enable/disable cluster-autoscaler or change min-count or max-count. When called with no optional arguments this attempts to move the cluster to its goal state without changing the current cluster configuration. This can be used to move out of a non succeeded state.
parameters:
- name: --enable-cluster-autoscaler -e
type: bool
Expand Down Expand Up @@ -1165,6 +1172,8 @@
type: string
short-summary: The node taints for the node pool.
examples:
- name: Reconcile the nodepool back to its current state.
text: az aks nodepool update -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster
- name: Enable cluster-autoscaler within node count range [1,5]
text: az aks nodepool update --enable-cluster-autoscaler --min-count 1 --max-count 5 -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster
- name: Disable cluster-autoscaler for an existing cluster
Expand Down
35 changes: 34 additions & 1 deletion src/aks-preview/azext_aks_preview/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from ._consts import CONST_CONTAINER_NAME_MAX_LENGTH
import re

from azure.cli.command_modules.acs._helpers import map_azure_error_to_cli_error
from azure.cli.core.azclierror import InvalidArgumentValueError, ResourceNotFoundError
from azure.core.exceptions import AzureError

from azext_aks_preview._client_factory import cf_nodepool_snapshots
from azext_aks_preview._consts import CONST_CONTAINER_NAME_MAX_LENGTH


def _trim_fqdn_name_containing_hcp(normalized_fqdn: str) -> str:
Expand Down Expand Up @@ -65,3 +72,29 @@ def similar_word(a, b):
matches.append(word)

return matches


def get_nodepool_snapshot_by_snapshot_id(cli_ctx, snapshot_id):
_re_snapshot_resource_id = re.compile(
r"/subscriptions/(.*?)/resourcegroups/(.*?)/providers/microsoft.containerservice/snapshots/(.*)",
flags=re.IGNORECASE,
)
snapshot_id = snapshot_id.lower()
match = _re_snapshot_resource_id.search(snapshot_id)
if match:
resource_group_name = match.group(2)
snapshot_name = match.group(3)
return get_nodepool_snapshot(cli_ctx, resource_group_name, snapshot_name)
raise InvalidArgumentValueError("Cannot parse snapshot name from provided resource id '{}'.".format(snapshot_id))


def get_nodepool_snapshot(cli_ctx, resource_group_name, snapshot_name):
snapshot_client = cf_nodepool_snapshots(cli_ctx)
try:
snapshot = snapshot_client.get(resource_group_name, snapshot_name)
# track 2 sdk raise exception from azure.core.exceptions
except AzureError as ex:
if "not found" in ex.message:
raise ResourceNotFoundError("Snapshot '{}' not found.".format(snapshot_name))
raise map_azure_error_to_cli_error(ex)
return snapshot
Loading

0 comments on commit 0a32abd

Please sign in to comment.