kudobuilder / kudo

Kubernetes Universal Declarative Operator (KUDO)
https://kudo.dev
Apache License 2.0
1.17k stars 103 forks source link

KUDO trying to expand a configmap file's variables, causing it to not install the operator #1792

Open ChristianKlass opened 3 years ago

ChristianKlass commented 3 years ago

What happened: I was trying to create/install an Alertmanager operator (among others, but they are irrelevant). Alertmanager's rules file has some stuff that they will expand as well, and unfortunately, they follow the same format as Kudo's variables. For example, the configmap looks something like this:

apiVersion: v1
data:
  rules.yaml: |
    groups:
      - name: server_nic_status
        rules:
        - alert: NicDown
          expr: nic_status == 0
          for: 30s
          annotations:
            title: 'Interface {{ $labels.nic }} down'
            ...
kind: ConfigMap
metadata: 
  name: alertmanager-config
  namespace: {{ .Namespace }}

When I try to install the configmap, Kudo will complain about an undefined variable $labels. $labels is used by Alertmanager.

What you expected to happen: I expected that Kudo would ignore any expansions which are part of a file in the configmap. I guess it's possible that people would want to put Kudo variables in the configmap files as well, so maybe some escape character or something for within files? I'm not sure hahaha.

How to reproduce it (as minimally and precisely as possible): Use Kudo to apply the above configmap.

Anything else we need to know?:

Environment: