Azure / AppConfiguration-KubernetesProvider

Bring your data in Azure App Configuration down to your Kubernetes cluster, available as ConfigMap and Secrets and ready to be consumed by any workload.
MIT License
6 stars 2 forks source link

Partial Configuration data in the ConfigMap / Missing Feature Manager data #38

Closed nosalan closed 2 months ago

nosalan commented 2 months ago

Problem description

In my Azure App Configuration I have 2 configuration entries and 1 feature flag. However, I can only see 1 configuration entry in the Config Map created by the Azure App Configuration Kubernetes Provider. Deleting the Config Map doesn't help.

Steps to reproduce

  1. Here is the content of Azure App Configuration / Configuration Explorer:

image

  1. Here is the content of Azure App Configuration / Feature Manager:

image in details: image

  1. CRD Definition
apiVersion: azconfig.io/v1
kind: AzureAppConfigurationProvider
metadata:
  annotations:
    meta.helm.sh/release-name: test-app
    meta.helm.sh/release-namespace: test-app
  labels:
    app.kubernetes.io/managed-by: Helm
  name: appconfigurationprovider-sample
  namespace: test-app
spec:
  auth:
    workloadIdentity:
      managedIdentityClientId: <REDACTED>
  configuration:
    selectors:
    - keyFilter: '*'
  endpoint: https://<REDACTED>.azconfig.io
  featureFlag:
    refresh:
      enabled: true
      interval: 30s
    selectors:
    - keyFilter: '*'
  replicaDiscoveryEnabled: true
  target:
    configMapData:
      key: mysettings.json
      type: json
    configMapName: configmap-created-by-appconfig-provider
  1. Actual config map content (view yaml). The problem is that the data contains only the aaaa config entry and not the tenant2/conf-key1 Also there is no feature flag data.
apiVersion: v1
data:
  mysettings.json: '{"aaaa":"bbbb","feature_management":{"feature_flags":[]}}'
kind: ConfigMap
metadata:
  annotations:
    azconfig.io/LastReconcileTime: 2024-04-26 15:44:28.861791156 +0000 UTC
    meta.helm.sh/release-name: test-app
    meta.helm.sh/release-namespace: test-app
  creationTimestamp: "2024-04-26T15:31:58Z"
  labels:
    app.kubernetes.io/managed-by: Helm
  name: configmap-created-by-appconfig-provider
  namespace: test-app
  ownerReferences:
  - apiVersion: azconfig.io/v1
    blockOwnerDeletion: true
    controller: true
    kind: AzureAppConfigurationProvider
    name: appconfigurationprovider-sample
    uid: 4868699d-760a-4949-a756-6d244a267f23
  resourceVersion: "12206612"
  uid: 5963d8c2-0f03-44f4-9c3c-79cac09d0c85

Additional information

Version: kubernetes-provider:1.3.1 Describe CRD output (Status): image

RichardChen820 commented 2 months ago

@nosalan If the labelFilter is absent in the selectors, the key-values/featureFlags with no label are selected. You didn't see tenant2/conf-key1 since its label is xda, the same for feature flag.

You just need to specify the label in selector:

apiVersion: azconfig.io/v1
kind: AzureAppConfigurationProvider
metadata:
  annotations:
    meta.helm.sh/release-name: test-app
    meta.helm.sh/release-namespace: test-app
  labels:
    app.kubernetes.io/managed-by: Helm
  name: appconfigurationprovider-sample
  namespace: test-app
spec:
  auth:
    workloadIdentity:
      managedIdentityClientId: <REDACTED>
  configuration:
    selectors:
    - keyFilter: '*'
    - keyFilter: '*'
      labelFilter: xda
  endpoint: https://<REDACTED>.azconfig.io
  featureFlag:
    refresh:
      enabled: true
      interval: 30s
    selectors:
    - keyFilter: '*'
      labelFilter: 'my -lab'
  replicaDiscoveryEnabled: true
  target:
    configMapData:
      key: mysettings.json
      type: json
    configMapName: configmap-created-by-appconfig-provider
nosalan commented 2 months ago

Thanks for suggestion @RichardChen820 I need to download all settings regardless of label, so this is what I tried. But it still doesn't work.

apiVersion: azconfig.io/v1
kind: AzureAppConfigurationProvider
metadata:
  name: appconfigurationprovider-sample
spec:
  endpoint: https://<REDACTED>.azconfig.io
  configuration:
    selectors:
      - keyFilter: "*"
        labelFilter: "*"

  featureFlag:
    selectors:
      - keyFilter: '*'
        labelFilter: "*"
    refresh:
      enabled: true

  target:
    configMapName: configmap-created-by-appconfig-provider
    configMapData:
      type: json
      key: mysettings.json
  auth:
    workloadIdentity:
      managedIdentityClientId: <REDACTED>
RichardChen820 commented 2 months ago

@nosalan Wildcard in labelFilter is not supported, this is by design since label is not designed to be used in this way, I would recommend you using the label to group the relevant configurations with intention rather than blindly select all labels. You can take the best practice as a reference.

RichardChen820 commented 2 months ago

This design is for getting deterministic results, configurations are key-values that are non-ordered data. If there are key-values have the same key but with different labels, selecting all labels would cause non-deterministic result, can't ensure the overlap sequence.

nosalan commented 2 months ago

I understand it now. I thought that the label is atag but instead it's a namespace. And you cannot download values for all labels also you cannot modify the label value.