From fff7103d5d4c50cd2d2a77e361be72f64ddb3748 Mon Sep 17 00:00:00 2001 From: Genadi Postrilko Date: Thu, 9 Jan 2025 18:43:31 +0200 Subject: [PATCH] feat[opentelemetry-kube-stack] cleanupJob add support custom image and registry --- charts/opentelemetry-kube-stack/Chart.yaml | 2 +- .../examples/cloud-demo/rendered/bridge.yaml | 2 +- .../examples/cloud-demo/rendered/collector.yaml | 4 ++-- .../examples/cloud-demo/rendered/hooks.yaml | 4 ++-- .../examples/cloud-demo/rendered/instrumentation.yaml | 2 +- .../examples/prometheus-otel/rendered/collector.yaml | 2 +- .../rendered/exporters/kube-api-server/servicemonitor.yaml | 2 +- .../rendered/exporters/kube-controller-manager/service.yaml | 2 +- .../exporters/kube-controller-manager/servicemonitor.yaml | 2 +- .../rendered/exporters/kube-dns/service.yaml | 2 +- .../rendered/exporters/kube-dns/servicemonitor.yaml | 2 +- .../rendered/exporters/kube-etcd/service.yaml | 2 +- .../rendered/exporters/kube-etcd/servicemonitor.yaml | 2 +- .../rendered/exporters/kube-proxy/service.yaml | 2 +- .../rendered/exporters/kube-proxy/servicemonitor.yaml | 2 +- .../rendered/exporters/kube-scheduler/service.yaml | 2 +- .../rendered/exporters/kube-scheduler/servicemonitor.yaml | 2 +- .../examples/prometheus-otel/rendered/hooks.yaml | 4 ++-- charts/opentelemetry-kube-stack/templates/hooks.yaml | 6 +++++- charts/opentelemetry-kube-stack/values.yaml | 6 ++++++ 20 files changed, 32 insertions(+), 22 deletions(-) diff --git a/charts/opentelemetry-kube-stack/Chart.yaml b/charts/opentelemetry-kube-stack/Chart.yaml index 3fc9dc609..0f27bf92c 100644 --- a/charts/opentelemetry-kube-stack/Chart.yaml +++ b/charts/opentelemetry-kube-stack/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: opentelemetry-kube-stack -version: 0.3.9 +version: 0.3.10 description: | OpenTelemetry Quickstart chart for Kubernetes. Installs an operator and collector for an easy way to get started with Kubernetes observability. diff --git a/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/bridge.yaml b/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/bridge.yaml index 1182e2059..0a4b86160 100644 --- a/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/bridge.yaml +++ b/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/bridge.yaml @@ -5,7 +5,7 @@ kind: OpAMPBridge metadata: name: example labels: - helm.sh/chart: opentelemetry-kube-stack-0.3.9 + helm.sh/chart: opentelemetry-kube-stack-0.3.10 app.kubernetes.io/version: "0.107.0" app.kubernetes.io/managed-by: Helm release: "example" diff --git a/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/collector.yaml b/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/collector.yaml index 308cf6831..cbc7cdc7b 100644 --- a/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/collector.yaml +++ b/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/collector.yaml @@ -6,7 +6,7 @@ metadata: name: example-cluster-stats namespace: default labels: - helm.sh/chart: opentelemetry-kube-stack-0.3.9 + helm.sh/chart: opentelemetry-kube-stack-0.3.10 app.kubernetes.io/version: "0.107.0" app.kubernetes.io/managed-by: Helm release: "example" @@ -187,7 +187,7 @@ metadata: name: example-daemon namespace: default labels: - helm.sh/chart: opentelemetry-kube-stack-0.3.9 + helm.sh/chart: opentelemetry-kube-stack-0.3.10 app.kubernetes.io/version: "0.107.0" app.kubernetes.io/managed-by: Helm release: "example" diff --git a/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/hooks.yaml b/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/hooks.yaml index 9c6738ffd..8669ce38a 100644 --- a/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/hooks.yaml +++ b/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/hooks.yaml @@ -56,10 +56,10 @@ spec: serviceAccountName: delete-resources-sa containers: - name: delete-resources - image: bitnami/kubectl:latest + image: "bitnami/kubectl:latest" command: - /bin/sh - -c - | kubectl delete instrumentations,opampbridges,opentelemetrycollectors \ - -l helm.sh/chart=opentelemetry-kube-stack-0.3.9 + -l helm.sh/chart=opentelemetry-kube-stack-0.3.10 diff --git a/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/instrumentation.yaml b/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/instrumentation.yaml index a03c24d72..f67098f0f 100644 --- a/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/instrumentation.yaml +++ b/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/instrumentation.yaml @@ -5,7 +5,7 @@ kind: Instrumentation metadata: name: example labels: - helm.sh/chart: opentelemetry-kube-stack-0.3.9 + helm.sh/chart: opentelemetry-kube-stack-0.3.10 app.kubernetes.io/version: "0.107.0" app.kubernetes.io/managed-by: Helm release: "example" diff --git a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/collector.yaml b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/collector.yaml index 36f4a8145..624853d3c 100644 --- a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/collector.yaml +++ b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/collector.yaml @@ -6,7 +6,7 @@ metadata: name: example-daemon namespace: default labels: - helm.sh/chart: opentelemetry-kube-stack-0.3.9 + helm.sh/chart: opentelemetry-kube-stack-0.3.10 app.kubernetes.io/version: "0.107.0" app.kubernetes.io/managed-by: Helm release: "example" diff --git a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-api-server/servicemonitor.yaml b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-api-server/servicemonitor.yaml index c4cbb7e90..4e25e3800 100644 --- a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-api-server/servicemonitor.yaml +++ b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-api-server/servicemonitor.yaml @@ -7,7 +7,7 @@ metadata: namespace: default labels: app: opentelemetry-kube-stack-apiserver - helm.sh/chart: opentelemetry-kube-stack-0.3.9 + helm.sh/chart: opentelemetry-kube-stack-0.3.10 app.kubernetes.io/version: "0.107.0" app.kubernetes.io/managed-by: Helm release: "example" diff --git a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-controller-manager/service.yaml b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-controller-manager/service.yaml index e95fdae56..b9f5c1fcf 100644 --- a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-controller-manager/service.yaml +++ b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-controller-manager/service.yaml @@ -7,7 +7,7 @@ metadata: labels: app: opentelemetry-kube-stack-kube-controller-manager jobLabel: kube-controller-manager - helm.sh/chart: opentelemetry-kube-stack-0.3.9 + helm.sh/chart: opentelemetry-kube-stack-0.3.10 app.kubernetes.io/version: "0.107.0" app.kubernetes.io/managed-by: Helm release: "example" diff --git a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-controller-manager/servicemonitor.yaml b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-controller-manager/servicemonitor.yaml index 1bf75801c..c239de5b4 100644 --- a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-controller-manager/servicemonitor.yaml +++ b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-controller-manager/servicemonitor.yaml @@ -7,7 +7,7 @@ metadata: namespace: default labels: app: opentelemetry-kube-stack-kube-controller-manager - helm.sh/chart: opentelemetry-kube-stack-0.3.9 + helm.sh/chart: opentelemetry-kube-stack-0.3.10 app.kubernetes.io/version: "0.107.0" app.kubernetes.io/managed-by: Helm release: "example" diff --git a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-dns/service.yaml b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-dns/service.yaml index 17ab69d7d..6d8f069c6 100644 --- a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-dns/service.yaml +++ b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-dns/service.yaml @@ -7,7 +7,7 @@ metadata: labels: app: opentelemetry-kube-stack-kube-dns jobLabel: kube-dns - helm.sh/chart: opentelemetry-kube-stack-0.3.9 + helm.sh/chart: opentelemetry-kube-stack-0.3.10 app.kubernetes.io/version: "0.107.0" app.kubernetes.io/managed-by: Helm release: "example" diff --git a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-dns/servicemonitor.yaml b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-dns/servicemonitor.yaml index bd6cc017d..cde4f14fa 100644 --- a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-dns/servicemonitor.yaml +++ b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-dns/servicemonitor.yaml @@ -7,7 +7,7 @@ metadata: namespace: default labels: app: opentelemetry-kube-stack-kube-dns - helm.sh/chart: opentelemetry-kube-stack-0.3.9 + helm.sh/chart: opentelemetry-kube-stack-0.3.10 app.kubernetes.io/version: "0.107.0" app.kubernetes.io/managed-by: Helm release: "example" diff --git a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-etcd/service.yaml b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-etcd/service.yaml index 9ed4bc725..122425ca7 100644 --- a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-etcd/service.yaml +++ b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-etcd/service.yaml @@ -7,7 +7,7 @@ metadata: labels: app: opentelemetry-kube-stack-kube-etcd jobLabel: kube-etcd - helm.sh/chart: opentelemetry-kube-stack-0.3.9 + helm.sh/chart: opentelemetry-kube-stack-0.3.10 app.kubernetes.io/version: "0.107.0" app.kubernetes.io/managed-by: Helm release: "example" diff --git a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-etcd/servicemonitor.yaml b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-etcd/servicemonitor.yaml index f2fde8dec..4a2e1d666 100644 --- a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-etcd/servicemonitor.yaml +++ b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-etcd/servicemonitor.yaml @@ -7,7 +7,7 @@ metadata: namespace: default labels: app: opentelemetry-kube-stack-kube-etcd - helm.sh/chart: opentelemetry-kube-stack-0.3.9 + helm.sh/chart: opentelemetry-kube-stack-0.3.10 app.kubernetes.io/version: "0.107.0" app.kubernetes.io/managed-by: Helm release: "example" diff --git a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-proxy/service.yaml b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-proxy/service.yaml index 550573dc0..e96b76dc4 100644 --- a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-proxy/service.yaml +++ b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-proxy/service.yaml @@ -7,7 +7,7 @@ metadata: labels: app: opentelemetry-kube-stack-kube-proxy jobLabel: kube-proxy - helm.sh/chart: opentelemetry-kube-stack-0.3.9 + helm.sh/chart: opentelemetry-kube-stack-0.3.10 app.kubernetes.io/version: "0.107.0" app.kubernetes.io/managed-by: Helm release: "example" diff --git a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-proxy/servicemonitor.yaml b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-proxy/servicemonitor.yaml index 19a539db7..5020735e3 100644 --- a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-proxy/servicemonitor.yaml +++ b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-proxy/servicemonitor.yaml @@ -7,7 +7,7 @@ metadata: namespace: default labels: app: opentelemetry-kube-stack-kube-proxy - helm.sh/chart: opentelemetry-kube-stack-0.3.9 + helm.sh/chart: opentelemetry-kube-stack-0.3.10 app.kubernetes.io/version: "0.107.0" app.kubernetes.io/managed-by: Helm release: "example" diff --git a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-scheduler/service.yaml b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-scheduler/service.yaml index fa3ff926c..9274864b6 100644 --- a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-scheduler/service.yaml +++ b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-scheduler/service.yaml @@ -7,7 +7,7 @@ metadata: labels: app: opentelemetry-kube-stack-kube-scheduler jobLabel: kube-scheduler - helm.sh/chart: opentelemetry-kube-stack-0.3.9 + helm.sh/chart: opentelemetry-kube-stack-0.3.10 app.kubernetes.io/version: "0.107.0" app.kubernetes.io/managed-by: Helm release: "example" diff --git a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-scheduler/servicemonitor.yaml b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-scheduler/servicemonitor.yaml index ac7bef196..cc47841ac 100644 --- a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-scheduler/servicemonitor.yaml +++ b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/exporters/kube-scheduler/servicemonitor.yaml @@ -7,7 +7,7 @@ metadata: namespace: default labels: app: opentelemetry-kube-stack-kube-scheduler - helm.sh/chart: opentelemetry-kube-stack-0.3.9 + helm.sh/chart: opentelemetry-kube-stack-0.3.10 app.kubernetes.io/version: "0.107.0" app.kubernetes.io/managed-by: Helm release: "example" diff --git a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/hooks.yaml b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/hooks.yaml index 9c6738ffd..8669ce38a 100644 --- a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/hooks.yaml +++ b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/hooks.yaml @@ -56,10 +56,10 @@ spec: serviceAccountName: delete-resources-sa containers: - name: delete-resources - image: bitnami/kubectl:latest + image: "bitnami/kubectl:latest" command: - /bin/sh - -c - | kubectl delete instrumentations,opampbridges,opentelemetrycollectors \ - -l helm.sh/chart=opentelemetry-kube-stack-0.3.9 + -l helm.sh/chart=opentelemetry-kube-stack-0.3.10 diff --git a/charts/opentelemetry-kube-stack/templates/hooks.yaml b/charts/opentelemetry-kube-stack/templates/hooks.yaml index 95c7898d5..7d1845ddc 100644 --- a/charts/opentelemetry-kube-stack/templates/hooks.yaml +++ b/charts/opentelemetry-kube-stack/templates/hooks.yaml @@ -53,7 +53,11 @@ spec: serviceAccountName: delete-resources-sa containers: - name: delete-resources - image: bitnami/kubectl:latest + {{- if $.Values.cleanupJob.image.digest }} + image: "{{ $.Values.cleanupJob.image.repository }}@{{ $.Values.cleanupJob.image.digest }}" + {{- else }} + image: "{{ $.Values.cleanupJob.image.repository }}:{{ $.Values.cleanupJob.image.tag }}" + {{- end }} command: - /bin/sh - -c diff --git a/charts/opentelemetry-kube-stack/values.yaml b/charts/opentelemetry-kube-stack/values.yaml index a633e465f..0e4470221 100644 --- a/charts/opentelemetry-kube-stack/values.yaml +++ b/charts/opentelemetry-kube-stack/values.yaml @@ -15,6 +15,12 @@ cleanupJob: # For non-helm installations i.e. ones created via helm template, it may make sense to disable this. # For those installations, ensure that uninstallation for the operator happens _after_ the deletion of the CRs. enabled: true + # Image details for the kubectl + image: + repository: bitnami/kubectl + tag: latest + # When digest is set to a non-empty value, images will be pulled by digest (regardless of tag value). + digest: "" # Should the CRDs be installed by this chart. crds: