Skip to content

Commit 6303ede

Browse files
authored
Merge pull request #247342 from RichardChen820/appconfig/junbchen/addFileStyleConfigMap
[Azure App Configuration] Add file-style ConfigMap to the K8s provider reference doc
2 parents 34c4072 + 015c91c commit 6303ede

File tree

1 file changed

+128
-0
lines changed

1 file changed

+128
-0
lines changed

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

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ The `spec.target` property has the following child property.
3131
|Name|Description|Required|Type|
3232
|---|---|---|---|
3333
|configMapName|The name of the ConfigMap to be created|true|string|
34+
|configMapData|The setting that specifies how the retrieved data should be populated in the generated ConfigMap|false|object|
35+
36+
If the `spec.target.configMapData` property is not set, the generated ConfigMap will be populated with the list of key-values retrieved from Azure App Configuration, which allows the ConfigMap to be consumed as environment variables. Update this property if you wish to consume the ConfigMap as a mounted file. This property has the following child properties.
37+
38+
|Name|Description|Required|Type|
39+
|---|---|---|---|
40+
|type|The setting that indicates how the retrieved data is constructed in the generated ConfigMap. The allowed values include `default`, `json`, `yaml` and `properties`|optional|string|
41+
|key|The key name of the retrieved data when the `type` is set to `json`, `yaml` or `properties`. Set it to the file name if the ConfigMap is set up to be consumed as a mounted file|conditional|string|
3442

3543
The `spec.auth` property isn't required if the connection string of your App Configuration store is provided by setting the `spec.connectionStringReference` property. Otherwise, one of the identities, service principal, workload identity, or managed identity, will be used for authentication. The `spec.auth` has the following child properties. Only one of them should be specified. If none of them are set, the system-assigned managed identity of the virtual machine scale set will be used.
3644

@@ -333,4 +341,124 @@ spec:
333341
label: common
334342
- key: sentinelKey
335343
label: development
344+
```
345+
346+
### Consume ConfigMap
347+
348+
Applications running in Kubernetes typically consume the ConfigMap either as environment variables or as configuration files. If the `configMapData.type` property is absent or is set to default, the ConfigMap is populated with the itemized list of data retrieved from Azure App Configuration, which can be easily consumed as environment variables. If the `configMapData.type` property is set to json, yaml or properties, data retrieved from Azure App Configuration is grouped into one item with key name specified by the `configMapData.key` property in the generated ConfigMap, which can be consumed as a mounted file.
349+
350+
The following examples show how the data is populated in the generated ConfigMap with different settings of the `configMapData.type` property.
351+
352+
Assuming an App Configuration store has these key-values:
353+
354+
|key|value|
355+
|---|---|
356+
|key1|value1|
357+
|key2|value2|
358+
|key3|value3|
359+
360+
#### [default](#tab/default)
361+
362+
and the `configMapData.type` property is absent or set to `default`,
363+
364+
``` yaml
365+
apiVersion: azconfig.io/v1beta1
366+
kind: AzureAppConfigurationProvider
367+
metadata:
368+
name: appconfigurationprovider-sample
369+
spec:
370+
endpoint: <your-app-configuration-store-endpoint>
371+
target:
372+
configMapName: configmap-created-by-appconfig-provider
373+
```
374+
375+
the generated ConfigMap will be populated with the following data:
376+
377+
``` yaml
378+
data:
379+
key1: value1
380+
key2: value2
381+
key3: value3
382+
```
383+
384+
#### [json](#tab/json)
385+
386+
and the `configMapData.type` property is set to `json`,
387+
388+
``` yaml
389+
apiVersion: azconfig.io/v1beta1
390+
kind: AzureAppConfigurationProvider
391+
metadata:
392+
name: appconfigurationprovider-sample
393+
spec:
394+
endpoint: <your-app-configuration-store-endpoint>
395+
target:
396+
configMapName: configmap-created-by-appconfig-provider
397+
configMapData:
398+
type: json
399+
key: appSettings.json
400+
```
401+
402+
the generated ConfigMap will be populated with the following data:
403+
404+
``` yaml
405+
data:
406+
appSettings.json: >-
407+
{"key1":"value1","key2":"value2","key3":"value3"}
408+
```
409+
410+
#### [yaml](#tab/yaml)
411+
412+
and the `configMapData.type` property is set to `yaml`,
413+
414+
``` yaml
415+
apiVersion: azconfig.io/v1beta1
416+
kind: AzureAppConfigurationProvider
417+
metadata:
418+
name: appconfigurationprovider-sample
419+
spec:
420+
endpoint: <your-app-configuration-store-endpoint>
421+
target:
422+
configMapName: configmap-created-by-appconfig-provider
423+
configMapData:
424+
type: yaml
425+
key: appSettings.yaml
426+
```
427+
428+
the generated ConfigMap will be populated with the following data:
429+
430+
``` yaml
431+
data:
432+
appSettings.yaml: >-
433+
key1: value1
434+
key2: value2
435+
key3: value3
436+
```
437+
438+
#### [properties](#tab/properties)
439+
440+
and the `configMapData.type` property is set to `properties`,
441+
442+
``` yaml
443+
apiVersion: azconfig.io/v1beta1
444+
kind: AzureAppConfigurationProvider
445+
metadata:
446+
name: appconfigurationprovider-sample
447+
spec:
448+
endpoint: <your-app-configuration-store-endpoint>
449+
target:
450+
configMapName: configmap-created-by-appconfig-provider
451+
configMapData:
452+
type: properties
453+
key: app.properties
454+
```
455+
456+
the generated ConfigMap will be populated with the following data:
457+
458+
``` yaml
459+
data:
460+
app.properties: >-
461+
key1=value1
462+
key2=value2
463+
key3=value3
336464
```

0 commit comments

Comments
 (0)