Skip to content

Commit b8089e2

Browse files
Merge pull request #299755 from linglingye001/k8sprovider/refreshAll
Update k8s provider refresh example
2 parents 2bdb609 + be55918 commit b8089e2

File tree

3 files changed

+42
-26
lines changed

3 files changed

+42
-26
lines changed

articles/azure-app-configuration/enable-dynamic-configuration-azure-kubernetes-service.md

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,9 @@ If you use Azure Kubernetes Service (AKS), this tutorial shows you how to enable
2323

2424
Finish the quickstart: [Use Azure App Configuration in Azure Kubernetes Service](./quickstart-azure-kubernetes-service.md).
2525

26-
> [!TIP]
27-
> The Azure Cloud Shell is a free, interactive shell that you can use to run the command line instructions in this article. It has common Azure tools preinstalled, including the .NET Core SDK. If you're logged in to your Azure subscription, launch your [Azure Cloud Shell](https://shell.azure.com) from shell.azure.com. You can learn more about Azure Cloud Shell by [reading our documentation](../cloud-shell/overview.md).
28-
>
29-
## Add a sentinel key
30-
31-
A *sentinel key* is a key that you update after you complete the change of all other keys. Your app monitors the sentinel key. When a change is detected, your app refreshes all configuration values. This approach helps to ensure the consistency of configuration in your app and reduces the overall number of requests made to your App Configuration store, compared to monitoring all keys for changes.
32-
33-
Add the following key-value to your App Configuration store. For more information about how to add key-values to a store using the Azure portal or the CLI, go to [Create a key-value](./quickstart-azure-app-configuration-create.md#create-a-key-value).
34-
35-
| Key | Value |
36-
|---|---|
37-
| Settings:Sentinel | 1 |
38-
3926
## Reload data from App Configuration
4027

41-
1. Open the *appConfigurationProvider.yaml* file located in the *Deployment* directory. Then, add the `refresh` section under the `configuration` property. It enables configuration refresh by monitoring the sentinel key.
28+
1. Open the *appConfigurationProvider.yaml* file located in the *Deployment* directory. Then, add the `refresh` section under the `configuration` property. It enables the Kubernetes provider to reload the entire configuration whenever it detects a change in any of the selected key-values (those starting with *Settings:* and having no label). For more information about monitoring configuration changes, see [Best practices for configuration refresh](./howto-best-practices.md#configuration-refresh).
4229

4330
```yaml
4431
apiVersion: azconfig.io/v1
@@ -58,13 +45,10 @@ Add the following key-value to your App Configuration store. For more informatio
5845
configuration:
5946
refresh:
6047
enabled: true
61-
monitoring:
62-
keyValues:
63-
- key: Settings:Sentinel
6448
```
6549
6650
> [!TIP]
67-
> By default, the Kubernetes provider polls the monitoring key-values every 30 seconds for change detection. However, you can change this behavior by setting the `interval` property of the `refresh`. If you want to reduce the number of requests to your App Configuration store, you can adjust it to a higher value.
51+
> You can set the `interval` property of the `refresh` to specify the minimum time between configuration refreshes. In this example, you use the default value of 30 seconds. Adjust to a higher value if you need to reduce the number of requests made to your App Configuration store.
6852

6953
1. Open the *deployment.yaml* file in the *Deployment* directory and add the following content to the `spec.containers` section. Your application loads configuration from a volume-mounted file the App Configuration Kubernetes provider generates. By setting this environment variable, your application can [use polling to monitor changes in mounted files](/dotnet/api/microsoft.extensions.fileproviders.physicalfileprovider.usepollingfilewatcher).
7054

@@ -90,7 +74,6 @@ Add the following key-value to your App Configuration store. For more informatio
9074
| Key | Value |
9175
|---|---|
9276
| Settings:Message | Hello from Azure App Configuration - now with live updates! |
93-
| Settings:Sentinel | 2 |
9477

9578
1. After refreshing the browser a few times, you'll see the updated content once the ConfigMap is updated in 30 seconds.
9679

articles/azure-app-configuration/howto-best-practices.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,24 @@ const appConfig = await load(endpoint, credential, {
8484
});
8585
```
8686

87+
#### [Kubernetes](#tab/kubernetes)
88+
89+
```yaml
90+
apiVersion: azconfig.io/v1
91+
kind: AzureAppConfigurationProvider
92+
metadata:
93+
name: appconfigurationprovider-sample
94+
spec:
95+
endpoint: <your-app-configuration-store-endpoint>
96+
target:
97+
configMapName: configmap-created-by-appconfig-provider
98+
configuration:
99+
selectors:
100+
- keyFilter: TestApp*
101+
refresh:
102+
enabled: true
103+
```
104+
87105
---
88106
89107
### Monitoring a sentinel key
@@ -118,6 +136,27 @@ const appConfig = await load(endpoint, credential, {
118136
});
119137
```
120138

139+
#### [Kubernetes](#tab/kubernetes)
140+
141+
```yaml
142+
apiVersion: azconfig.io/v1
143+
kind: AzureAppConfigurationProvider
144+
metadata:
145+
name: appconfigurationprovider-sample
146+
spec:
147+
endpoint: <your-app-configuration-store-endpoint>
148+
target:
149+
configMapName: configmap-created-by-appconfig-provider
150+
configuration:
151+
selectors:
152+
- keyFilter: TestApp*
153+
refresh:
154+
enabled: true
155+
monitoring:
156+
keyValues:
157+
- key: SentinelKey
158+
```
159+
121160
---
122161
123162
Both approaches are available through App Configuration providers across supported languages and platforms.

articles/azure-app-configuration/reference-kubernetes-provider.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,7 @@ spec:
383383

384384
### Configuration refresh
385385

386-
When you make changes to your data in Azure App Configuration, you might want those changes to be refreshed automatically in your Kubernetes cluster. It's common to update multiple key-values, but you don't want the cluster to pick up a change midway through the update. To maintain configuration consistency, you can use a key-value to signal the completion of your update. This key-value is known as the sentinel key. The Kubernetes provider can monitor this key-value, and the ConfigMap and Secret will only be regenerated with updated data once a change is detected in the sentinel key.
387-
388-
In the following sample, a key-value named `app1_sentinel` is polled every minute, and the configuration is refreshed whenever changes are detected in the sentinel key.
386+
When you make changes to your data in Azure App Configuration, you might want those changes to be refreshed automatically in your Kubernetes cluster. In the following sample, the Kubernetes provider checks Azure App Configuration for updates every minute. The associated ConfigMap and Secret are regenerated only when changes are detected. For more information about monitoring configuration changes, see [Best practices for configuration refresh](./howto-best-practices.md#configuration-refresh).
389387

390388
``` yaml
391389
apiVersion: azconfig.io/v1
@@ -403,10 +401,6 @@ spec:
403401
refresh:
404402
enabled: true
405403
interval: 1m
406-
monitoring:
407-
keyValues:
408-
- key: app1_sentinel
409-
label: common
410404
```
411405

412406
### Key Vault references

0 commit comments

Comments
 (0)