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] Release v0.7.0 #3838

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
828f9d3
Create pull.yml
jonathan-innis Mar 10, 2021
1436bfc
Update pull.yml
jonathan-innis Mar 10, 2021
6cffd96
Update azure-pipelines.yml
jonathan-innis Mar 10, 2021
db0f4bd
Initial commit of k8s-extension
jonathan-innis Mar 10, 2021
3e2ea64
Update pipelines file
jonathan-innis Mar 10, 2021
9bbc0e4
Update CODEOWNERS
jonathan-innis Mar 10, 2021
8d46cbc
Update private preview pipelines
jonathan-innis Mar 11, 2021
6c3ba41
Remove open service mesh from public release
jonathan-innis Mar 11, 2021
a98e996
Merge pull request #6 from Azure/master
jonathan-innis Mar 11, 2021
43c6796
Update pipeline files
jonathan-innis Mar 11, 2021
009a83e
Update public extension pipeline
jonathan-innis Mar 12, 2021
8e058c5
Change condition variable
jonathan-innis Mar 12, 2021
dea40c1
Add version to public preview/private preview
jonathan-innis Mar 12, 2021
69269e0
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
jonathan-innis Mar 12, 2021
e81e010
Update pipelines
jonathan-innis Mar 12, 2021
9621a48
Add different testing based on private branch
jonathan-innis Mar 12, 2021
862a035
Add annotations to extension model
jonathan-innis Mar 12, 2021
e1c3d12
Update k8s-custom-pipelines.yml
jonathan-innis Mar 15, 2021
3e309bf
Update SDKs with Updated Swagger Spec for 2020-07-01-preview (#13)
jonathan-innis Mar 16, 2021
1df2ef5
remove py2 bdist support
jonathan-innis Mar 16, 2021
054a903
Add custom table formatting
jonathan-innis Mar 16, 2021
b298252
Remove unnecessary files
jonathan-innis Mar 16, 2021
afb4046
Fix style issues
jonathan-innis Mar 16, 2021
49b7eac
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
Mar 17, 2021
a13304d
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
Mar 17, 2021
aa078b0
Merge branch 'release' into k8s-extension/public
jonathan-innis Mar 17, 2021
21dff06
Fix branch based on comments
jonathan-innis Mar 17, 2021
93919f2
Update identity piece manually
jonathan-innis Mar 17, 2021
a88127a
Merge branch 'k8s-extension/public' of github.com:AzureArcForKubernet…
jonathan-innis Mar 17, 2021
7e40b3a
Don't handle defaults at the CLI level
jonathan-innis Mar 17, 2021
483202c
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
Mar 17, 2021
d1befa8
Remove defaults from CLI client
jonathan-innis Mar 17, 2021
c7bd93f
Merge branch 'release' into k8s-extension/public
jonathan-innis Mar 17, 2021
076827c
Check null target namespace with namespace scope
jonathan-innis Mar 17, 2021
550eea1
Update style
jonathan-innis Mar 17, 2021
1a17f1b
Merge branch 'k8s-extension/public' of github.com:AzureArcForKubernet…
jonathan-innis Mar 17, 2021
fbab3be
Add cassandra operator and location to model
jonathan-innis Mar 17, 2021
9aade9f
Stage Public Version of k8s-extension 0.2.0 for official release (#15)
jonathan-innis Mar 18, 2021
7f79cfb
Remove custom pipelines file
jonathan-innis Mar 18, 2021
1337996
Merge branch 'release' of https://github.com/AzureArcForKubernetes/az…
Mar 19, 2021
f6e68e9
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
Mar 20, 2021
f57af40
Merge branch 'release' of https://github.com/AzureArcForKubernetes/az…
Mar 20, 2021
e75f329
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
Mar 23, 2021
a47b63a
Merge branch 'release' of https://github.com/AzureArcForKubernetes/az…
Mar 23, 2021
6c4e0e6
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
Mar 24, 2021
bb88024
Merge branch 'release' of https://github.com/AzureArcForKubernetes/az…
Mar 24, 2021
9f06b49
Update extension description, remove private const
jonathan-innis Mar 24, 2021
a063594
Merge branch 'release' into k8s-extension/public
jonathan-innis Mar 24, 2021
eb4c58b
Update pipeline file
jonathan-innis Mar 24, 2021
20d809c
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
Mar 25, 2021
9524cda
Merge branch 'release' of https://github.com/AzureArcForKubernetes/az…
Mar 25, 2021
16489b8
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
Mar 26, 2021
ee395f2
Merge branch 'release' of https://github.com/AzureArcForKubernetes/az…
Mar 26, 2021
fbd331c
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
Mar 27, 2021
9c86220
Merge branch 'release' of https://github.com/AzureArcForKubernetes/az…
Mar 27, 2021
89828c5
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
Mar 31, 2021
bed066c
Merge branch 'release' of https://github.com/AzureArcForKubernetes/az…
Mar 31, 2021
8011213
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
Apr 1, 2021
491c1e5
Merge branch 'release' of https://github.com/AzureArcForKubernetes/az…
Apr 1, 2021
cfd267d
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
Apr 2, 2021
b9d1778
Merge branch 'release' of https://github.com/AzureArcForKubernetes/az…
Apr 2, 2021
3290f6e
Disable refs docs
jonathan-innis Apr 2, 2021
22c8e92
Update to include better create warning logs and remove update contex…
jonathan-innis Apr 2, 2021
12212f1
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
Apr 3, 2021
010e9a8
Merge branch 'release' of https://github.com/AzureArcForKubernetes/az…
Apr 3, 2021
6bbf418
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
Apr 11, 2021
df82dd8
Fix k8s-extension conflict with private version
jonathan-innis Apr 14, 2021
0228851
Fix style errors
jonathan-innis Apr 14, 2021
db4c5b2
Fix filename
jonathan-innis Apr 14, 2021
2971d69
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
Apr 18, 2021
5077192
add customization for microsoft.azureml.kubernetes (#23)
yuyue9284 Apr 23, 2021
dc0c178
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
Apr 25, 2021
3d15151
Add E2E Testing from Separate branch into internal code (#26)
jonathan-innis Apr 26, 2021
1ded405
Inference CLI validation for Scoring FE (#24)
liakaz Apr 27, 2021
53303d5
legal warning added (#27)
liakaz Apr 27, 2021
3370264
Remove deprecated method logger.warn
jonathan-innis Apr 27, 2021
4c66aef
Update k8s-custom-pipelines.yml for Azure Pipelines
jonathan-innis Apr 27, 2021
e8651f2
Update k8s-custom-pipelines.yml for Azure Pipelines
jonathan-innis Apr 27, 2021
9de1e4e
Add Azure Defender to E2E testing (#28)
jonathan-innis Apr 28, 2021
9c0317d
Add configuration testing
jonathan-innis Apr 28, 2021
4c21482
Fix pipeline failures
jonathan-innis Apr 28, 2021
3e2fb15
Make test script more intuitive
jonathan-innis Apr 29, 2021
4dca64d
Remove parameter from testing
jonathan-innis Apr 29, 2021
c93e958
Fix wrong location for k8s config whl
jonathan-innis Apr 29, 2021
27e9b4a
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
jonathan-innis May 3, 2021
cb30f9d
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
May 3, 2021
7276f4a
Merge branch 'k8s-extension/public' of github.com:AzureArcForKubernet…
jonathan-innis May 6, 2021
3dafc08
Fix pip upgrade issue
jonathan-innis May 6, 2021
c5bd1c2
Fix pip install upgrade issue
jonathan-innis May 6, 2021
d9e8760
Fix pip install issue
jonathan-innis May 6, 2021
9709504
delete resurce in testcase (#29)
yuyue9284 May 7, 2021
3f620a8
Check Provider is Registered with Subscription Before Making Requests…
jonathan-innis May 7, 2021
cf95612
only validate scoring fe when inference is enabled (#31)
yuyue9284 May 11, 2021
fea6e00
Provider registration case insensitive
jonathan-innis May 11, 2021
877868c
do not validate against scoring fe if inference is not enabled. (#33)
yuyue9284 May 13, 2021
7ea157b
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
jonathan-innis May 13, 2021
a50ade7
Merge branch 'k8s-extension/public' of github.com:AzureArcForKubernet…
jonathan-innis May 13, 2021
9b1bedd
Add OSM as Public Preview Extension (#34)
jonathan-innis May 13, 2021
257dbf3
Fix release train check in update
jonathan-innis May 14, 2021
a203575
Parallelize E2E Testing (#36)
jonathan-innis May 14, 2021
8d65189
Fix azureml deletion
jonathan-innis May 14, 2021
ec14c6d
Merge branch 'k8s-extension/public' of github.com:AzureArcForKubernet…
jonathan-innis May 14, 2021
918bc02
Fix private build (#40)
jonathan-innis May 21, 2021
8b2490d
change amlk8s to amlarc (#42)
yuyue9284 May 25, 2021
724acde
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
jonathan-innis May 27, 2021
9100ff5
Servicebus client model changes (#44)
jonathan-innis May 27, 2021
6955567
Read SSL cert and key from files (#38)
liakaz Jun 2, 2021
a46235b
Upgrade release version
jonathan-innis Jun 2, 2021
b0f25af
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
jonathan-innis Jun 2, 2021
2889d53
Liakaz/inference read ssl from file (#47)
liakaz Jun 3, 2021
67babd8
Fix style issues (#51)
jonathan-innis Jun 4, 2021
590e642
Fixed scoring fe related extension param names (#49)
liakaz Jun 8, 2021
fc661a8
Add distro validation for osm-arc (#50)
nshankar13 Jun 11, 2021
eb466aa
Add distro validation for osm-arc (#50)
nshankar13 Jun 11, 2021
b9b932a
Merge branch 'k8s-extension/public' of github.com:AzureArcForKubernet…
jonathan-innis Jun 11, 2021
b0af598
Add distro validation for osm-arc (#53)
nshankar13 Jun 15, 2021
c355ad5
Add Custom Delete Logic for Partners (#54)
jonathan-innis Jun 22, 2021
cda5e41
Add warning message when deleting amlarc extension (#55)
jingyizhu99 Jun 23, 2021
c423e54
Update release version
jonathan-innis Jun 24, 2021
0080c80
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
jonathan-innis Jun 24, 2021
58b4df8
Remove Pyhelm from OSM customization (#58)
jonathan-innis Jul 9, 2021
0b56023
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
jonathan-innis Jul 9, 2021
7712f52
Update release message
jonathan-innis Jul 9, 2021
4ca94bd
Remove pyhelm dependency
jonathan-innis Jul 9, 2021
de426d4
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
jonathan-innis Jul 9, 2021
0336667
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
jonathan-innis Jul 9, 2021
5bfabdb
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
jonathan-innis Jul 9, 2021
a5ef607
Update tests to only check extensionconfig creation (#61)
jonathan-innis Jul 9, 2021
79bb7b2
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
jonathan-innis Jul 19, 2021
fb8682a
Merge branch 'k8s-extension/public' of github.com:AzureArcForKubernet…
jonathan-innis Jul 19, 2021
d8528be
Increase open service mesh version number
jonathan-innis Jul 19, 2021
64ac05a
Update k8s-extension Models to Track2 (#64)
jonathan-innis Jul 20, 2021
a862b09
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
jonathan-innis Jul 20, 2021
bf15d99
Fix identity in wrong place in model (#66)
jonathan-innis Jul 23, 2021
65edba6
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
jonathan-innis Jul 23, 2021
bc48fdb
Readd osm-arc distro validation (#62)
nshankar13 Jul 27, 2021
ec40c30
Merge branch 'Azure:main' into k8s-extension/public
jonathan-innis Jul 27, 2021
611b81f
Don't Send Identity Headers If In DF (#67)
jonathan-innis Jul 27, 2021
a0431a6
Use default extension with identity instead of Cassandra specific (#69)
jonathan-innis Jul 28, 2021
6c271d5
Merge branch 'Azure:main' into k8s-extension/public
jonathan-innis Jul 28, 2021
a2a4050
Remove the identity check for now
jonathan-innis Jul 28, 2021
52d3fad
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
jonathan-innis Aug 11, 2021
30b407c
Add -t for clusterType parameter (#71)
jonathan-innis Aug 11, 2021
ac02d5a
Adding a flag for AKS to AMLARC migration and set up corresponding FE…
tianchijushi Aug 12, 2021
3a293ed
remove version requirement and auto upgrade minor version check (#72)
trstringer Aug 24, 2021
7deb020
Custom User Confirmation for Partners (#70)
jonathan-innis Aug 24, 2021
dd991f0
Code cleanup and style fixes (#73)
jonathan-innis Aug 27, 2021
01deb1e
Enabled identity by default (#74)
jonathan-innis Aug 27, 2021
8f9386c
Increase version
jonathan-innis Aug 30, 2021
03a376e
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
jonathan-innis Aug 30, 2021
9e37a9d
Remove testing files
jonathan-innis Aug 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/k8s-extension/HISTORY.rst
Expand Up @@ -3,6 +3,14 @@
Release History
===============

0.7.0
++++++++++++++++++
* Enable identity by default for extensions
* Use custom delete confirmation for partners
* microsoft.azureml.kubernetes: Adding a flag for AKS to AMLARC migration and set up corresponding FE helm values
* microsoft.openservicemesh: Remove version requirement and auto upgrade minor version check
* Adds -t as alternative to --cluster-type

0.6.1
++++++++++++++++++
* Remove sending identity for clusters in Dogfood
Expand Down
4 changes: 2 additions & 2 deletions src/k8s-extension/azext_k8s_extension/__init__.py
Expand Up @@ -17,8 +17,8 @@ def __init__(self, cli_ctx=None):
k8s_extension_custom = CliCommandType(
operations_tmpl=consts.EXTENSION_PACKAGE_NAME + '.custom#{}',
client_factory=cf_k8s_extension)
super(K8sExtensionCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=k8s_extension_custom)
super().__init__(cli_ctx=cli_ctx,
custom_command_type=k8s_extension_custom)

def load_command_table(self, args):
from .commands import load_command_table
Expand Down
40 changes: 31 additions & 9 deletions src/k8s-extension/azext_k8s_extension/_help.py
Expand Up @@ -10,25 +10,47 @@

helps[f'{consts.EXTENSION_NAME}'] = """
type: group
short-summary: Commands to manage K8s-extensions.
short-summary: Commands to manage Kubernetes Extensions.
"""

helps[f'{consts.EXTENSION_NAME} create'] = """
helps[f'{consts.EXTENSION_NAME} create'] = f"""
type: command
short-summary: Create a K8s-extension.
short-summary: Create a Kubernetes Extension.
examples:
- name: Create a Kubernetes Extension
text: |-
az {consts.EXTENSION_NAME} create --resource-group my-resource-group \\
--cluster-name mycluster --cluster-type connectedClusters \\
--name myextension --extension-type microsoft.openservicemesh \\
--scope cluster --release-train stable
"""

helps[f'{consts.EXTENSION_NAME} list'] = """
helps[f'{consts.EXTENSION_NAME} list'] = f"""
type: command
short-summary: List K8s-extensions.
short-summary: List Kubernetes Extensions.
examples:
- name: List all Kubernetes Extensions on a cluster
text: |-
az {consts.EXTENSION_NAME} list --resource-group my-resource-group \\
--cluster-name mycluster --cluster-type connectedClusters
"""

helps[f'{consts.EXTENSION_NAME} delete'] = """
helps[f'{consts.EXTENSION_NAME} delete'] = f"""
type: command
short-summary: Delete a K8s-extension.
short-summary: Delete a Kubernetes Extension.
examples:
- name: Delete an existing Kubernetes Extension
text: |-
az {consts.EXTENSION_NAME} delete --resource-group my-resource-group \\
--cluster-name mycluster --cluster-type connectedClusters --name myextension
"""

helps[f'{consts.EXTENSION_NAME} show'] = """
helps[f'{consts.EXTENSION_NAME} show'] = f"""
type: command
short-summary: Show details of a K8s-extension.
short-summary: Show a Kubernetes Extension.
examples:
- name: Show details of a Kubernetes Extension
text: |-
az {consts.EXTENSION_NAME} show --resource-group my-resource-group \\
--cluster-name mycluster --cluster-type connectedClusters --name myextension
"""
6 changes: 6 additions & 0 deletions src/k8s-extension/azext_k8s_extension/_params.py
Expand Up @@ -32,6 +32,7 @@ def load_arguments(self, _):
help='Name of the Kubernetes cluster')
c.argument('cluster_type',
arg_type=get_enum_type(['connectedClusters', 'managedClusters', 'appliances']),
options_list=['--cluster-type', '-t'],
help='Specify Arc clusters or AKS managed clusters or Arc appliances.')
c.argument('scope',
arg_type=get_enum_type(['cluster', 'namespace']),
Expand Down Expand Up @@ -73,3 +74,8 @@ def load_arguments(self, _):
c.argument('target_namespace',
help='Specify the target namespace to install to for the extension instance. This'
' parameter is required if extension scope is set to \'namespace\'')

with self.argument_context(f"{consts.EXTENSION_NAME} delete") as c:
c.argument('yes',
options_list=['--yes', '-y'],
help='Ignore confirmation prompts')
12 changes: 6 additions & 6 deletions src/k8s-extension/azext_k8s_extension/action.py
Expand Up @@ -16,10 +16,10 @@ def __call__(self, parser, namespace, values, option_string=None):
try:
key, value = item.split('=', 1)
settings[key] = value
except ValueError:
except ValueError as ex:
raise ArgumentUsageError('Usage error: {} configuration_setting_key=configuration_setting_value'.
format(option_string))
super(AddConfigurationSettings, self).__call__(parser, namespace, settings, option_string)
format(option_string)) from ex
super().__call__(parser, namespace, settings, option_string)


# pylint: disable=protected-access, too-few-public-methods
Expand All @@ -31,7 +31,7 @@ def __call__(self, parser, namespace, values, option_string=None):
try:
key, value = item.split('=', 1)
prot_settings[key] = value
except ValueError:
except ValueError as ex:
raise ArgumentUsageError('Usage error: {} configuration_protected_setting_key='
'configuration_protected_setting_value'.format(option_string))
super(AddConfigurationProtectedSettings, self).__call__(parser, namespace, prot_settings, option_string)
'configuration_protected_setting_value'.format(option_string)) from ex
super().__call__(parser, namespace, prot_settings, option_string)
2 changes: 1 addition & 1 deletion src/k8s-extension/azext_k8s_extension/commands.py
Expand Up @@ -20,6 +20,6 @@ def load_command_table(self, _):
is_preview=True) \
as g:
g.custom_command('create', 'create_k8s_extension')
g.custom_command('delete', 'delete_k8s_extension', confirmation=True)
g.custom_command('delete', 'delete_k8s_extension')
jonathan-innis marked this conversation as resolved.
Show resolved Hide resolved
g.custom_command('list', 'list_k8s_extension', table_transformer=k8s_extension_list_table_format)
g.custom_show_command('show', 'show_k8s_extension', table_transformer=k8s_extension_show_table_format)
34 changes: 15 additions & 19 deletions src/k8s-extension/azext_k8s_extension/custom.py
Expand Up @@ -17,7 +17,6 @@

from .partner_extensions.ContainerInsights import ContainerInsights
from .partner_extensions.AzureDefender import AzureDefender
from .partner_extensions.Cassandra import Cassandra
from .partner_extensions.AzureMLKubernetes import AzureMLKubernetes
from .partner_extensions.OpenServiceMesh import OpenServiceMesh
from .partner_extensions.DefaultExtension import DefaultExtension
Expand All @@ -35,7 +34,6 @@ def ExtensionFactory(extension_name):
'microsoft.azuredefender.kubernetes': AzureDefender,
'microsoft.openservicemesh': OpenServiceMesh,
'microsoft.azureml.kubernetes': AzureMLKubernetes,
'cassandradatacentersoperator': Cassandra,
}

# Return the extension if we find it in the map, else return the default
Expand Down Expand Up @@ -67,7 +65,8 @@ def show_k8s_extension(client, resource_group_name, cluster_name, name, cluster_
cluster_rp, cluster_type, cluster_name, name)
else:
message = ex.message
raise ResourceNotFoundError(message)
raise ResourceNotFoundError(message) from ex
raise ex


def create_k8s_extension(cmd, client, resource_group_name, cluster_name, name, cluster_type,
Expand Down Expand Up @@ -98,7 +97,7 @@ def create_k8s_extension(cmd, client, resource_group_name, cluster_name, name, c
config_protected_settings = {}
# Get Configuration Settings from file
if configuration_settings_file is not None:
config_settings = __get_config_settings_from_file(configuration_settings_file)
config_settings = __read_config_settings_file(configuration_settings_file)

if configuration_settings is not None:
for dicts in configuration_settings:
Expand All @@ -107,7 +106,7 @@ def create_k8s_extension(cmd, client, resource_group_name, cluster_name, name, c

# Get Configuration Protected Settings from file
if configuration_protected_settings_file is not None:
config_protected_settings = __get_config_settings_from_file(configuration_protected_settings_file)
config_protected_settings = __read_config_settings_file(configuration_protected_settings_file)

if configuration_protected_settings is not None:
for dicts in configuration_protected_settings:
Expand Down Expand Up @@ -191,7 +190,7 @@ def update_k8s_extension(client, resource_group_name, cluster_type, cluster_name
# return client.update(resource_group_name, cluster_rp, cluster_type, cluster_name, name, upd_extension)


def delete_k8s_extension(client, resource_group_name, cluster_name, name, cluster_type):
def delete_k8s_extension(cmd, client, resource_group_name, cluster_name, name, cluster_type, yes=False):
"""Delete an existing Kubernetes Extension.

"""
Expand All @@ -201,12 +200,12 @@ def delete_k8s_extension(client, resource_group_name, cluster_name, name, cluste
try:
extension = client.get(resource_group_name, cluster_rp, cluster_type, cluster_name, name)
except HttpResponseError:
logger.warning("No extension with name '%s' found on cluster '%s', so nothing to delete", cluster_name, name)
logger.warning("No extension with name '%s' found on cluster '%s', so nothing to delete", name, cluster_name)
return None
extension_class = ExtensionFactory(extension.extension_type.lower())

# If there is any custom delete logic, this will call the logic
extension_class.Delete(client, resource_group_name, cluster_name, name, cluster_type)
extension_class.Delete(cmd, client, resource_group_name, cluster_name, name, cluster_type, yes)

return client.delete(resource_group_name, cluster_rp, cluster_type, cluster_name, name)

Expand Down Expand Up @@ -281,18 +280,15 @@ def __validate_version_and_auto_upgrade(version, auto_upgrade_minor_version):
auto_upgrade_minor_version = False


def __get_config_settings_from_file(file_path):
def __read_config_settings_file(file_path):
try:
config_file = open(file_path,)
settings = json.load(config_file)
except ValueError:
raise Exception("File {} is not a valid JSON file".format(file_path))

files = len(settings)
if files == 0:
raise Exception("File {} is empty".format(file_path))

return settings
with open(file_path, 'r') as f:
settings = json.load(f)
if len(settings) == 0:
raise Exception("File {} is empty".format(file_path))
return settings
except ValueError as ex:
raise Exception("File {} is not a valid JSON file".format(file_path)) from ex


def __is_dogfood_cluster(cmd):
Expand Down
Expand Up @@ -8,17 +8,16 @@
from knack.log import get_logger

from ..vendored_sdks.models import ExtensionInstance
from ..vendored_sdks.models import ExtensionInstanceUpdate
from ..vendored_sdks.models import ScopeCluster
from ..vendored_sdks.models import Scope

from .PartnerExtensionModel import PartnerExtensionModel
from .DefaultExtension import DefaultExtension
from .ContainerInsights import _get_container_insights_settings

logger = get_logger(__name__)


class AzureDefender(PartnerExtensionModel):
class AzureDefender(DefaultExtension):
def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_type, extension_type,
scope, auto_upgrade_minor_version, release_train, version, target_namespace,
release_namespace, configuration_settings, configuration_protected_settings,
Expand Down Expand Up @@ -59,17 +58,3 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t
configuration_protected_settings=configuration_protected_settings
)
return extension_instance, name, create_identity

def Update(self, extension, auto_upgrade_minor_version, release_train, version):
"""ExtensionType 'microsoft.azuredefender.kubernetes' specific validations & defaults for Update
Must create and return a valid 'ExtensionInstanceUpdate' object.

"""
return ExtensionInstanceUpdate(
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
version=version
)

def Delete(self, client, resource_group_name, cluster_name, name, cluster_type):
pass
Expand Up @@ -10,6 +10,7 @@
import copy
from hashlib import md5
from typing import Any, Dict, List, Tuple
from azext_k8s_extension.partner_extensions.DefaultExtension import DefaultExtension

import azure.mgmt.relay
import azure.mgmt.relay.models
Expand All @@ -27,10 +28,9 @@
from msrestazure.azure_exceptions import CloudError

from .._client_factory import cf_resources
from .PartnerExtensionModel import PartnerExtensionModel
from .DefaultExtension import DefaultExtension, user_confirmation_factory
from ..vendored_sdks.models import (
ExtensionInstance,
ExtensionInstanceUpdate,
Scope,
ScopeCluster
)
Expand All @@ -41,7 +41,7 @@


# pylint: disable=too-many-instance-attributes
class AzureMLKubernetes(PartnerExtensionModel):
class AzureMLKubernetes(DefaultExtension):
def __init__(self):
# constants for configuration settings.
self.DEFAULT_RELEASE_NAMESPACE = 'azureml'
Expand Down Expand Up @@ -82,6 +82,9 @@ def __init__(self):
self.privateEndpointNodeport = 'privateEndpointNodeport'
self.inferenceLoadBalancerHA = 'inferenceLoadBalancerHA'

# constants for existing AKS to AMLARC migration
self.IS_AKS_MIGRATION = 'isAKSMigration'

# reference mapping
self.reference_mapping = {
self.RELAY_SERVER_CONNECTION_STRING: [self.RELAY_CONNECTION_STRING_KEY, self.RELAY_CONNECTION_STRING_DEPRECATED_KEY],
Expand Down Expand Up @@ -155,18 +158,12 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t
)
return extension_instance, name, create_identity

def Update(self, extension, auto_upgrade_minor_version, release_train, version):
return ExtensionInstanceUpdate(
auto_upgrade_minor_version=auto_upgrade_minor_version,
release_train=release_train,
version=version
)

def Delete(self, client, resource_group_name, cluster_name, name, cluster_type):
def Delete(self, cmd, client, resource_group_name, cluster_name, name, cluster_type, yes):
# Give a warning message
logger.warning("If nvidia.com/gpu or fuse resource is not recognized by kubernetes after this deletion, "
"you probably have installed nvidia-device-plugin or fuse-device-plugin before installing AMLArc extension. "
"Please try to reinstall device plugins to fix this issue.")
user_confirmation_factory(cmd, yes)

def __validate_config(self, configuration_settings, configuration_protected_settings):
# perform basic validation of the input config
Expand Down Expand Up @@ -211,6 +208,12 @@ def __validate_scoring_fe_settings(self, configuration_settings, configuration_p
configuration_settings['clusterPurpose'] = 'DevTest'
else:
configuration_settings['clusterPurpose'] = 'FastProd'
isAKSMigration = _get_value_from_config_protected_config(
self.IS_AKS_MIGRATION, configuration_settings, configuration_protected_settings)
isAKSMigration = str(isAKSMigration).lower() == 'true'
if isAKSMigration:
configuration_settings['scoringFe.namespace'] = "default"
configuration_settings[self.IS_AKS_MIGRATION] = "true"
feSslCertFile = configuration_protected_settings.get(self.sslCertPemFile)
feSslKeyFile = configuration_protected_settings.get(self.sslKeyPemFile)
allowInsecureConnections = _get_value_from_config_protected_config(
Expand Down

This file was deleted.