Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
b529fd0
init commit for spring migration start command
ninpan-ms Jan 10, 2025
88e1da5
add method to export arm template of asa
guitarsheng Jan 12, 2025
efaacf0
Merge pull request #3 from guitarsheng/ninpan/bicep
ninpan-ms Jan 13, 2025
3529106
Add param file
ninpan-ms Jan 13, 2025
006681b
Merge pull request #4 from ninpan-ms/ninpan/param
ninpan-ms Jan 14, 2025
c40ed7e
add options param
guitarsheng Jan 16, 2025
ed21f21
refactor
guitarsheng Jan 18, 2025
2e5a05e
refactor
guitarsheng Jan 18, 2025
6cd8e63
refactor
guitarsheng Jan 20, 2025
164739b
Merge pull request #5 from guitarsheng/ninpan/bicep
ninpan-ms Jan 20, 2025
4b3f760
Support multiple app modules & refactor conversion
ninpan-ms Jan 20, 2025
1087cbf
add ParamConverter and AppConverter && rename readme template
guitarsheng Jan 20, 2025
85d6166
create container apps env successfully
guitarsheng Jan 20, 2025
5e348c1
align the locaton value in bicep file
guitarsheng Jan 20, 2025
2cb9c4e
Merge pull request #6 from ninpan-ms/ninpan/app-modules
ninpan-ms Jan 21, 2025
7e71dfa
Merge pull request #7 from guitarsheng/ninpan/app-modules
ninpan-ms Jan 21, 2025
57cdf67
Merge pull request #8 from ninpan-ms/ninpan/app-modules
ninpan-ms Jan 21, 2025
da5f2c9
Merge branch 'Azure:main' into ninpan/bicep
guitarsheng Jan 21, 2025
8a6a6a0
Support gateway bicep
ninpan-ms Jan 24, 2025
fdf9805
Merge pull request #9 from ninpan-ms/ninpan/gateway
ninpan-ms Jan 26, 2025
5295f85
Support managed components bicep
ninpan-ms Feb 7, 2025
baf189b
Merge branch 'Azure:main' into ninpan/bicep
guitarsheng Feb 10, 2025
14a203a
Add maintenance window
ninpan-ms Feb 10, 2025
4390033
Merge pull request #10 from ninpan-ms/ninpan/env
ninpan-ms Feb 10, 2025
6f9f9b2
Add app bind
ninpan-ms Feb 12, 2025
4f7cba3
Merge pull request #11 from ninpan-ms/ninpan/app-bind
ninpan-ms Feb 12, 2025
e4b5588
npe
ninpan-ms Feb 13, 2025
81fc28a
app bind
ninpan-ms Feb 13, 2025
6bba3bd
Add key vault cert migration
ninpan-ms Feb 18, 2025
d56a62f
Merge pull request #12 from ninpan-ms/ninpan/kvcert
ninpan-ms Feb 18, 2025
90df2c8
convert deployment logic
guitarsheng Feb 19, 2025
7408d36
Merge branch 'ninpan/bicep' of https://github.com/ninpan-ms/azure-cli…
guitarsheng Feb 19, 2025
dd7507a
Merge pull request #13 from guitarsheng/guitar/bicep
ninpan-ms Feb 19, 2025
9c0604a
adjust log as azure monitor
ninpan-ms Feb 19, 2025
18b9d61
disable service bniding
guitarsheng Feb 19, 2025
e0adea1
Merge pull request #14 from ninpan-ms/ninpan/monitor
ninpan-ms Feb 19, 2025
2362606
ingress
guitarsheng Feb 19, 2025
c90c4da
scale
guitarsheng Feb 19, 2025
b140256
vnet support
ninpan-ms Feb 20, 2025
112a469
Merge pull request #15 from ninpan-ms/ninpan/vnet
ninpan-ms Feb 20, 2025
adbb7ad
identity
guitarsheng Feb 21, 2025
e0655db
rollback
guitarsheng Feb 21, 2025
aab05dc
Merge branch 'ninpan/bicep' of https://github.com/ninpan-ms/azure-cli…
guitarsheng Feb 21, 2025
b8a2063
fix issue
guitarsheng Feb 21, 2025
377ceef
add targetPort to param
guitarsheng Feb 22, 2025
a90e6b3
add identity to aca environment
guitarsheng Feb 22, 2025
59a199e
Merge pull request #16 from guitarsheng/guitar/bicep
guitarsheng Feb 22, 2025
710c874
add app workloadprofiletype
ninpan-ms Feb 24, 2025
f659136
Merge pull request #17 from ninpan-ms/ninpan/app-type
ninpan-ms Feb 24, 2025
449e60b
Config server/ACS secrets parameterize
ninpan-ms Feb 24, 2025
b34b05a
Merge pull request #18 from ninpan-ms/ninpan/managed-secret
ninpan-ms Feb 24, 2025
fe64a08
add startupprobe and refactor env
guitarsheng Feb 24, 2025
3d8b2f0
remove blank line from main.bicep
guitarsheng Feb 24, 2025
1d42d87
Merge pull request #19 from guitarsheng/guitar/bicep
ninpan-ms Feb 24, 2025
714cc43
Remove empty line
ninpan-ms Feb 25, 2025
3a45536
Merge pull request #20 from ninpan-ms/ninpan/format
ninpan-ms Feb 25, 2025
516caf5
Refine readme
ninpan-ms Feb 27, 2025
5badc32
Merge pull request #21 from ninpan-ms/ninpan/readme
ninpan-ms Feb 27, 2025
58c9560
gateway issue: route id not unique
ninpan-ms Feb 27, 2025
d52c455
Merge pull request #22 from ninpan-ms/ninpan/scg-route
ninpan-ms Feb 27, 2025
519fe95
ext build issues
ninpan-ms Mar 2, 2025
c92ea76
Merge pull request #23 from ninpan-ms/ninpan/buildissue
ninpan-ms Mar 2, 2025
9d2d0e2
Add dependency jinja2
ninpan-ms Mar 3, 2025
34dc903
Merge pull request #24 from ninpan-ms/ninpan/dependence
ninpan-ms Mar 3, 2025
915a871
add message guide in readme
guitarsheng Mar 3, 2025
cff7a9d
Merge pull request #25 from guitarsheng/guitar/bicep
guitarsheng Mar 3, 2025
884488f
format
ninpan-ms Mar 3, 2025
6b241ad
byos migration
guitarsheng Mar 3, 2025
1a7727f
Merge branch 'ninpan/bicep' into guitar/bicep
guitarsheng Mar 4, 2025
ae5524b
Merge pull request #26 from guitarsheng/guitar/bicep
guitarsheng Mar 4, 2025
f6612eb
Merge branch 'ninpan/bicep' of github.com:ninpan-ms/azure-cli-extensi…
ninpan-ms Mar 4, 2025
325e423
fix byos duplicate name issue
guitarsheng Mar 4, 2025
4b7e916
Merge pull request #27 from guitarsheng/guitar/bicep
guitarsheng Mar 4, 2025
fa8fe84
Merge branch 'ninpan/bicep' of github.com:ninpan-ms/azure-cli-extensi…
ninpan-ms Mar 5, 2025
084f952
format
ninpan-ms Mar 3, 2025
ca30843
refactor, configserver, acs and app
guitarsheng Mar 5, 2025
aa03ba4
refactor env
guitarsheng Mar 5, 2025
1a62e63
refactor gateway
guitarsheng Mar 5, 2025
b3c8dfb
refactor live-view
guitarsheng Mar 5, 2025
581664f
refactor eureka
guitarsheng Mar 5, 2025
44b00ad
refactor param
guitarsheng Mar 5, 2025
a14cd10
refactor main and readme
guitarsheng Mar 5, 2025
bcf386c
refactor cert
guitarsheng Mar 5, 2025
d16e083
refactor extract_data method
guitarsheng Mar 5, 2025
14db9ba
remove useless params field
guitarsheng Mar 5, 2025
216f59f
refactor eureka
guitarsheng Mar 5, 2025
fd970c0
remove useless fields
guitarsheng Mar 5, 2025
9213955
refactor
guitarsheng Mar 5, 2025
2a4f60a
Merge pull request #28 from guitarsheng/guitar/bicep
guitarsheng Mar 5, 2025
f75b9b7
command change
ninpan-ms Mar 6, 2025
a2ad3ee
Merge branch 'ninpan/bicep' of github.com:ninpan-ms/azure-cli-extensi…
ninpan-ms Mar 6, 2025
94691e5
rename param to avoid new concept
guitarsheng Mar 6, 2025
152f81e
Merge branch 'ninpan/bicep' into ninpan/command
guitarsheng Mar 6, 2025
f057129
Merge pull request #29 from ninpan-ms/ninpan/command
guitarsheng Mar 6, 2025
437c640
refactor run_converters
guitarsheng Mar 6, 2025
e40e6a2
Merge branch 'ninpan/bicep' of https://github.com/ninpan-ms/azure-cli…
guitarsheng Mar 6, 2025
c0b9ffe
refactor more
guitarsheng Mar 6, 2025
6132d20
Merge pull request #30 from guitarsheng/guitar/bicep
guitarsheng Mar 6, 2025
9fddace
refactor _get_storage_unique_name method
guitarsheng Mar 7, 2025
5d2e527
extra method _get_storage_name
guitarsheng Mar 7, 2025
0bdac07
extra _get_account_name method
guitarsheng Mar 7, 2025
74c9914
extra get_mount_options method
guitarsheng Mar 7, 2025
7895a58
introduce BaseConverter class
guitarsheng Mar 7, 2025
ae8e16a
rename param variable start with "param"
guitarsheng Mar 7, 2025
0b5b298
extra method for get param name
guitarsheng Mar 7, 2025
9005b96
rename method
guitarsheng Mar 7, 2025
73e1a72
add else for cors case
guitarsheng Mar 7, 2025
989ad15
refactor storage
guitarsheng Mar 7, 2025
09ff5f3
extra method _get_resource_name_of_storage
guitarsheng Mar 7, 2025
1bd67f0
extra method for get module name
guitarsheng Mar 7, 2025
28c2158
extra method for get resource name
guitarsheng Mar 7, 2025
5ed15f8
Merge pull request #31 from guitarsheng/guitar/bicep
guitarsheng Mar 7, 2025
7389ae9
fix blue green deployment issue
guitarsheng Mar 7, 2025
7cdabac
Merge pull request #32 from guitarsheng/guitar/bicep
guitarsheng Mar 7, 2025
1b81542
Merge branch 'ninpan/bicep' of github.com:ninpan-ms/azure-cli-extensi…
ninpan-ms Mar 9, 2025
4227f58
lint check
ninpan-ms Mar 9, 2025
825e42b
Merge pull request #33 from ninpan-ms/ninpan/lint
ninpan-ms Mar 9, 2025
c8d0bfd
lint check
ninpan-ms Mar 10, 2025
1e8b967
Merge pull request #34 from ninpan-ms/ninpan/lint
ninpan-ms Mar 10, 2025
6af65aa
add integration test for asa export command for aca migration
guitarsheng Mar 10, 2025
7162c68
Merge pull request #35 from guitarsheng/guitar/bicep
guitarsheng Mar 11, 2025
a6827b5
fix typo
guitarsheng Mar 11, 2025
ea32e28
refactor _get_service_bind method
guitarsheng Mar 11, 2025
0b3514d
add depends on list
guitarsheng Mar 11, 2025
48fccf5
Merge pull request #36 from guitarsheng/guitar/bicep
guitarsheng Mar 11, 2025
a35c45c
readme dynamically
ninpan-ms Mar 11, 2025
effd32a
Merge pull request #37 from ninpan-ms/ninpan/domains
ninpan-ms Mar 11, 2025
c5e94e6
fix [0] Array out of bounds issue
guitarsheng Mar 11, 2025
f04bd90
check data
guitarsheng Mar 11, 2025
adba893
move skip logic into converters
guitarsheng Mar 11, 2025
22c0f05
refactor run_converters method
guitarsheng Mar 11, 2025
7d302d9
Merge pull request #38 from guitarsheng/guitar/bicep
guitarsheng Mar 11, 2025
959fbfa
fix README.j2 No such file error
guitarsheng Mar 11, 2025
13d5af4
refine
ninpan-ms Mar 11, 2025
f4b5a59
Merge pull request #39 from ninpan-ms/ninpan/domains
ninpan-ms Mar 11, 2025
80a1f0a
Merge branch 'ninpan/bicep' of https://github.com/ninpan-ms/azure-cli…
guitarsheng Mar 11, 2025
b5230cb
create converter class when needed
guitarsheng Mar 11, 2025
195dd97
Merge pull request #40 from guitarsheng/guitar/bicep
guitarsheng Mar 11, 2025
fbb1081
refine
ninpan-ms Mar 11, 2025
318f087
Merge pull request #41 from ninpan-ms/ninpan/domains
ninpan-ms Mar 11, 2025
7cbf810
Update src/spring/azext_spring/migration/converter/environment_conver…
ninpan-ms Mar 11, 2025
01ea0b6
Update src/spring/azext_spring/migration/converter/acs_converter.py
ninpan-ms Mar 11, 2025
b96ebe1
Update src/spring/azext_spring/_params.py
ninpan-ms Mar 12, 2025
6876c55
put autoscale part as static in readme
guitarsheng Mar 12, 2025
09d7b9c
fullfill readme to dynamicly generate content for managed identity part
guitarsheng Mar 12, 2025
06b9c10
Merge pull request #42 from guitarsheng/guitar/bicep
guitarsheng Mar 12, 2025
12e850a
Add mismatch messages
ninpan-ms Mar 13, 2025
94c65ae
default
ninpan-ms Mar 13, 2025
b4dee67
action
ninpan-ms Mar 13, 2025
c069364
Merge pull request #43 from ninpan-ms/ninpan/mismatch
ninpan-ms Mar 13, 2025
f4533ec
style
ninpan-ms Mar 13, 2025
f46bcc1
Merge pull request #44 from ninpan-ms/ninpan/mismatch
ninpan-ms Mar 13, 2025
9da6817
byoc support
guitarsheng Mar 17, 2025
c828378
fix comment
guitarsheng Mar 17, 2025
e8fee2d
Merge pull request #45 from guitarsheng/guitar/bicep
guitarsheng Mar 17, 2025
c5186ed
Merge branch 'ninpan/bicep' of https://github.com/ninpan-ms/azure-cli…
guitarsheng Mar 17, 2025
728c267
refine readme
ninpan-ms Mar 17, 2025
259964a
Merge pull request #46 from ninpan-ms/ninpan/readme-refine
ninpan-ms Mar 17, 2025
8c83675
Merge branch 'ninpan/bicep' of https://github.com/ninpan-ms/azure-cli…
guitarsheng Mar 18, 2025
ac56595
change readme
guitarsheng Mar 18, 2025
144a05e
Merge pull request #47 from guitarsheng/guitar/bicep
guitarsheng Mar 18, 2025
bf00d4c
fix issue
guitarsheng Mar 19, 2025
25c7b9d
for GRPC transport issue
guitarsheng Mar 20, 2025
5ab94c9
skip export content type cert
guitarsheng Mar 20, 2025
24950ec
Merge pull request #48 from guitarsheng/guitar/bicep
guitarsheng Mar 20, 2025
bdaa388
refine readme
ninpan-ms Mar 25, 2025
0df0d27
update version
ninpan-ms Mar 25, 2025
cec1060
update
ninpan-ms Mar 26, 2025
7e2f6ab
Merge pull request #49 from ninpan-ms/ninpan/readme-refine
ninpan-ms Mar 26, 2025
3529d09
fix byoc public repo bug
guitarsheng Mar 26, 2025
c49536a
Merge pull request #50 from guitarsheng/guitar/bicep
guitarsheng Mar 26, 2025
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
8 changes: 8 additions & 0 deletions src/spring/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
Release History
===============
1.27.1
---
* Support scenario of bringing your own container image for command `az spring export`.

