open-feature-operator icon indicating copy to clipboard operation
open-feature-operator copied to clipboard

helm install fails with annotations with complex values

Open kencharos opened this issue 1 year ago • 0 comments

vesrion: 0.7.1

I tried annotation configuration from https://github.com/open-feature/open-feature-operator/releases/tag/v0.7.1 .

I am considering monitoring fladg pod by datadog and tried to set up a monitoring configuration annotation for open metrics.

pease see about datadog openmetrics configuration in here

This is values.yaml that I tried.

annotations:
  ad.datadoghq.com/flagd.checks: |
    {
      "openmetrics": {
        "instances": [
          {
            "openmetrics_endpoint": "http://%%host%%:8014/metrics",
            "namespace": "flagd",
            "metrics": ["feature_flag.*"]
          }
        ]
      }
    }

Then, Helm install is failed by Invalid Yaml

Error: YAML parse error on open-feature-operator/templates/apps_v1_deployment_open-feature-operator-controller-manager.yaml: error converting YAML to JSON: yaml: line 54: did not find expected key.

The following are the debugging results of the helm template. It appears that the --annotation option setting requires escaping of the annotation value.

# Source: open-feature-operator/templates/apps_v1_deployment_open-feature-operator-controller-manager.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    control-plane: controller-manager
  name: open-feature-operator-controller-manager
  namespace: 'open-feature-operator-system'
spec:
  replicas: 01
  selector:
    matchLabels:
      control-plane: controller-manager
  template:
    metadata:
      annotations:
        ad.datadoghq.com/flagd.checks: |
          {
            "openmetrics": {
              "instances": [
                {
                  "openmetrics_endpoint": "http://%%host%%:8014/metrics",
                  "namespace": "flagd",
                  "metrics": ["feature_flag.*"]
                }
              ]
            }
          }
        kubectl.kubernetes.io/default-container: manager
      labels:

        control-plane: controller-manager
    spec:
      imagePullSecrets:  
                []
      containers:
      - args:
        - --leader-elect
        - --sidecar-cpu-limit=500m
        - --sidecar-ram-limit=64Mi
        - --sidecar-cpu-request=200m
        - --sidecar-ram-request=32Mi
        - --image-pull-secrets=
        - --metrics-bind-address=:8080
        - --labels=
        - --annotations=ad.datadoghq.com/flagd.checks:{
  "openmetrics": {
    "instances": [
      {
        "openmetrics_endpoint": "http://%%host%%:8014/metrics",
        "namespace": "flagd",
        "metrics": ["feature_flag.*"]
      }
    ]
  }
}

Also, looking StringToMap , it appears that we cannot have commas or colons as annotation values.

Not only datadog, but also annotations often have complex values such as JSON and YAML, so it would be great if you could consider supporting this.

kencharos avatar Jul 26 '24 02:07 kencharos