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

{AKS} Remove deprecated code #5021

Merged
merged 4 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
)
from knack.arguments import CLIArgumentType

from ._completers import (
from azext_aks_preview._completers import (
get_k8s_upgrades_completion_list,
get_k8s_versions_completion_list,
get_vm_size_completion_list,
)
from ._consts import (
from azext_aks_preview._consts import (
CONST_CREDENTIAL_FORMAT_AZURE,
CONST_CREDENTIAL_FORMAT_EXEC,
CONST_GPU_INSTANCE_PROFILE_MIG1_G,
Expand Down Expand Up @@ -69,7 +69,7 @@
CONST_AZURE_KEYVAULT_NETWORK_ACCESS_PUBLIC,
CONST_AZURE_KEYVAULT_NETWORK_ACCESS_PRIVATE,
)
from ._validators import (
from azext_aks_preview._validators import (
validate_acr,
validate_addon,
validate_addons,
Expand Down
10 changes: 6 additions & 4 deletions src/aks-preview/azext_aks_preview/_podidentity.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
from knack.log import get_logger
from knack.util import CLIError

from ._client_factory import get_auth_management_client
from ._consts import (CONST_MANAGED_IDENTITY_OPERATOR_ROLE,
CONST_MANAGED_IDENTITY_OPERATOR_ROLE_ID)
from ._roleassignments import add_role_assignment
from azext_aks_preview._client_factory import get_auth_management_client
from azext_aks_preview._consts import (
CONST_MANAGED_IDENTITY_OPERATOR_ROLE,
CONST_MANAGED_IDENTITY_OPERATOR_ROLE_ID,
)
from azext_aks_preview._roleassignments import add_role_assignment

logger = get_logger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion src/aks-preview/azext_aks_preview/_resourcegroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# --------------------------------------------------------------------------------------------

from knack.util import CLIError
from ._client_factory import cf_resource_groups
from azext_aks_preview._client_factory import cf_resource_groups


def get_rg_location(ctx, resource_group_name, subscription_id=None):
Expand Down
2 changes: 1 addition & 1 deletion src/aks-preview/azext_aks_preview/_roleassignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from knack.log import get_logger
from knack.util import CLIError
from msrestazure.azure_exceptions import CloudError
from ._client_factory import get_auth_management_client, get_graph_rbac_management_client
from azext_aks_preview._client_factory import get_auth_management_client, get_graph_rbac_management_client

logger = get_logger(__name__)

Expand Down
23 changes: 11 additions & 12 deletions src/aks-preview/azext_aks_preview/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,25 @@
# --------------------------------------------------------------------------------------------

from __future__ import unicode_literals

import os
import os.path
import re
from math import isnan, isclose
from ipaddress import ip_network
from math import isclose, isnan

from knack.log import get_logger

from azure.cli.core.azclierror import InvalidArgumentValueError, ArgumentUsageError, RequiredArgumentMissingError
import azure.cli.core.keys as keys
from azure.cli.core.azclierror import (
ArgumentUsageError,
InvalidArgumentValueError,
RequiredArgumentMissingError,
)
from azure.cli.core.commands.validators import validate_tag
from azure.cli.core.util import CLIError
import azure.cli.core.keys as keys

from ._helpers import (_fuzzy_match)
from knack.log import get_logger

from ._consts import (
ADDONS,
CONST_AZURE_KEYVAULT_NETWORK_ACCESS_PUBLIC,
CONST_AZURE_KEYVAULT_NETWORK_ACCESS_PRIVATE,
)
from azext_aks_preview._consts import ADDONS
from azext_aks_preview._helpers import _fuzzy_match

logger = get_logger(__name__)

Expand Down
34 changes: 24 additions & 10 deletions src/aks-preview/azext_aks_preview/addonconfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,30 @@
from azure.cli.core.commands.client_factory import get_subscription_id
from azure.cli.core.util import sdk_no_wait
from azext_aks_preview._client_factory import CUSTOM_MGMT_AKS_PREVIEW
from ._client_factory import cf_resources, cf_resource_groups
from ._resourcegroup import get_rg_location
from ._roleassignments import add_role_assignment
from ._consts import ADDONS, CONST_VIRTUAL_NODE_ADDON_NAME, CONST_MONITORING_ADDON_NAME, \
CONST_MONITORING_LOG_ANALYTICS_WORKSPACE_RESOURCE_ID, CONST_MONITORING_USING_AAD_MSI_AUTH, \
CONST_VIRTUAL_NODE_SUBNET_NAME, CONST_INGRESS_APPGW_ADDON_NAME, CONST_INGRESS_APPGW_APPLICATION_GATEWAY_NAME, \
CONST_INGRESS_APPGW_SUBNET_CIDR, CONST_INGRESS_APPGW_APPLICATION_GATEWAY_ID, CONST_INGRESS_APPGW_SUBNET_ID, \
CONST_INGRESS_APPGW_WATCH_NAMESPACE, CONST_OPEN_SERVICE_MESH_ADDON_NAME, CONST_CONFCOM_ADDON_NAME, \
CONST_ACC_SGX_QUOTE_HELPER_ENABLED, CONST_AZURE_KEYVAULT_SECRETS_PROVIDER_ADDON_NAME, CONST_SECRET_ROTATION_ENABLED, CONST_ROTATION_POLL_INTERVAL, \
CONST_KUBE_DASHBOARD_ADDON_NAME
from azext_aks_preview._client_factory import cf_resources, cf_resource_groups
from azext_aks_preview._resourcegroup import get_rg_location
from azext_aks_preview._roleassignments import add_role_assignment
from azext_aks_preview._consts import (
ADDONS,
CONST_VIRTUAL_NODE_ADDON_NAME,
CONST_MONITORING_ADDON_NAME,
CONST_MONITORING_LOG_ANALYTICS_WORKSPACE_RESOURCE_ID,
CONST_MONITORING_USING_AAD_MSI_AUTH,
CONST_VIRTUAL_NODE_SUBNET_NAME,
CONST_INGRESS_APPGW_ADDON_NAME,
CONST_INGRESS_APPGW_APPLICATION_GATEWAY_NAME,
CONST_INGRESS_APPGW_SUBNET_CIDR,
CONST_INGRESS_APPGW_APPLICATION_GATEWAY_ID,
CONST_INGRESS_APPGW_SUBNET_ID,
CONST_INGRESS_APPGW_WATCH_NAMESPACE,
CONST_OPEN_SERVICE_MESH_ADDON_NAME,
CONST_CONFCOM_ADDON_NAME,
CONST_ACC_SGX_QUOTE_HELPER_ENABLED,
CONST_AZURE_KEYVAULT_SECRETS_PROVIDER_ADDON_NAME,
CONST_SECRET_ROTATION_ENABLED,
CONST_ROTATION_POLL_INTERVAL,
CONST_KUBE_DASHBOARD_ADDON_NAME,
)
from .vendored_sdks.azure_mgmt_preview_aks.v2022_05_02_preview.models import (
ManagedClusterIngressProfile,
ManagedClusterIngressProfileWebAppRouting,
Expand Down
1 change: 0 additions & 1 deletion src/aks-preview/azext_aks_preview/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from ._format import aks_addon_list_available_table_format, aks_addon_list_table_format, aks_addon_show_table_format
from ._format import aks_agentpool_show_table_format
from ._format import aks_agentpool_list_table_format
from ._format import aks_versions_table_format
from ._format import aks_upgrades_table_format
from ._format import aks_pod_identities_table_format
from ._format import aks_pod_identity_exceptions_table_format
Expand Down
27 changes: 10 additions & 17 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,7 @@
)

from .vendored_sdks.azure_mgmt_preview_aks.v2022_05_02_preview.models import (
AgentPool,
AgentPoolUpgradeSettings,
ContainerServiceStorageProfileTypes,
CreationData,
KubeletConfig,
LinuxOSConfig,
Expand Down Expand Up @@ -2388,10 +2386,9 @@ def aks_pod_identity_add(cmd, client, resource_group_name, cluster_name,
pod_identity.binding_selector = binding_selector
pod_identities.append(pod_identity)

from azext_aks_preview.decorator import AKSPreviewModels

from azext_aks_preview.managed_cluster_decorator import AKSPreviewManagedClusterModels
# store all the models used by pod identity
pod_identity_models = AKSPreviewModels(
pod_identity_models = AKSPreviewManagedClusterModels(
cmd, CUSTOM_MGMT_AKS_PREVIEW).pod_identity_models
_update_addon_pod_identity(
instance, enable=True,
Expand All @@ -2418,10 +2415,9 @@ def aks_pod_identity_delete(cmd, client, resource_group_name, cluster_name,
continue
pod_identities.append(pod_identity)

from azext_aks_preview.decorator import AKSPreviewModels

from azext_aks_preview.managed_cluster_decorator import AKSPreviewManagedClusterModels
# store all the models used by pod identity
pod_identity_models = AKSPreviewModels(
pod_identity_models = AKSPreviewManagedClusterModels(
cmd, CUSTOM_MGMT_AKS_PREVIEW).pod_identity_models
_update_addon_pod_identity(
instance, enable=True,
Expand Down Expand Up @@ -2451,10 +2447,9 @@ def aks_pod_identity_exception_add(cmd, client, resource_group_name, cluster_nam
name=exc_name, namespace=exc_namespace, pod_labels=pod_labels)
pod_identity_exceptions.append(exc)

from azext_aks_preview.decorator import AKSPreviewModels

from azext_aks_preview.managed_cluster_decorator import AKSPreviewManagedClusterModels
# store all the models used by pod identity
pod_identity_models = AKSPreviewModels(
pod_identity_models = AKSPreviewManagedClusterModels(
cmd, CUSTOM_MGMT_AKS_PREVIEW).pod_identity_models
_update_addon_pod_identity(
instance, enable=True,
Expand All @@ -2480,10 +2475,9 @@ def aks_pod_identity_exception_delete(cmd, client, resource_group_name, cluster_
continue
pod_identity_exceptions.append(exc)

from azext_aks_preview.decorator import AKSPreviewModels

from azext_aks_preview.managed_cluster_decorator import AKSPreviewManagedClusterModels
# store all the models used by pod identity
pod_identity_models = AKSPreviewModels(
pod_identity_models = AKSPreviewManagedClusterModels(
cmd, CUSTOM_MGMT_AKS_PREVIEW).pod_identity_models
_update_addon_pod_identity(
instance, enable=True,
Expand Down Expand Up @@ -2517,10 +2511,9 @@ def aks_pod_identity_exception_update(cmd, client, resource_group_name, cluster_
raise CLIError(
'pod identity exception {}/{} not found'.format(exc_namespace, exc_name))

from azext_aks_preview.decorator import AKSPreviewModels

from azext_aks_preview.managed_cluster_decorator import AKSPreviewManagedClusterModels
# store all the models used by pod identity
pod_identity_models = AKSPreviewModels(
pod_identity_models = AKSPreviewManagedClusterModels(
cmd, CUSTOM_MGMT_AKS_PREVIEW).pod_identity_models
_update_addon_pod_identity(
instance, enable=True,
Expand Down
Loading