Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
46cfb9c
Merge pull request #2 from Azure/master
ShichaoQiu Jan 10, 2020
eb5faf3
Merge pull request #3 from Azure/master
ShichaoQiu Jan 13, 2020
0b3436d
Merge pull request #4 from Azure/master
ShichaoQiu Jan 16, 2020
2868847
Merge pull request #5 from Azure/master
ShichaoQiu Jan 19, 2020
745794f
Merge pull request #6 from Azure/master
ShichaoQiu Feb 12, 2020
c65198d
Merge pull request #7 from Azure/master
ShichaoQiu Feb 17, 2020
cbc7f19
Merge pull request #8 from Azure/master
ShichaoQiu May 29, 2020
b6dba29
Merge pull request #9 from Azure/master
ShichaoQiu Jun 15, 2020
3a14227
Merge pull request #10 from Azure/master
ShichaoQiu Jun 17, 2020
e54e7e0
Merge pull request #11 from Azure/master
ShichaoQiu Jul 8, 2020
ca85c84
Merge pull request #12 from Azure/master
ShichaoQiu Jul 27, 2020
c52a65a
Merge pull request #13 from Azure/master
ShichaoQiu Aug 7, 2020
1cc84da
vendor sdk
yuwzho Aug 11, 2020
1a27e3b
move validation to validator
yuwzho Aug 11, 2020
68ed696
instance count
yuwzho Aug 11, 2020
593351a
Merge pull request #14 from Azure/master
ShichaoQiu Aug 17, 2020
4317eca
Merge branch 'temp/yuwzho/ga-api-version' into yuwzho/ga-api-version
ShichaoQiu Aug 17, 2020
7216271
Merge pull request #16 from VSChina/yuwzho/ga-api-version
ShichaoQiu Aug 17, 2020
263af34
fix the merge errors
Aug 17, 2020
456d782
Merge pull request #17 from Azure/master
ShichaoQiu Aug 19, 2020
5ddc1ef
Merge pull request #18 from Azure/master
ShichaoQiu Aug 20, 2020
51cc05a
Merge branch 'master' into dev
Aug 20, 2020
ea41603
Distributed tracing support new api-version
Aug 25, 2020
db582a5
Merge pull request #19 from Azure/master
ShichaoQiu Aug 25, 2020
a6cd287
Merge remote-tracking branch 'remotes/origin/master' into dev
Aug 25, 2020
a7fb3cc
az spring-cloud config-server show
Aug 25, 2020
a65ce78
az spring-cloud config-server clear
Aug 25, 2020
891117a
az spring-cloud config-server set
Aug 25, 2020
2334598
az spring-cloud config-server git set
Aug 27, 2020
b5ac282
az spring-cloud config-server git repo add
Aug 27, 2020
6c4095b
az spring-cloud git repo remove
Aug 27, 2020
d4bb666
az spring-cloud config-server git repo update
Aug 27, 2020
013a37f
az spring-cloud config-server git repo list
Aug 27, 2020
2d3bd11
fix typo
Aug 27, 2020
0f730b6
fix code style errors
Aug 27, 2020
d1c1a52
fix instance count bug
Aug 28, 2020
ec405c4
fix bug
Aug 28, 2020
7a8ae44
fix bug https://dev.azure.com/msazure/AzureDMSS/_workitems/edit/8034116
Aug 28, 2020
613769f
add log
Aug 28, 2020
26bf454
fix sku bug
Aug 28, 2020
1bf3b25
Merge branch 'dev' of https://github.com/ShichaoQiu/azure-cli-extensi…
Aug 28, 2020
9898715
upgrade version to 2.0.0
Sep 2, 2020
14ee13b
make log clearly
Sep 3, 2020
211c561
add validate config server settings
ninpan-ms Sep 22, 2020
cf8411f
add log for long wait operation
ninpan-ms Sep 25, 2020
223d316
Merge pull request #20 from ninpan-ms/ninpan/validate
ShichaoQiu Sep 25, 2020
e1f1e46
refine wording
ninpan-ms Sep 27, 2020
d724a2d
precheck uri & modify error messages
ninpan-ms Oct 9, 2020
bc17edc
Merge pull request #21 from ninpan-ms/ninpan/validate
ShichaoQiu Oct 12, 2020
fb5771c
Merge pull request #22 from Azure/master
ShichaoQiu Oct 15, 2020
8d98d03
Merge remote-tracking branch 'remotes/origin/dev' into shiqiu/20200701GA
Oct 15, 2020
53fa122
fix style error
Oct 15, 2020
ef688c3
Merge pull request #24 from Azure/master
ShichaoQiu Nov 10, 2020
68f55ae
update validation and parameter description for smaller subnet feature
Nov 16, 2020
984f2be
update parameter description
Nov 16, 2020
913a35c
Merge pull request #25 from Azure/master
ShichaoQiu Nov 16, 2020
9a28bba
Merge remote-tracking branch 'remotes/origin/shiqiu/20200701GA'
Nov 16, 2020
7f1618b
refine the instance count parameter validation logic
Nov 18, 2020
7db3847
edit error message when creating vnet instance with a route table exi…
Nov 20, 2020
3c0fca4
Merge remote-tracking branch 'remotes/origin/shiqiu/20200701GA'
Nov 23, 2020
0c9f109
fix style error
Nov 23, 2020
82145f1
Update custom.py
yuwzho Nov 23, 2020
bb5de73
Merge pull request #26 from yuwzho/patch-1
ShichaoQiu Nov 26, 2020
411d9c0
Merge pull request #27 from ShichaoQiu/shiqiu/20200701GA
ShichaoQiu Nov 26, 2020
8c2a51c
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
ShichaoQiu Nov 26, 2020
bbbdd60
Merge pull request #29 from ShichaoQiu/Azure-master
ShichaoQiu Nov 26, 2020
b5f688d
fix integration test error
ShichaoQiu Dec 2, 2020
10498c2
fix comments
ShichaoQiu Dec 4, 2020
e0ff35f
refine tracing logic
ShichaoQiu Dec 7, 2020
1d10bcc
refine the tracing logic
ShichaoQiu Dec 7, 2020
b604d31
Merge pull request #30 from Azure/master
ShichaoQiu Dec 7, 2020
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/spring-cloud/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Release History
===============
2.0.0
-----
* Switch api-version from 2019-05-01-preview to 2020-07-01

