Skip to content
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
2 changes: 2 additions & 0 deletions src/containerapp/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ upcoming
* 'az containerapp connected-env dapr-component set/remove': Support `--no-wait`.
* 'az containerapp connected-env storage set/remove': Support `--no-wait`.
* 'az containerapp env http-route-config': Add commands for the http-route-config feature area.
* 'az containerapp env java-component': Support more flexible configuration updates with new parameters `--set-configurations`, `--replace-configurations`, `--remove-configurations` and `--remove-all-configurations`.
* 'az containerapp env java-component gateway-for-spring create/update': Support `--bind` and `--unbind`

1.1.0b1
++++++
Expand Down
122 changes: 91 additions & 31 deletions src/containerapp/azext_containerapp/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@
az containerapp env java-component spring-cloud-config create -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration PropertyName1=Value1 PropertyName2=Value2
--set-configurations PropertyName1=Value1 PropertyName2=Value2
Copy link
Contributor

@ShichaoQiu ShichaoQiu Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add some examples for this parameter --replace-configurations to describe how to use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, examples added

"""

helps['containerapp env java-component spring-cloud-config delete'] = """
Expand Down Expand Up @@ -1292,13 +1292,13 @@
az containerapp env java-component spring-cloud-config update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration
--remove-all-configurations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'd better add some examples about how to use --remove-configurations

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, examples added

- name: Update a Spring Cloud Config with custom configurations.
text: |
az containerapp env java-component spring-cloud-config update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration PropertyName1=Value1 PropertyName2=Value2
--set-configurations PropertyName1=Value1 PropertyName2=Value2
"""

helps['containerapp env java-component config-server-for-spring'] = """
Expand All @@ -1315,7 +1315,7 @@
az containerapp env java-component config-server-for-spring create -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration PropertyName1=Value1 PropertyName2=Value2
--set-configurations PropertyName1=Value1 PropertyName2=Value2
- name: Create a Config Server for Spring with multiple replicas.
text: |
az containerapp env java-component config-server-for-spring create -g MyResourceGroup \\
Expand Down Expand Up @@ -1350,18 +1350,30 @@
type: command
short-summary: Command to update the Config Server for Spring.
examples:
- name: Delete all configurations of the Config Server for Spring.
- name: Update a Config Server for Spring with custom configurations.
text: |
az containerapp env java-component config-server-for-spring update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration
- name: Update a Config Server for Spring with custom configurations.
--set-configurations PropertyName1=Value1 PropertyName2=Value2
- name: Replace all configurations of the Config Server for Spring.
text: |
az containerapp env java-component config-server-for-spring update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--replace-configurations PropertyName1=Value1 PropertyName2=Value2
- name: Delete configurations of the Config Server for Spring.
text: |
az containerapp env java-component config-server-for-spring update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration PropertyName1=Value1 PropertyName2=Value2
--remove-configurations PropertyName1 PropertyName2
- name: Delete all configurations of the Config Server for Spring.
text: |
az containerapp env java-component config-server-for-spring update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--remove-all-configurations
Comment on lines +1371 to +1376
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this is dup with line 1355-1358?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dup removed

