Skip to content

Commit a1e42e2

Browse files
authored
Merge pull request #240459 from ninpan-ms/ninpan/addon
Add restart action for SCG and addon configs
2 parents ec728b2 + a739fe5 commit a1e42e2

File tree

4 files changed

+159
-46
lines changed

4 files changed

+159
-46
lines changed

articles/spring-apps/how-to-configure-enterprise-spring-cloud-gateway.md

Lines changed: 159 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,65 @@ To integrate with API portal for VMware Tanzu, VMware Spring Cloud Gateway autom
4242
4343
- Azure CLI version 2.0.67 or later. For more information, see [How to install the Azure CLI](/cli/azure/install-azure-cli).
4444

45+
## Enable/disable Spring Cloud Gateway after service creation
46+
47+
You can enable and disable Spring Cloud Gateway after service creation using the Azure portal or Azure CLI. Before disabling Spring Cloud Gateway, you're required to unassign its endpoint and remove all route configs.
48+
49+
### [Azure portal](#tab/Azure-portal)
50+
51+
Use the following steps to enable or disable Spring Cloud Gateway using the Azure portal:
52+
53+
1. Navigate to your service resource, and then select **Spring Cloud Gateway**.
54+
1. Select **Manage**.
55+
1. Select or unselect the **Enable Spring Cloud Gateway**, and then select **Save**.
56+
1. You can now view the state of Spring Cloud Gateway on the **Spring Cloud Gateway** page.
57+
58+
:::image type="content" source="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-manage-restart.png" alt-text="Screenshot of the Azure portal showing the Spring Cloud Gateway page." lightbox="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-manage-restart.png":::
59+
60+
### [Azure CLI](#tab/Azure-CLI)
61+
62+
Use the following Azure CLI commands to enable or disable Spring Cloud Gateway:
63+
64+
```azurecli
65+
az spring spring-cloud-gateway create \
66+
--resource-group <resource-group-name> \
67+
--service <Azure-Spring-Apps-service-instance-name>
68+
```
69+
70+
```azurecli
71+
az spring spring-cloud-gateway delete \
72+
--resource-group <resource-group-name> \
73+
--service <Azure-Spring-Apps-instance-name>
74+
```
75+
76+
---
77+
78+
## Restart Spring Cloud Gateway
79+
80+
After the restart action, gateway instances are rolling restarted.
81+
82+
### [Azure portal](#tab/Azure-portal)
83+
84+
Use the following steps to restart Spring Cloud Gateway using the Azure portal:
85+
86+
1. Navigate to your service resource, and then select **Spring Cloud Gateway**.
87+
1. Select **Restart**.
88+
1. Select **OK** to confirm the restart.
89+
90+
:::image type="content" source="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-restart.png" alt-text="Screenshot of the Azure portal showing the Spring Cloud Gateway page with the Restart gateway dialog box." lightbox="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-restart.png":::
91+
92+
### [Azure CLI](#tab/Azure-CLI)
93+
94+
Use the following Azure CLI command to restart the gateway:
95+
96+
```azurecli
97+
az spring spring-cloud-gateway restart \
98+
--resource-group <resource-group-name> \
99+
--service <Azure-Spring-Apps-service-instance-name>
100+
```
101+
102+
---
103+
45104
## Configure Spring Cloud Gateway
46105

47106
This section describes how to assign a public endpoint to Spring Cloud Gateway and configure its properties.
@@ -203,14 +262,15 @@ req.send();
203262
204263
Cross-origin resource sharing (CORS) allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served. The available CORS configuration options are described in the following table.
205264
206-
| Property | Description |
207-
|------------------|----------------------------------------------------------------------------------------|
208-
| allowedOrigins | Allowed origins to make cross-site requests. |
209-
| allowedMethods | Allowed HTTP methods on cross-site requests. |
210-
| allowedHeaders | Allowed headers in cross-site request. |
211-
| maxAge | How long, in seconds, the response from a preflight request is cached by clients. |
212-
| allowCredentials | Whether user credentials are supported on cross-site requests. |
213-
| exposedHeaders | HTTP response headers to expose for cross-site requests. |
265+
| Property | Description |
266+
|-------------------------|-----------------------------------------------------------------------------------|
267+
| `allowedOrigins` | Allowed origins to make cross-site requests. |
268+
| `allowedOriginPatterns` | Allowed origin patterns to make cross-site requests. |
269+
| `allowedMethods` | Allowed HTTP methods on cross-site requests. |
270+
| `allowedHeaders` | Allowed headers in cross-site request. |
271+
| `maxAge` | How long, in seconds, the response from a preflight request is cached by clients. |
272+
| `allowCredentials` | Whether user credentials are supported on cross-site requests. |
273+
| `exposedHeaders` | HTTP response headers to expose for cross-site requests. |
214274
215275
> [!NOTE]
216276
> Be sure you have the correct CORS configuration if you want to integrate with API portal. For more information, see the [Configure Spring Cloud Gateway](#configure-spring-cloud-gateway) section.
@@ -313,22 +373,20 @@ The gateway restarts accordingly to ensure that the gateway uses the new certifi
313373
Use the following steps to synchronize certificates.
314374

315375
1. In your Azure Spring Apps instance, select **Spring Cloud Gateway** in the navigation pane.
316-
1. On the **Spring Cloud Gateway** page, select **Certificate management**.
317-
1. Select the certificate you imported in **Certificates**.
318-
1. Select **sync certificate**, and confirm the operation.
319-
320-
:::image type="content" source="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-sync-certificate.png" alt-text="Screenshot of the Azure portal showing the Spring Cloud Gateway page for Certificate Management with the sync certificate prompt highlighted." lightbox="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-sync-certificate.png":::
376+
1. On the **Spring Cloud Gateway** page, select **Restart**, and then confirm the operation.
321377

322378
#### [Azure CLI](#tab/Azure-CLI)
323379

324-
Use the following command to synchronize a certificate for Spring Cloud Gateway.
380+
Use the following restart command to synchronize a certificate for Spring Cloud Gateway.
325381

326382
```azurecli
327-
az spring gateway sync-cert \
383+
az spring gateway restart \
328384
--resource-group <resource-group-name> \
329385
--service <Azure-Spring-Apps-instance-name>
330386
```
331387

388+
---
389+
332390
### Set up Autoscale settings for VMware Spring Cloud Gateway in Azure CLI
333391

334392
You can set Autoscale modes using the Azure CLI. The following commands create an Autoscale setting and an Autoscale rule.
@@ -513,6 +571,92 @@ If the log level is sensitive information in your case, you can include it by us
513571
514572
---
515573
574+
## Configure addon configuration
575+
576+
The addon configuration feature enables you to customize certain properties of Spring Cloud Gateway using a JSON format string. The feature is useful when you need to configure properties that aren't exposed through the REST API.
577+
578+
The addon configuration is a JSON object with key-value paris representing the desired configuration. The following example shows the structure of the JSON format:
579+
580+
```json
581+
{
582+
"<addon-key-name>": {
583+
"<addon-key-name>": "<addon-value>"
584+
...
585+
},
586+
"<addon-key-name>": "<addon-value>",
587+
...
588+
}
589+
```
590+
591+
The following list shows the supported addon configurations for the addon key names and value types. This list is subject to change as we upgrade the Spring Cloud Gateway version.
592+
593+
- Single sign-on (SSO) configuration
594+
- Key name: `sso`
595+
- Value type: Object
596+
- Properties:
597+
- `RolesAttributeName` (String): Specifies the name of the attribute that contains the roles associated with the single sign-on session.
598+
- `InactiveSessionExpirationInMinutes` (Integer): Specifies the expiration time in minutes for inactive single sign-on sessions. A value of *0* means never expire.
599+
- Example:
600+
601+
```json
602+
{
603+
"sso": {
604+
"rolesAttributeName": "roles",
605+
"inactiveSessionExpirationInMinutes": 1
606+
}
607+
}
608+
```
609+
610+
- Metadata configuration
611+
- Key name: `api`
612+
- Value type: Object
613+
- Properties
614+
- `groupId` (String): A unique identifier for the group of APIs available on the Gateway instance. The value can only contain lowercase letters and numbers.
615+
- Example:
616+
617+
```json
618+
{
619+
"api": {
620+
"groupId": "id1"
621+
}
622+
}
623+
```
624+
625+
Use the following steps to update the addon configuration.
626+
627+
### [Azure portal](#tab/Azure-portal)
628+
629+
1. In your Azure Spring Apps instance, select **Spring Cloud Gateway** in the navigation pane, and then select **Configuration**.
630+
1. Specify the JSON value for **Addon Configs**.
631+
1. Select **Save**.
632+
633+
### [Azure CLI](#tab/Azure-CLI)
634+
635+
1. Prepare the addon configs JSON file *\<file-name-of-addon-configs-json\>.json* with the following content:
636+
637+
```json
638+
{
639+
"sso": {
640+
"rolesAttributeName": "roles",
641+
"inactiveSessionExpirationInMinutes": 1
642+
},
643+
"api": {
644+
"groupId": "id1"
645+
}
646+
}
647+
```
648+
649+
1. Use the following command to update the addon configs for Spring Cloud Gateway:
650+
651+
```azurecli
652+
az spring gateway update \
653+
--resource-group <resource-group-name> \
654+
--service <Azure-Spring-Apps-instance-name> \
655+
--addon-configs-file <file-name-of-addon-configs-json>.json
656+
```
657+
658+
---
659+
516660
## Next steps
517661

518662
- [How to Use Spring Cloud Gateway](how-to-use-enterprise-spring-cloud-gateway.md)

articles/spring-apps/how-to-use-enterprise-spring-cloud-gateway.md

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -264,37 +264,6 @@ az spring gateway route-config create \
264264
--routes-file <json-file-with-routes>
265265
```
266266

267-
## Enable/disable Spring Cloud Gateway after service creation
268-
269-
You can enable and disable Spring Cloud Gateway after service creation using the Azure portal or Azure CLI. Before disabling Spring Cloud Gateway, you're required to unassign its endpoint and remove all route configs.
270-
271-
### [Azure portal](#tab/Portal)
272-
273-
Use the following steps to enable or disable Spring Cloud Gateway using the Azure portal:
274-
275-
1. Navigate to your service resource, and then select **Spring Cloud Gateway**.
276-
1. Select **Manage**.
277-
1. Select or unselect the **Enable Spring Cloud Gateway**, and then select **Save**.
278-
1. You can now view the state of Spring Cloud Gateway on the **Spring Cloud Gateway** page.
279-
280-
### [Azure CLI](#tab/Azure-CLI)
281-
282-
Use the following Azure CLI commands to enable or disable Spring Cloud Gateway:
283-
284-
```azurecli
285-
az spring spring-cloud-gateway create \
286-
--resource-group <resource-group-name> \
287-
--service <Azure-Spring-Apps-service-instance-name>
288-
```
289-
290-
```azurecli
291-
az spring spring-cloud-gateway delete \
292-
--resource-group <resource-group-name> \
293-
--service <Azure-Spring-Apps-instance-name>
294-
```
295-
296-
---
297-
298267
## Next steps
299268

300269
- [Azure Spring Apps](index.yml)
52.9 KB
Loading
56.1 KB
Loading

0 commit comments

Comments
 (0)