1.2.0
-----
* Add support for sovereign cloud.
Expand Down
4 changes: 4 additions & 0 deletions src/spring-cloud/azext_spring_cloud/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def cf_bindings(cli_ctx, *_):
return cf_spring_cloud(cli_ctx).bindings


def cf_config_servers(cli_ctx, *_):
return cf_spring_cloud(cli_ctx).config_servers


def cf_certificates(cli_ctx, *_):
return cf_spring_cloud(cli_ctx).certificates

Expand Down
12 changes: 6 additions & 6 deletions src/spring-cloud/azext_spring_cloud/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
text: az spring-cloud create -n MyService -g MyResourceGroup -l westus --app-insights-key MyInstrumentationKey
- name: Create a new Azure Spring Cloud with distributed tracing disabled.
text: az spring-cloud create -n MyService -g MyResourceGroup --disable-distributed-tracing
- name: Create a new Azure Spring Cloud with VNet-inected via giving VNet name in current resource group
- name: Create a new Azure Spring Cloud with VNet-injected via giving VNet name in current resource group
text: az spring-cloud create -n MyService -g MyResourceGroup --vnet MyVNet --app-subnet MyAppSubnet --service-runtime-subnet MyServiceRuntimeSubnet
- name: Create a new Azure Spring Cloud with VNet-inected via giving subnets resource ID
- name: Create a new Azure Spring Cloud with VNet-injected via giving subnets resource ID
text: az spring-cloud create -n MyService -g MyResourceGroup --app-subnet /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyVnetRg/providers/Microsoft.Network/VirtualNetworks/test-vnet/subnets/app --service-runtime-subnet /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyVnetRg/providers/Microsoft.Network/VirtualNetworks/test-vnet/subnets/svc --reserved-cidr-range 10.0.0.0/16,10.1.0.0/16,10.2.0.1/16
"""

Expand Down Expand Up @@ -284,22 +284,22 @@

helps['spring-cloud config-server git repo add'] = """
type: command
short-summary: Set add a new repositry of git property of Config Server.
short-summary: Add a new repository of git property of Config Server.
"""

helps['spring-cloud config-server git repo remove'] = """
type: command
short-summary: Remove an existing repositry of git property of Config Server.
short-summary: Remove an existing repository of git property of Config Server.
"""

helps['spring-cloud config-server git repo update'] = """
type: command
short-summary: Override an existing repositry of git property of Config Server, will totally override the old one.
short-summary: Override an existing repository of git property of Config Server, will totally override the old one.
"""

helps['spring-cloud config-server git repo list'] = """
type: command
short-summary: List all repositries of git property of Config Server.
short-summary: List all repositories of git property of Config Server.
"""

helps['spring-cloud app binding'] = """
Expand Down
22 changes: 13 additions & 9 deletions src/spring-cloud/azext_spring_cloud/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
from ._validators import (validate_env, validate_cosmos_type, validate_resource_id, validate_location,
validate_name, validate_app_name, validate_deployment_name, validate_log_lines,
validate_log_limit, validate_log_since, validate_sku, validate_jvm_options,
validate_vnet, validate_vnet_required_parameters, validate_node_resource_group)
validate_vnet, validate_vnet_required_parameters, validate_node_resource_group,
validate_tracing_parameters, validate_instance_count)
from ._utils import ApiType