1.27.0
---
* Add command `az spring export` which is used to generate target resources definitions to help customer migrating from Azure Spring Apps to other Azure services, such as Azure Container Apps.

1.26.1
---
* Fix command `az spring app update`, so that it can detect update failure and return error message.
Expand Down
8 changes: 8 additions & 0 deletions src/spring/azext_spring/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -1809,3 +1809,11 @@
- name: Clean up private DNS zone with Azure Spring Apps.
text: az spring private-dns-zone clean --service MyAzureSpringAppsInstance --resource-group MyResourceGroup
"""

helps['spring export'] = """
type: command
short-summary: Commands to export target Azure resource definitions from Azure Spring Apps.
examples:
- name: Generate corresponding bicep files and README doc to create Azure Container Apps service.
text: az spring export --target aca --service MyAzureSpringAppsInstance --resource-group MyResourceGroup --output-folder output
"""
5 changes: 5 additions & 0 deletions src/spring/azext_spring/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -1307,3 +1307,8 @@ def prepare_common_logs_argument(c):
c.argument('zone_id', help='The resource id of the private DNS zone which you would like to configure with the service instance.')
with self.argument_context('spring private-dns-zone clean') as c:
c.argument('service', service_name_type)

with self.argument_context('spring export') as c:
c.argument('service', service_name_type)
c.argument('target', arg_type=get_enum_type(["aca", "azure-container-apps"]), help='The target Azure service to migrate to.')
c.argument('output_folder', help='The output folder for the generated Bicep files.')
5 changes: 5 additions & 0 deletions src/spring/azext_spring/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# pylint: disable=line-too-long
from azure.cli.core.commands import CliCommandType
from azure.cli.core.profiles import ResourceType
from azext_spring._utils import handle_asc_exception

from ._client_factory import (cf_spring,
Expand Down Expand Up @@ -519,5 +520,9 @@ def load_command_table(self, _):
exception_handler=handle_asc_exception, is_preview=True) as g:
g.custom_command('list', 'job_execution_instance_list', validator=job_validators.validate_job_execution_instance_list)

with self.command_group('spring', custom_command_type=spring_routing_util, resource_type=ResourceType.MGMT_RESOURCE_RESOURCES,
exception_handler=handle_asc_exception, is_preview=True) as g:
g.custom_command('export', 'spring_migration_start')

with self.command_group('spring', exception_handler=handle_asc_exception):
pass
4 changes: 4 additions & 0 deletions src/spring/azext_spring/migration/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
4 changes: 4 additions & 0 deletions src/spring/azext_spring/migration/converter/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
96 changes: 96 additions & 0 deletions src/spring/azext_spring/migration/converter/acs_converter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from knack.log import get_logger
from .base_converter import BaseConverter

logger = get_logger(__name__)


# Concrete Converter Subclass for Config Server
class ACSConverter(BaseConverter):

CONFIGURATION_KEY_PREFIX = "spring.cloud.config.server.git"
KEY_URI = ".uri"
KEY_LABEL = ".default-label"
KEY_SEARCH_PATHS = ".search-paths"
KEY_USERNAME = ".username"
KEY_PASSWORD = ".password"
KEY_PRIVATE_KEY = ".private-key"
KEY_HOST_KEY = ".host-key"
KEY_HOST_KEY_ALGORITHM = ".host-key-algorithm"
KEY_PATTERN = ".pattern"

def __init__(self, source):
def transform_data():
if self.wrapper_data.is_support_ossconfigserver() is False and self.wrapper_data.is_support_acs():
acs = self.wrapper_data.get_resources_by_type('Microsoft.AppPlatform/Spring/configurationServices')[0]
name = "config"
configurations, params = self._get_configurations_and_params(acs)
replicas = 2
return {
"configServerName": name,
"params": params,
"configurations": configurations,
"replicas": replicas
}
else:
return None
super().__init__(source, transform_data)

def get_template_name(self):
return "config_server.bicep"

def _get_configurations_and_params(self, acs):
configurations = []
params = []

git_repos = acs.get('properties', {}).get('settings', {}).get('gitProperty', {}).get('repositories', None)
if git_repos is not None and len(git_repos) > 0:
default_repo = git_repos[0]
self._add_property_if_exists(configurations, self.CONFIGURATION_KEY_PREFIX + self.KEY_URI, default_repo.get('uri'))
self._add_property_if_exists(configurations, self.CONFIGURATION_KEY_PREFIX + self.KEY_LABEL, default_repo.get('label'))
self._add_property_if_exists(configurations, self.CONFIGURATION_KEY_PREFIX + self.KEY_SEARCH_PATHS, default_repo.get('searchPaths'))
self._add_secret_config(self.CONFIGURATION_KEY_PREFIX + self.KEY_USERNAME, default_repo.get('username'), configurations, params)
self._add_secret_config(self.CONFIGURATION_KEY_PREFIX + self.KEY_PASSWORD, default_repo.get('password'), configurations, params)
self._add_secret_config(self.CONFIGURATION_KEY_PREFIX + self.KEY_PRIVATE_KEY, default_repo.get('privateKey'), configurations, params)
self._add_secret_config(self.CONFIGURATION_KEY_PREFIX + self.KEY_HOST_KEY, default_repo.get('hostKey'), configurations, params)
self._add_secret_config(self.CONFIGURATION_KEY_PREFIX + self.KEY_HOST_KEY_ALGORITHM, default_repo.get('hostKeyAlgorithm'), configurations, params)
self._check_patterns(default_repo)

for i in range(1, len(git_repos)):
repo = git_repos[i]
configuration_key_repo_prefix = self.CONFIGURATION_KEY_PREFIX + ".repos." + repo['name']
self._add_property_if_exists(configurations, configuration_key_repo_prefix + self.KEY_URI, repo.get('uri'))
self._add_property_if_exists(configurations, configuration_key_repo_prefix + self.KEY_LABEL, repo.get('label'))
self._add_property_if_exists(configurations, configuration_key_repo_prefix + self.KEY_SEARCH_PATHS, repo.get('searchPaths'))
self._add_secret_config(configuration_key_repo_prefix + self.KEY_USERNAME, repo.get('username'), configurations, params)
self._add_secret_config(configuration_key_repo_prefix + self.KEY_PASSWORD, repo.get('password'), configurations, params)
self._add_secret_config(configuration_key_repo_prefix + self.KEY_PRIVATE_KEY, repo.get('privateKey'), configurations, params)
self._add_secret_config(configuration_key_repo_prefix + self.KEY_HOST_KEY, repo.get('hostKey'), configurations, params)
self._add_secret_config(configuration_key_repo_prefix + self.KEY_HOST_KEY_ALGORITHM, repo.get('hostKeyAlgorithm'), configurations, params)
self._check_patterns(repo)

return configurations, params

def _add_property_if_exists(self, configurations, key, value):
if value:
if isinstance(value, (list, tuple)):
value = ",".join(map(str, value))
configurations.append({
"propertyName": key,
"value": value
})

def _add_secret_config(self, key, value, configurations, params):
if value:
param_name = key.replace(".", "_").replace("-", "_")
self._add_property_if_exists(configurations, key, param_name)
params.append(param_name)

def _check_patterns(self, repo):
patterns = repo.get('patterns', [])
if len(patterns) > 0:
pattern_str = ",".join(map(str, patterns))
logger.info(f"The patterns '{pattern_str}' of the git repository '{repo.get('name')}' in Application Configuration Service not need in Config Server of Azure Container Apps.")
Loading
Loading