"""

helps['containerapp env java-component spring-cloud-eureka'] = """
Expand All @@ -1384,7 +1396,7 @@
az containerapp env java-component spring-cloud-eureka create -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration PropertyName1=Value1 PropertyName2=Value2
--set-configurations PropertyName1=Value1 PropertyName2=Value2
"""

helps['containerapp env java-component spring-cloud-eureka delete'] = """
Expand Down Expand Up @@ -1418,13 +1430,13 @@
az containerapp env java-component spring-cloud-eureka update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration
--remove-all-configurations
- name: Update a Spring Cloud Eureka with custom configurations.
text: |
az containerapp env java-component spring-cloud-eureka update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration PropertyName1=Value1 PropertyName2=Value2
--set-configurations PropertyName1=Value1 PropertyName2=Value2
"""

helps['containerapp env java-component eureka-server-for-spring'] = """
Expand All @@ -1446,7 +1458,7 @@
az containerapp env java-component eureka-server-for-spring create -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration PropertyName1=Value1 PropertyName2=Value2
--set-configurations PropertyName1=Value1 PropertyName2=Value2
"""

helps['containerapp env java-component eureka-server-for-spring delete'] = """
Expand Down Expand Up @@ -1475,18 +1487,30 @@
type: command
short-summary: Command to update the Eureka Server for Spring.
examples:
- name: Delete all configurations of the Eureka Server for Spring.
- name: Update an Eureka Server for Spring with custom configurations.
text: |
az containerapp env java-component eureka-server-for-spring update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration
- name: Update an Eureka Server for Spring with custom configurations.
--set-configurations PropertyName1=Value1 PropertyName2=Value2
- name: Replace all configurations of the Eureka Server for Spring.
text: |
az containerapp env java-component eureka-server-for-spring update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration PropertyName1=Value1 PropertyName2=Value2
--replace-configurations PropertyName1=Value1 PropertyName2=Value2
- name: Delete configurations of the Eureka Server for Spring.
text: |
az containerapp env java-component eureka-server-for-spring update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--remove-configurations PropertyName1 PropertyName2
- name: Delete all configurations of the Eureka Server for Spring.
text: |
az containerapp env java-component eureka-server-for-spring update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--remove-all-configurations
Comment on lines +1508 to +1513
Copy link
Contributor

@Greedygre Greedygre Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dup with line 1498-1501?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dup removed

"""

helps['containerapp env java-component admin-for-spring'] = """
Expand All @@ -1508,7 +1532,7 @@
az containerapp env java-component admin-for-spring create -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration PropertyName1=Value1 PropertyName2=Value2
--set-configurations PropertyName1=Value1 PropertyName2=Value2
- name: Create an Admin for Spring with multiple replicas.
text: |
az containerapp env java-component admin-for-spring create -g MyResourceGroup \\
Expand Down Expand Up @@ -1543,18 +1567,30 @@
type: command
short-summary: Command to update the Admin for Spring.
examples:
- name: Delete all configurations of the Admin for Spring.
- name: Update an Admin for Spring with custom configurations.
text: |
az containerapp env java-component admin-for-spring update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration
- name: Update an Admin for Spring with custom configurations.
--set-configurations PropertyName1=Value1 PropertyName2=Value2
- name: Replace all configurations of the Admin for Spring.
text: |
az containerapp env java-component admin-for-spring update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--replace-configurations PropertyName1=Value1 PropertyName2=Value2
- name: Delete configurations of the Admin for Spring.
text: |
az containerapp env java-component admin-for-spring update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--remove-configurations PropertyName1 PropertyName2
- name: Delete all configurations of the Admin for Spring.
text: |
az containerapp env java-component admin-for-spring update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration PropertyName1=Value1 PropertyName2=Value2
--remove-all-configurations
"""

helps['containerapp env java-component nacos'] = """
Expand All @@ -1576,7 +1612,7 @@
az containerapp env java-component nacos create -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration PropertyName1=Value1 PropertyName2=Value2
--set-configurations PropertyName1=Value1 PropertyName2=Value2
"""

helps['containerapp env java-component nacos delete'] = """
Expand Down Expand Up @@ -1605,18 +1641,30 @@
type: command
short-summary: Command to update the Nacos.
examples:
- name: Delete all configurations of the Nacos.
- name: Update an Nacos with custom configurations.
text: |
az containerapp env java-component nacos update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration
- name: Update an Nacos with custom configurations.
--set-configurations PropertyName1=Value1 PropertyName2=Value2
- name: Replace all configurations of the nacos.
text: |
az containerapp env java-component nacos update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration PropertyName1=Value1 PropertyName2=Value2
--replace-configurations PropertyName1=Value1 PropertyName2=Value2
- name: Delete configurations of the nacos.
text: |
az containerapp env java-component nacos update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--remove-configurations PropertyName1 PropertyName2
- name: Delete all configurations of the nacos.
text: |
az containerapp env java-component nacos update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--remove-all-configurations
Comment on lines +1662 to +1667
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dup?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dup removed

