Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into k8s-extension/public
  • Loading branch information
jonathan-innis committed Aug 30, 2021
2 parents 8f9386c + c02aacd commit 03a376e
Show file tree
Hide file tree
Showing 392 changed files with 46,737 additions and 81,403 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/vmware/azext_vmware/tests/latest/recordings/*.yaml linguist-generated=true
17 changes: 17 additions & 0 deletions src/aks-preview/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@
Release History
===============

0.5.29
+++++
* Fix update (failed due to "ERROR: (BadRequest) Feature Microsoft.ContainerService/AutoUpgradePreview is not enabled" even when autoupgrade was not specified)
* Add podMaxPids argument for kubelet-config

0.5.28
+++++
* Update to adopt 2021-07-01 api-version

0.5.27
+++++
* GA private cluster public FQDN feature, breaking change to replace create parameter `--enable-public-fqdn` with `--disable-public-fqdn` since now it's enabled by default for private cluster during cluster creation.

0.5.26
+++++
* Correct containerLogMaxSizeMb to containerLogMaxSizeMB in customized kubelet config

0.5.25
+++++
* Add support for http proxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"exclude": {
"need additional feature": [
"test_aks_create_enable_encryption",
"test_aks_create_edge_zone"
"test_aks_create_edge_zone",
"test_aks_create_with_auto_upgrade_channel"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
},
"exclude": {
"need additional feature": [
"test_aks_create_with_ossku",
"test_aks_nodepool_add_with_ossku",
"test_aks_create_with_node_config",
"test_aks_create_private_cluster_public_fqdn",
"test_aks_create_with_azurekeyvaultsecretsprovider_addon",
"test_aks_create_addon_with_azurekeyvaultsecretsprovider_with_secret_rotation",
"test_aks_update_azurekeyvaultsecretsprovider_with_secret_rotation",
"test_aks_enable_addon_with_azurekeyvaultsecretsprovider",
Expand All @@ -20,8 +17,6 @@
"test_aks_enable_addon_with_openservicemesh",
"test_aks_disable_addon_openservicemesh",
"test_aks_create_with_auto_upgrade_channel",
"test_aks_create_with_azurekeyvaultsecretsprovider_addon",
"test_aks_custom_kubelet_identity",
"test_aks_disable_local_accounts",
"test_aks_create_with_pod_identity_enabled",
"test_aks_create_using_azurecni_with_pod_identity_enabled",
Expand Down
15 changes: 15 additions & 0 deletions src/aks-preview/azcli_aks_live_test/scripts/setup_venv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# check var
# specify the version of python3, e.g. 3.6
[[ -z "${PYTHON_VERSION}" ]] && (echo "PYTHON_VERSION is empty"; exit 1)
[[ -z "${ACS_BASE_DIR}" ]] && (echo "ACS_BASE_DIR is empty"; exit 1)

setupVenv(){
# delete existing venv
Expand Down Expand Up @@ -106,6 +107,19 @@ setupAKSPreview(){
source azEnv/bin/activate
}

createSSHKey(){
# create ssh-key in advance to avoid the race condition that is prone to occur when key creation is handled by
# azure-cli when performing test cases concurrently, this command will not overwrite the existing ssh-key
custom_ssh_dir=${1:-"${ACS_BASE_DIR}/tests/latest/data/.ssh"}
# remove dir if exists (clean up), otherwise create it
if [[ -d ${custom_ssh_dir} ]]; then
rm -rf ${custom_ssh_dir}
else
mkdir -p ${custom_ssh_dir}
fi
ssh-keygen -t rsa -b 2048 -C "[email protected]" -f ${custom_ssh_dir}/id_rsa -N "" -q <<< n
}

setup_option=${1:-""}
if [[ -n ${setup_option} ]]; then
# bash options
Expand Down Expand Up @@ -142,6 +156,7 @@ if [[ -n ${setup_option} ]]; then
ext_repo=${4:-""}
setupAZ "${cli_repo}" "${ext_repo}"
installTestPackages
createSSHKey
elif [[ ${setup_option} == "setup-akspreview" ]]; then
echo "Start to setup aks-preview!"
setupAKSPreview
Expand Down
9 changes: 9 additions & 0 deletions src/aks-preview/azcli_aks_live_test/scripts/transcribe_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ set -o xtrace
[[ -z "${CLI_BRANCH}" ]] && (echo "CLI_BRANCH is empty"; exit 1)
[[ -z "${EXT_REPO}" ]] && (echo "EXT_REPO is empty"; exit 1)
[[ -z "${EXT_BRANCH}" ]] && (echo "EXT_BRANCH is empty"; exit 1)
# base directories for acs, aks-preview and live test
[[ -z "${ACS_BASE_DIR}" ]] && (echo "ACS_BASE_DIR is empty"; exit 1)
[[ -z "${AKS_PREVIEW_BASE_DIR}" ]] && (echo "AKS_PREVIEW_BASE_DIR is empty"; exit 1)
[[ -z "${LIVE_TEST_BASE_DIR}" ]] && (echo "LIVE_TEST_BASE_DIR is empty"; exit 1)

# clear
cat /dev/null > env.list
Expand All @@ -60,6 +64,11 @@ echo "SYSTEM_PULLREQUEST_TARGETBRANCH=${SYSTEM_PULLREQUEST_TARGETBRANCH}" >> env
# python version
echo "PYTHON_VERSION=${PYTHON_VERSION}" >> env.list

# base directories
echo "ACS_BASE_DIR=${ACS_BASE_DIR}" >> env.list
echo "AKS_PREVIEW_BASE_DIR=${AKS_PREVIEW_BASE_DIR}" >> env.list
echo "LIVE_TEST_BASE_DIR=${LIVE_TEST_BASE_DIR}" >> env.list

# azdev env
echo "AZURE_CLI_TEST_DEV_SP_NAME=${AZCLI_ALT_CLIENT_ID}" >> env.list
echo "AZURE_CLI_TEST_DEV_RESOURCE_GROUP_LOCATION=${TEST_LOCATION}" >> env.list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ jobs:
displayName: "Create Dir for Recordings"
- task: CopyFiles@2
inputs:
contents: '$(ACS_BASE_DIR)/tests/latest/recordings/**'
contents: '$(ACS_BASE_DIR)/tests/latest/recordings/updated/**'
flattenFolders: true
targetFolder: $(Build.ArtifactStagingDirectory)/cli-recordings
condition: and(succeededOrFailed(), in(variables['COVERAGE'], 'cli', 'all'))
displayName: "Copy CLI Recordings"
- task: CopyFiles@2
inputs:
contents: '$(AKS_PREVIEW_BASE_DIR)/tests/latest/recordings/**'
contents: '$(AKS_PREVIEW_BASE_DIR)/tests/latest/recordings/updated/**'
flattenFolders: true
targetFolder: $(Build.ArtifactStagingDirectory)/ext-recordings
condition: and(succeededOrFailed(), in(variables['COVERAGE'], 'ext', 'all'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ variables:
value: "azure-cli-extensions"
- name: LIVE_TEST_BASE_DIR
value: "azure-cli-extensions/src/aks-preview/azcli_aks_live_test"
- name: ACS_BASE_DIR
value: "azure-cli/src/azure-cli/azure/cli/command_modules/acs"
- name: AKS_PREVIEW_BASE_DIR
value: "azure-cli-extensions/src/aks-preview/azext_aks_preview"

jobs:
- job: UnitTest
Expand Down
2 changes: 1 addition & 1 deletion src/aks-preview/azext_aks_preview/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, cli_ctx=None):
register_resource_type(
"latest",
CUSTOM_MGMT_AKS_PREVIEW,
SDKProfile("2021-05-01", {"container_services": "2017-07-01"}),
SDKProfile("2021-07-01", {"container_services": "2017-07-01"}),
)

acs_custom = CliCommandType(operations_tmpl='azext_aks_preview.custom#{}')
Expand Down
2 changes: 1 addition & 1 deletion src/aks-preview/azext_aks_preview/_completers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from azure.cli.core.decorators import Completer

# pylint: disable=line-too-long
from azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks.v2019_04_01.models import ContainerServiceVMSizeTypes
from azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks.v2021_07_01.models import ContainerServiceVMSizeTypes


@Completer
Expand Down
10 changes: 5 additions & 5 deletions src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@
- name: --fqdn-subdomain
type: string
short-summary: Prefix for FQDN that is created for private cluster with custom private dns zone scenario.
- name: --enable-public-fqdn
- name: --disable-public-fqdn
type: bool
short-summary: (Preview) Enable public fqdn feature for private cluster.
short-summary: Disable public fqdn feature for private cluster.
- name: --enable-node-public-ip
type: bool
short-summary: Enable VMSS node public IP.
Expand Down Expand Up @@ -559,10 +559,10 @@
short-summary: (Preview) If set to true, will enable getting static credential for this cluster.
- name: --enable-public-fqdn
type: bool
short-summary: (Preview) Enable public fqdn feature for private cluster.
short-summary: Enable public fqdn feature for private cluster.
- name: --disable-public-fqdn
type: bool
short-summary: (Preview) Disable public fqdn feature for private cluster.
short-summary: Disable public fqdn feature for private cluster.
examples:
- 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
Expand Down Expand Up @@ -1106,7 +1106,7 @@
long-summary: Credentials are always in YAML format, so this argument is effectively ignored.
- name: --public-fqdn
type: bool
short-summary: (Preview) Get private cluster credential with server address to be public fqdn.
short-summary: Get private cluster credential with server address to be public fqdn.
examples:
- name: Get access credentials for a managed Kubernetes cluster. (autogenerated)
text: az aks get-credentials --name MyManagedCluster --resource-group MyResourceGroup
Expand Down
2 changes: 1 addition & 1 deletion src/aks-preview/azext_aks_preview/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from knack.util import CLIError

# pylint: disable=no-name-in-module,import-error
from .vendored_sdks.azure_mgmt_preview_aks.v2021_05_01.models import ManagedClusterAPIServerAccessProfile
from .vendored_sdks.azure_mgmt_preview_aks.v2021_07_01.models import ManagedClusterAPIServerAccessProfile
from ._consts import CONST_CONTAINER_NAME_MAX_LENGTH
from ._consts import CONST_OUTBOUND_TYPE_LOAD_BALANCER, CONST_OUTBOUND_TYPE_USER_DEFINED_ROUTING

Expand Down
10 changes: 5 additions & 5 deletions src/aks-preview/azext_aks_preview/_loadbalancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
from distutils.version import StrictVersion # pylint: disable=no-name-in-module,import-error
from knack.log import get_logger

from .vendored_sdks.azure_mgmt_preview_aks.v2021_05_01.models import ManagedClusterLoadBalancerProfile
from .vendored_sdks.azure_mgmt_preview_aks.v2021_05_01.models import ManagedClusterLoadBalancerProfileManagedOutboundIPs
from .vendored_sdks.azure_mgmt_preview_aks.v2021_05_01.models import ManagedClusterLoadBalancerProfileOutboundIPPrefixes
from .vendored_sdks.azure_mgmt_preview_aks.v2021_05_01.models import ManagedClusterLoadBalancerProfileOutboundIPs
from .vendored_sdks.azure_mgmt_preview_aks.v2021_05_01.models import ResourceReference
from .vendored_sdks.azure_mgmt_preview_aks.v2021_07_01.models import ManagedClusterLoadBalancerProfile
from .vendored_sdks.azure_mgmt_preview_aks.v2021_07_01.models import ManagedClusterLoadBalancerProfileManagedOutboundIPs
from .vendored_sdks.azure_mgmt_preview_aks.v2021_07_01.models import ManagedClusterLoadBalancerProfileOutboundIPPrefixes
from .vendored_sdks.azure_mgmt_preview_aks.v2021_07_01.models import ManagedClusterLoadBalancerProfileOutboundIPs
from .vendored_sdks.azure_mgmt_preview_aks.v2021_07_01.models import ResourceReference

logger = get_logger(__name__)

Expand Down
8 changes: 4 additions & 4 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def load_arguments(self, _):
c.argument('enable_private_cluster', action='store_true')
c.argument('private_dns_zone')
c.argument('fqdn_subdomain')
c.argument('enable_public_fqdn', action='store_true', is_preview=True)
c.argument('disable_public_fqdn', action='store_true')
c.argument('enable_managed_identity', action='store_true')
c.argument('assign_identity', type=str, validator=validate_assign_identity)
c.argument('enable_sgxquotehelper', action='store_true')
Expand Down Expand Up @@ -154,8 +154,8 @@ def load_arguments(self, _):
c.argument('api_server_authorized_ip_ranges', type=str, validator=validate_ip_ranges)
c.argument('enable_pod_security_policy', action='store_true')
c.argument('disable_pod_security_policy', action='store_true')
c.argument('enable_public_fqdn', action='store_true', is_preview=True)
c.argument('disable_public_fqdn', action='store_true', is_preview=True)
c.argument('enable_public_fqdn', action='store_true')
c.argument('disable_public_fqdn', action='store_true')
c.argument('attach_acr', acr_arg_type, validator=validate_acr)
c.argument('detach_acr', acr_arg_type, validator=validate_acr)
c.argument('aks_custom_headers')
Expand Down Expand Up @@ -267,7 +267,7 @@ def load_arguments(self, _):
c.argument('user', options_list=['--user', '-u'], default='clusterUser', validator=validate_user)
c.argument('path', options_list=['--file', '-f'], type=file_type, completer=FilesCompleter(),
default=os.path.join(os.path.expanduser('~'), '.kube', 'config'))
c.argument('public_fqdn', default=False, action='store_true', is_preview=True)
c.argument('public_fqdn', default=False, action='store_true')

with self.argument_context('aks pod-identity') as c:
c.argument('cluster_name', type=str, help='The cluster name.')
Expand Down
2 changes: 1 addition & 1 deletion src/aks-preview/azext_aks_preview/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from azure.cli.core.util import CLIError
import azure.cli.core.keys as keys

from .vendored_sdks.azure_mgmt_preview_aks.v2021_05_01.models import ManagedClusterPropertiesAutoScalerProfile
from .vendored_sdks.azure_mgmt_preview_aks.v2021_07_01.models import ManagedClusterPropertiesAutoScalerProfile

from ._helpers import (_fuzzy_match)

Expand Down
35 changes: 16 additions & 19 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,11 @@
KeyCredential,
ServicePrincipalCreateParameters,
GetObjectsParameters)
from .vendored_sdks.azure_mgmt_preview_aks.v2021_05_01.models import (ContainerServiceLinuxProfile,
from .vendored_sdks.azure_mgmt_preview_aks.v2021_07_01.models import (ContainerServiceLinuxProfile,
ManagedClusterWindowsProfile,
ContainerServiceNetworkProfile,
ManagedClusterServicePrincipalProfile,
ContainerServiceSshConfiguration,
MaintenanceConfiguration,
TimeInWeek,
TimeSpan,
ContainerServiceSshPublicKey,
ManagedCluster,
ManagedClusterAADProfile,
Expand All @@ -73,7 +70,7 @@
ManagedClusterIdentity,
ManagedClusterAPIServerAccessProfile,
ManagedClusterSKU,
Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties,
ManagedServiceIdentityUserAssignedIdentitiesValue,
ManagedClusterAutoUpgradeProfile,
KubeletConfig,
LinuxOSConfig,
Expand All @@ -82,8 +79,7 @@
ManagedClusterPodIdentityProfile,
ManagedClusterPodIdentity,
ManagedClusterPodIdentityException,
UserAssignedIdentity,
ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties)
UserAssignedIdentity)
from ._client_factory import cf_resource_groups
from ._client_factory import get_auth_management_client
from ._client_factory import get_graph_rbac_management_client
Expand Down Expand Up @@ -1012,7 +1008,7 @@ def aks_create(cmd, # pylint: disable=too-many-locals,too-many-statements,to
private_dns_zone=None,
enable_managed_identity=True,
fqdn_subdomain=None,
enable_public_fqdn=False,
disable_public_fqdn=False,
api_server_authorized_ip_ranges=None,
aks_custom_headers=None,
appgw_name=None,
Expand Down Expand Up @@ -1344,7 +1340,7 @@ def aks_create(cmd, # pylint: disable=too-many-locals,too-many-statements,to
)
elif enable_managed_identity and assign_identity:
user_assigned_identity = {
assign_identity: Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties()
assign_identity: ManagedServiceIdentityUserAssignedIdentitiesValue()
}
identity = ManagedClusterIdentity(
type="UserAssigned",
Expand All @@ -1357,7 +1353,7 @@ def aks_create(cmd, # pylint: disable=too-many-locals,too-many-statements,to
raise CLIError('--assign-kubelet-identity can only be specified when --assign-identity is specified')
kubelet_identity = _get_user_assigned_identity(cmd.cli_ctx, assign_kubelet_identity)
identity_profile = {
'kubeletidentity': ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties(
'kubeletidentity': UserAssignedIdentity(
resource_id=assign_kubelet_identity,
client_id=kubelet_identity.client_id,
object_id=kubelet_identity.principal_id
Expand Down Expand Up @@ -1411,17 +1407,17 @@ def aks_create(cmd, # pylint: disable=too-many-locals,too-many-statements,to
mc.node_resource_group = node_resource_group

use_custom_private_dns_zone = False
if not enable_private_cluster and enable_public_fqdn:
raise ArgumentUsageError("--enable-public-fqdn should only be used with --enable-private-cluster")
if not enable_private_cluster and disable_public_fqdn:
raise ArgumentUsageError("--disable_public_fqdn should only be used with --enable-private-cluster")
if enable_private_cluster:
if load_balancer_sku.lower() != "standard":
raise ArgumentUsageError(
"Please use standard load balancer for private cluster")
mc.api_server_access_profile = ManagedClusterAPIServerAccessProfile(
enable_private_cluster=True
)
if enable_public_fqdn:
mc.api_server_access_profile.enable_private_cluster_public_fqdn = True
if disable_public_fqdn:
mc.api_server_access_profile.enable_private_cluster_public_fqdn = False

if private_dns_zone:
if not enable_private_cluster:
Expand Down Expand Up @@ -1794,10 +1790,9 @@ def aks_update(cmd, # pylint: disable=too-many-statements,too-many-branches,
raise ArgumentUsageError('--disable-public-fqdn cannot be applied for none mode private dns zone cluster')
instance.api_server_access_profile.enable_private_cluster_public_fqdn = False

if instance.auto_upgrade_profile is None:
instance.auto_upgrade_profile = ManagedClusterAutoUpgradeProfile()

if auto_upgrade_channel is not None:
if instance.auto_upgrade_profile is None:
instance.auto_upgrade_profile = ManagedClusterAutoUpgradeProfile()
instance.auto_upgrade_profile.upgrade_channel = auto_upgrade_channel

if not enable_managed_identity and assign_identity:
Expand Down Expand Up @@ -1834,7 +1829,7 @@ def aks_update(cmd, # pylint: disable=too-many-statements,too-many-branches,
)
elif goal_identity_type == "userassigned":
user_assigned_identity = {
assign_identity: Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties()
assign_identity: ManagedServiceIdentityUserAssignedIdentitiesValue()
}
instance.identity = ManagedClusterIdentity(
type="UserAssigned",
Expand Down Expand Up @@ -3991,7 +3986,9 @@ def _get_kubelet_config(file_path):
config_object.container_log_max_files = kubelet_config.get(
"containerLogMaxFiles", None)
config_object.container_log_max_size_mb = kubelet_config.get(
"containerLogMaxSizeMb", None)
"containerLogMaxSizeMB", None)
config_object.pod_max_pids = kubelet_config.get(
"podMaxPids", None)

return config_object

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
],
"failSwapOn": false,
"containerLogMaxFiles": 10,
"containerLogMaxSizeMb": 20
"podMaxPids": 120,
"containerLogMaxSizeMB": 20
}
Loading

0 comments on commit 03a376e

Please sign in to comment.