Skip to content
Open
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
4 changes: 4 additions & 0 deletions src/appservice-kube/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Release History
===============
1.0.0b1
++++++
* Remove unused compute SDK client factory and completers

0.1.11
++++++
* Remove msrestazure dependency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ def cf_plans(cli_ctx, *_):
return web_client_factory(cli_ctx).app_service_plans


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):
return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES,
subscription_id=subscription_id).resource_groups
49 changes: 0 additions & 49 deletions src/appservice-kube/azext_appservice_kube/_completers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,3 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core.decorators import Completer
from ._utils import _get_location_from_resource_group
from ._constants import KUBE_DEFAULT_SKU


@Completer
def get_vm_size_completion_list(cmd, prefix, namespace): # pylint: disable=unused-argument
"""Return the intersection of the VM sizes allowed by the ACS SDK with those returned by the Compute Service."""
from azure.mgmt.containerservice.models import ContainerServiceVMSizeTypes

location = _get_location(cmd.cli_ctx, namespace)
result = get_vm_sizes(cmd.cli_ctx, location)
return set(r.name for r in result) & set(c.value for c in ContainerServiceVMSizeTypes)


@Completer
def get_kube_sku_completion_list(cmd, prefix, namespace): # pylint: disable=unused-argument
"""
Return the VM sizes allowed by AKS, or 'ANY'
"""
return get_vm_size_completion_list(cmd, prefix, namespace) & set(KUBE_DEFAULT_SKU)


def get_vm_sizes(cli_ctx, location):
from ._client_factory import cf_compute_service
return cf_compute_service(cli_ctx).virtual_machine_sizes.list(location)


def _get_location(cli_ctx, namespace):
"""
Return an Azure location by using an explicit `--location` argument, then by `--resource-group`, and
finally by the subscription if neither argument was provided.
"""
from azure.core.exceptions import HttpResponseError
from azure.cli.core.commands.parameters import get_one_of_subscription_locations

location = None
if getattr(namespace, 'location', None):
location = namespace.location
elif getattr(namespace, 'resource_group_name', None):
try:
location = _get_location_from_resource_group(cli_ctx, namespace.resource_group_name)
except HttpResponseError as err:
from argcomplete import warn
warn(f'Warning: {err.message}')
if not location:
location = get_one_of_subscription_locations(cli_ctx)
return location
6 changes: 0 additions & 6 deletions src/appservice-kube/azext_appservice_kube/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,6 @@ def create_app_service_plan(cmd, resource_group_name, name, is_linux, hyper_v, p
tags, no_wait)


def get_vm_sizes(cli_ctx, location):
from ._client_factory import cf_compute_service

return cf_compute_service(cli_ctx).virtual_machine_sizes.list(location)


def _get_kube_env_from_custom_location(cmd, custom_location, resource_group):
kube_environment_id = ""
custom_location_name = custom_location
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def test_linux_webapp_quick_create_kube(self, resource_group):
self.cmd('webapp update -g {} -n {} --https-only true'.format(resource_group, webapp_name), checks=[JMESPathCheck("httpsOnly", True)])
self.cmd('webapp update -g {} -n {} --https-only false'.format(resource_group, webapp_name), checks=[JMESPathCheck("httpsOnly", False)])

@ResourceGroupPreparer(location="eastus")
@AllowLargeResponse()
@ResourceGroupPreparer(location="malaysiawest")
def test_win_webapp_quick_create_kube(self, resource_group):
webapp_name = self.create_random_name(prefix='webapp-quick', length=24)
plan = self.create_random_name(prefix='plan-quick', length=24)
Expand All @@ -46,13 +47,14 @@ def test_win_webapp_quick_create_kube(self, resource_group):
self.assertTrue(r['ftpPublishingUrl'].startswith('ftps://'))
self.cmd('webapp config appsettings list -g {} -n {}'.format(resource_group, webapp_name), checks=[
JMESPathCheck('[0].name', 'WEBSITE_NODE_DEFAULT_VERSION'),
JMESPathCheck('[0].value', '~16'),
JMESPathCheck('[0].value', '~20'),
])

self.cmd('webapp update -g {} -n {} --https-only true'.format(resource_group, webapp_name), checks=[JMESPathCheck("httpsOnly", True)])
self.cmd('webapp update -g {} -n {} --https-only false'.format(resource_group, webapp_name), checks=[JMESPathCheck("httpsOnly", False)])

@ResourceGroupPreparer(name_prefix="clitest", random_name_length=24, location="eastus")
@AllowLargeResponse()
@ResourceGroupPreparer(name_prefix="clitest", random_name_length=24, location="malaysiawest")
def test_win_webapp_quick_create_runtime_kube(self, resource_group):
webapp_name = self.create_random_name(prefix='webapp-quick', length=24)
webapp_name_2 = self.create_random_name(prefix='webapp-quick', length=24)
Expand All @@ -65,13 +67,14 @@ def test_win_webapp_quick_create_runtime_kube(self, resource_group):
JMESPathCheck('[0].name', 'WEBSITE_NODE_DEFAULT_VERSION'),
JMESPathCheck('[0].value', '~20'),
])
r = self.cmd('webapp create -g {} -n {} --plan {} --deployment-local-git -r "dotnet:7"'.format(
r = self.cmd('webapp create -g {} -n {} --plan {} --deployment-local-git -r "dotnet:8"'.format(
resource_group, webapp_name_2, plan)).get_output_in_json()
self.assertTrue(r['ftpPublishingUrl'].startswith('ftps://'))

self.cmd('webapp update -g {} -n {} --https-only true'.format(resource_group, webapp_name), checks=[JMESPathCheck("httpsOnly", True)])
self.cmd('webapp update -g {} -n {} --https-only false'.format(resource_group, webapp_name), checks=[JMESPathCheck("httpsOnly", False)])

@AllowLargeResponse()
@ResourceGroupPreparer(name_prefix="clitest", random_name_length=24, location="eastus")
def test_list_runtimes(self, resource_group):
r = self.cmd('webapp list-runtimes', checks=[JMESPathCheckExists("linux"), JMESPathCheckExists("windows"),
Expand Down
2 changes: 1 addition & 1 deletion src/appservice-kube/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# TODO: Confirm this is the right version number you want and it matches your
# HISTORY.rst entry.
VERSION = '0.1.11'
VERSION = '1.0.0b1'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down
Loading