"""

helps['containerapp env java-component gateway-for-spring'] = """
Expand All @@ -1640,7 +1688,7 @@
-n MyJavaComponentName \\
--environment MyEnvironment \\
--route-yaml MyRouteYamlFilePath \\
--configuration PropertyName1=Value1 PropertyName2=Value2
--set-configurations PropertyName1=Value1 PropertyName2=Value2
- name: Create a Gateway for Spring with multiple replicas.
text: |
az containerapp env java-component gateway-for-spring create -g MyResourceGroup \\
Expand Down Expand Up @@ -1682,18 +1730,30 @@
-n MyJavaComponentName \\
--environment MyEnvironment \\
--route-yaml MyRouteYamlFilePath
- name: Delete all configurations of the Gateway for Spring.
- name: Update a Gateway for Spring with custom configurations.
text: |
az containerapp env java-component gateway-for-spring update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration
- name: Update a Gateway for Spring with custom configurations.
--set-configurations PropertyName1=Value1 PropertyName2=Value2
- name: Replace all configurations of the Gateway for Spring.
text: |
az containerapp env java-component gateway-for-spring update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--replace-configurations PropertyName1=Value1 PropertyName2=Value2
- name: Delete configurations of the Gateway for Spring.
text: |
az containerapp env java-component gateway-for-spring update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--remove-configurations PropertyName1 PropertyName2
- name: Delete all configurations of the Gateway for Spring.
text: |
az containerapp env java-component gateway-for-spring update -g MyResourceGroup \\
-n MyJavaComponentName \\
--environment MyEnvironment \\
--configuration PropertyName1=Value1 PropertyName2=Value2
--remove-all-configurations
"""

# Container Apps Telemetry Commands
Expand Down
6 changes: 5 additions & 1 deletion src/containerapp/azext_containerapp/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,11 @@ def load_arguments(self, _):
c.argument('resource_group_name', arg_type=resource_group_name_type, id_part=None)
c.argument('service_bindings', nargs='*', options_list=['--bind'], help="Space separated list of services, bindings or other Java components to be connected to this Java Component. e.g. SVC_NAME1[:BIND_NAME1] SVC_NAME2[:BIND_NAME2]...")
c.argument('unbind_service_bindings', nargs='*', options_list=['--unbind'], help="Space separated list of services, bindings or Java components to be removed from this Java Component. e.g. BIND_NAME1...")
c.argument('configuration', nargs="*", help="Java component configuration. Configuration must be in format `<propertyName>=<value>` `<propertyName>=<value>`...")
c.argument('configuration', nargs="*", help="Java component configuration. Configuration must be in format `<propertyName>=<value>` `<propertyName>=<value>`...", deprecate_info=c.deprecate(target="--configuration", redirect='--[set|replace|remove|remove-all]-configurations', hide=True))
c.argument('set_configurations', nargs="*", options_list=['--set-configurations', '--set-configs'], help="Add or update Java component configuration(s). Other existing configurations are not modified. Configuration must be in format `<propertyName>=<value>` `<propertyName>=<value>`...")
c.argument('replace_configurations', nargs="*", options_list=['--replace-configurations', '--replace-configs'], help="Replace Java component configuration(s), Other existing configurations are removed. Configuration must be in format `<propertyName>=<value>` `<propertyName>=<value>`...")
c.argument('remove_configurations', nargs="*", options_list=['--remove-configurations', '--remove-configs'], help="Remove Java component configuration(s). Specify configuration names separated by space, in format `<propertyName>` `<propertyName>`...")
c.argument('remove_all_configurations', arg_type=get_three_state_flag(), options_list=['--remove-all-configurations', '--remove-all-configs'], help="Remove all Java component configuration(s).")
Comment on lines +377 to +378
Copy link
Contributor

@zhoxing-ms zhoxing-ms Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove_configurations
remove_all_configurations

Because these two parameters are similar, can they be merged into one parameter? For example, when --remove-configurations does not specify a specific value, the all the configurations are deleted

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since az containerapp includes parameters like [--remove-all-env-vars] and [--remove-env-vars], I think we should align with that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, got it~

c.argument('min_replicas', type=int, help="Minimum number of replicas to run for the Java component.")
c.argument('max_replicas', type=int, help="Maximum number of replicas to run for the Java component.")
c.argument('route_yaml', options_list=['--route-yaml', '--yaml'], help="Path to a .yaml file with the configuration of a Spring Cloud Gateway route. For an example, see https://aka.ms/gateway-for-spring-routes-yaml")
Expand Down
Loading
Loading