Skip to content

Draft: Add "default" Helm labels and missing namespaces

This changeset labels all the managed resources with standard labels which are part of the Helm chart skeleton, ex:

monitoring, servicemonitor-scheduler, ServiceMonitor (monitoring.coreos.com) has changed:
  # Source: cern-it-monitoring-kubernetes/templates/scheduler/servicemonitor.yaml
  apiVersion: monitoring.coreos.com/v1
  kind: ServiceMonitor
  metadata:
    name: servicemonitor-scheduler
    namespace: monitoring
+   labels:
+     helm.sh/chart: cern-it-monitoring-kubernetes-0.0.0
+     app.kubernetes.io/name: cern-it-monitoring-kubernetes
+     app.kubernetes.io/instance: kubernetes-monitoring
+     app.kubernetes.io/managed-by: Helm

The most useful bit about this is to easily know what version of the chart updated the resource for the last time.

I'm also adding the namespace metadata key to some resources that were missing it. Whereas this is ignored when using helm install as -n wins, it might be useful when using helm template to perhaps feed the output to kubectl apply -f -.

Edited by Nacho Barrientos

Merge request reports

Loading