0

first of all I'd like to say I'm new to Kubernetes and that the answer might be something really simple that I just didn't grasp I have a ConfigMap that generates a configuration file for a tool named Karma (alerting dashboard)

apiVersion: v1
kind: ConfigMap
metadata:
  name: karma-conf
  labels:
    name: karma-conf
data:
  karma.yaml: |-
    alertmanager:
      interval: 60s
      servers:
        - name: US-Production
          uri: US-Production-Adress
          timeout: 10s
          proxy: true
          readonly: false
    annotations:
      default:
        hidden: false
      hidden:
        - details
      visible: []
      keep: []
      strip:
        - secret
    filters:
      default:
        - "@state=active"
        - yz2_alert_type=technical
        - severity=high

What I'd like to do is create a base that doesn't have the alertmanager tags so that I could create a production overlay and a testing overlay

It would go like this

Base configmap :


apiVersion: v1
kind: ConfigMap
metadata:
  name: karma-conf
  labels:
    name: karma-conf
data:
  karma.yaml: |-
    annotations:
      default:
        hidden: false
      hidden:
        - details
      visible: []
      keep: []
      strip:
        - secret
    filters:
      default:
        - "@state=active"
        - yz2_alert_type=technical
        - severity=high

Production configmap :

apiVersion: v1
kind: ConfigMap
metadata:
  name: karma-conf
data:
  karma.yaml: |-
    alertmanager:
      interval: 60s
      servers:
        - name: US-Production
          uri: US-Production-Adress
          timeout: 10s
          proxy: true
          readonly: false

Testing configmap :


apiVersion: v1
kind: ConfigMap
metadata:
  name: karma-conf
data:
  karma.yaml: |-
    alertmanager:
      servers:
        - name: integrationEU
          uri: http://testing-server-url:80
          timeout: 10s
          proxy: true
          readonly: false
        - name: stagingEU
          uri: http://testing-server-url:80
          timeout: 10s
          proxy: true
          readonly: false
        # Add or modify other servers as needed for the testing environment

I feel like something this could do the job :

├── base
    ├── karma.config-map.yaml
    ├── kustomization.yaml
├── production
    ├── karma.config-map.patch.yaml
    ├── kustomization.yaml
├── test
    ├── karma.config-map.patch.yaml
    ├── kustomization.yaml

But I just don't know how it works, I tried doing it, applying it using kustomize (but on which folder tho ?) and when I do it it creates me a config-map containing only what's in the patch and not the entire configmap, as if it was not concatenating

Is there an actual way to modify the text inside karma.yaml: |- without rewrite everything in it ?

Kustomize : v5.0.3

0 Answers0