from .vendored_sdks.appplatform.models import RuntimeVersion, TestKeyType
Expand All @@ -36,7 +37,7 @@ def load_arguments(self, _):
c.argument('sku', type=str, validator=validate_sku, help='Name of SKU, the value is "Basic" or "Standard"')
c.argument('reserved_cidr_range', help='Comma-separated list of IP address ranges in CIDR format. The IP ranges are reserved to host underlying Azure Spring Cloud infrastructure, which should be 3 at least /16 unused IP ranges, must not overlap with any Subnet IP ranges.', validator=validate_vnet_required_parameters)
c.argument('vnet', help='The name or ID of an existing Virtual Network into which to deploy the Spring Cloud instance.', validator=validate_vnet_required_parameters)
c.argument('app_subnet', help='The name or ID of an existing subnet in "vnet" into which to deploy the Spring Cloud app. Required when deploying into a Virtual Network.', validator=validate_vnet_required_parameters)
c.argument('app_subnet', help='The name or ID of an existing subnet in "vnet" into which to deploy the Spring Cloud app. Required when deploying into a Virtual Network. Smaller subnet sizes are supported, please refer: https://aka.ms/azure-spring-cloud-smaller-subnet-vnet-docs', validator=validate_vnet_required_parameters)
c.argument('service_runtime_subnet', options_list=['--service-runtime-subnet', '--svc-subnet'], help='The name or ID of an existing subnet in "vnet" into which to deploy the Spring Cloud service runtime. Required when deploying into a Virtual Network.', validator=validate_vnet)
c.argument('service_runtime_network_resource_group', options_list=['--service-runtime-network-resource-group', '--svc-nrg'], help='The resource group where all network resources for Azure Spring Cloud service runtime will be created in.', validator=validate_node_resource_group)
c.argument('app_network_resource_group', options_list=['--app-network-resource-group', '--app-nrg'], help='The resource group where all network resources for apps will be created in.', validator=validate_node_resource_group)
Expand All @@ -47,12 +48,15 @@ def load_arguments(self, _):
for scope in ['spring-cloud create', 'spring-cloud update']:
with self.argument_context(scope) as c:
c.argument('app_insights_key',
help="Instrumentation key of the existing Application Insights to be added for the distributed tracing")
help="Instrumentation key of the existing Application Insights to be added for the distributed tracing",
validator=validate_tracing_parameters)
c.argument('app_insights',
help="Name of the existing Application Insights in the same Resource Group. Or Resource ID of the existing Application Insights in a different Resource Group.")
help="Name of the existing Application Insights in the same Resource Group. Or Resource ID of the existing Application Insights in a different Resource Group.",
validator=validate_tracing_parameters)
c.argument('disable_distributed_tracing',
arg_type=get_three_state_flag(),
help="Disable distributed tracing, if not disabled and no existing Application Insights specified with --app-insights-key or --app-insights, will create a new Application Insights instance in the same resource group.")
help="Disable distributed tracing, if not disabled and no existing Application Insights specified with --app-insights-key or --app-insights, will create a new Application Insights instance in the same resource group.",
validator=validate_tracing_parameters)
c.argument('tags', arg_type=tags_type)

with self.argument_context('spring-cloud test-endpoint renew-key') as c:
Expand All @@ -73,7 +77,7 @@ def load_arguments(self, _):
c.argument('memory', type=int, default=1,
help='Number of GB of memory per instance.')
c.argument('instance_count', type=int,
default=1, help='Number of instance.')
default=1, help='Number of instance.', validator=validate_instance_count)

with self.argument_context('spring-cloud app update') as c:
c.argument('is_public', arg_type=get_three_state_flag(), help='If true, assign endpoint')
Expand Down Expand Up @@ -124,7 +128,7 @@ def load_arguments(self, _):
with self.argument_context('spring-cloud app scale') as c:
c.argument('cpu', type=int, help='Number of virtual cpu cores per instance.')
c.argument('memory', type=int, help='Number of GB of memory per instance.')
c.argument('instance_count', type=int, help='Number of instance.')
c.argument('instance_count', type=int, help='Number of instance.', validator=validate_instance_count)

for scope in ['spring-cloud app deploy', 'spring-cloud app deployment create']:
with self.argument_context(scope) as c:
Expand All @@ -144,7 +148,7 @@ def load_arguments(self, _):
action='store_true')
c.argument('cpu', type=int, help='Number of virtual cpu cores per instance.')
c.argument('memory', type=int, help='Number of GB of memory per instance.')
c.argument('instance_count', type=int, help='Number of instance.')
c.argument('instance_count', type=int, help='Number of instance.', validator=validate_instance_count)

with self.argument_context('spring-cloud app deployment') as c:
c.argument('app', app_name_type, help='Name of app.',
Expand Down Expand Up @@ -207,7 +211,7 @@ def load_arguments(self, _):

for scope in ['spring-cloud config-server git repo add', 'spring-cloud config-server git repo update', 'spring-cloud config-server git repo remove']:
with self.argument_context(scope) as c:
c.argument('repo_name', help='Uri of the repo.')
c.argument('repo_name', help='Name of the repo.')

for scope in ['spring-cloud config-server git repo add', 'spring-cloud config-server git repo update']:
with self.argument_context(scope) as c:
Expand Down
4 changes: 2 additions & 2 deletions src/spring-cloud/azext_spring_cloud/_transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def transform_app_table_output(result):

if 'activeDeployment' in item['properties']:
isStarted = item['properties']['activeDeployment']['properties']['status'].upper() == "RUNNING"
instance_count = item['properties']['activeDeployment']['properties']['deploymentSettings']['instanceCount']
instance_count = item['properties']['activeDeployment']['sku']['capacity']
instances = item['properties']['activeDeployment']['properties']['instances']
if instances is None:
instances = []
Expand Down Expand Up @@ -61,7 +61,7 @@ def transform_spring_cloud_deployment_output(result):

for item in result:
isStarted = item['properties']['status'].upper() == "RUNNING"
instance_count = item['properties']['deploymentSettings']['instanceCount']
instance_count = item['sku']['capacity']
instances = item['properties']['instances']
if instances is None:
instances = []
Expand Down
19 changes: 17 additions & 2 deletions src/spring-cloud/azext_spring_cloud/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ def validate_sku(namespace):
raise CLIError("The pricing tier only accepts value [Basic, Standard]")


def validate_instance_count(namespace):
if namespace.instance_count is not None:
if namespace.instance_count < 1:
raise CLIError("--instance-count must be greater than 0")


def validate_name(namespace):
namespace.name = namespace.name.lower()
matchObj = match(r'^[a-z][a-z0-9-]{2,30}[a-z0-9]$', namespace.name)
Expand Down Expand Up @@ -145,6 +151,14 @@ def validate_jvm_options(namespace):
namespace.jvm_options = namespace.jvm_options.strip('\'')


def validate_tracing_parameters(namespace):
if (namespace.app_insights or namespace.app_insights_key) and namespace.disable_distributed_tracing:
raise CLIError("Conflict detected: '--app-insights' or '--app-insights-key'"
"can not be set with '--disable-distributed-tracing'.")
if namespace.app_insights and namespace.app_insights_key:
raise CLIError("Conflict detected: '--app-insights' and '--app-insights-key' can not be set at the same time.")


def validate_vnet(cmd, namespace):
if not namespace.vnet and not namespace.app_subnet and \
not namespace.service_runtime_subnet and not namespace.reserved_cidr_range:
Expand Down Expand Up @@ -206,14 +220,15 @@ def _validate_subnet(namespace, subnet):
limit = 32
if subnet.id.lower() == namespace.app_subnet.lower():
name = 'app-subnet'
limit = 24
limit = 28
elif subnet.id.lower() == namespace.service_runtime_subnet.lower():
name = 'service-runtime-subnet'
limit = 28
else:
return
if subnet.route_table:
raise CLIError('--{} should not associate with any route table.'.format(name))
raise CLIError('--{} with existing route table is not supported. Please remove route table from the subnet,'
' or select another subnet.'.format(name))
if subnet.ip_configurations:
raise CLIError('--{} should not have connected device.'.format(name))
address = ip_network(subnet.address_prefix, strict=False)
Expand Down
Loading