diff --git a/.github/workflows/kube-stack-test.yaml b/.github/workflows/kube-stack-test.yaml index 6e6288988..a6815aff7 100644 --- a/.github/workflows/kube-stack-test.yaml +++ b/.github/workflows/kube-stack-test.yaml @@ -28,5 +28,7 @@ jobs: kubectl wait --timeout=5m --for=condition=available deployment cert-manager -n cert-manager kubectl wait --timeout=5m --for=condition=available deployment cert-manager-webhook -n cert-manager - - name: Run chart-testing (install) - run: ct install --charts charts/opentelemetry-kube-stack + - name: Run Helm Install + run: | + helm dep build charts/opentelemetry-kube-stack + helm install opentelemetry-kube-stack charts/opentelemetry-kube-stack diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index a4c466ea8..d20ca5329 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -17,7 +17,7 @@ jobs: uses: ./.github/actions/setup with: create-kind-cluster: "false" - helm-version: v3.11.3 + helm-version: "v3.11.3" - name: Run chart-testing (lint) run: "ct lint --target-branch main diff --git a/charts/opentelemetry-kube-stack/Chart.yaml b/charts/opentelemetry-kube-stack/Chart.yaml index 0cda6d890..133d87dca 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.1.2 +version: 0.1.3 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 8564092af..0857ce3ff 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.1.2 + helm.sh/chart: opentelemetry-kube-stack-0.1.3 app.kubernetes.io/version: "0.105.0" app.kubernetes.io/managed-by: Helm spec: 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 9ba3e4ddc..10137921d 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.1.2 + helm.sh/chart: opentelemetry-kube-stack-0.1.3 app.kubernetes.io/version: "0.105.0" app.kubernetes.io/managed-by: Helm opentelemetry.io/opamp-reporting: "true" @@ -189,7 +189,7 @@ metadata: name: example-daemon namespace: default labels: - helm.sh/chart: opentelemetry-kube-stack-0.1.2 + helm.sh/chart: opentelemetry-kube-stack-0.1.3 app.kubernetes.io/version: "0.105.0" app.kubernetes.io/managed-by: Helm opentelemetry.io/opamp-reporting: "true" diff --git a/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/hooks.yaml b/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/hooks.yaml new file mode 100644 index 000000000..aa31a6136 --- /dev/null +++ b/charts/opentelemetry-kube-stack/examples/cloud-demo/rendered/hooks.yaml @@ -0,0 +1,65 @@ +--- +# Source: opentelemetry-kube-stack/templates/hooks.yaml +apiVersion: v1 +kind: ServiceAccount +metadata: + name: delete-resources-sa + annotations: + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +--- +# Source: opentelemetry-kube-stack/templates/hooks.yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: delete-resources-role + annotations: + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +rules: + - apiGroups: + - opentelemetry.io + resources: + - instrumentations + - opampbridges + - opentelemetrycollectors + verbs: + - get + - list + - delete +--- +# Source: opentelemetry-kube-stack/templates/hooks.yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: delete-resources-rolebinding + annotations: + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: delete-resources-role +subjects: + - kind: ServiceAccount + name: delete-resources-sa +--- +# Source: opentelemetry-kube-stack/templates/hooks.yaml +apiVersion: batch/v1 +kind: Job +metadata: + name: opentelemetry-kube-stack-pre-delete-job + annotations: + "helm.sh/hook": pre-delete + "helm.sh/hook-delete-policy": hook-succeeded,hook-failed +spec: + template: + spec: + restartPolicy: Never + serviceAccountName: delete-resources-sa + containers: + - name: delete-resources + image: bitnami/kubectl:latest + command: + - /bin/sh + - -c + - | + kubectl delete instrumentations,opampbridges,opentelemetrycollectors \ + -l helm.sh/chart=opentelemetry-kube-stack-0.1.3 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 0277b17ca..646a2696f 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.1.2 + helm.sh/chart: opentelemetry-kube-stack-0.1.3 app.kubernetes.io/version: "0.105.0" app.kubernetes.io/managed-by: Helm spec: diff --git a/charts/opentelemetry-kube-stack/examples/cloud-demo/values.yaml b/charts/opentelemetry-kube-stack/examples/cloud-demo/values.yaml index 75cc5e9c2..85099bc50 100644 --- a/charts/opentelemetry-kube-stack/examples/cloud-demo/values.yaml +++ b/charts/opentelemetry-kube-stack/examples/cloud-demo/values.yaml @@ -1,6 +1,4 @@ clusterName: demo -opentelemetry-operator: - enabled: true collectors: daemon: ports: 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 523fcbb29..642c2b822 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.1.2 + helm.sh/chart: opentelemetry-kube-stack-0.1.3 app.kubernetes.io/version: "0.105.0" app.kubernetes.io/managed-by: Helm spec: 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 930645aa6..72f491005 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.1.2 + helm.sh/chart: opentelemetry-kube-stack-0.1.3 app.kubernetes.io/version: "0.105.0" app.kubernetes.io/managed-by: Helm spec: 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 7c2671129..5b2a51ed3 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.1.2 + helm.sh/chart: opentelemetry-kube-stack-0.1.3 app.kubernetes.io/version: "0.105.0" app.kubernetes.io/managed-by: Helm namespace: kube-system 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 43ed0ada6..621930ab3 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.1.2 + helm.sh/chart: opentelemetry-kube-stack-0.1.3 app.kubernetes.io/version: "0.105.0" app.kubernetes.io/managed-by: Helm spec: 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 6ff350874..eefda8d5f 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.1.2 + helm.sh/chart: opentelemetry-kube-stack-0.1.3 app.kubernetes.io/version: "0.105.0" app.kubernetes.io/managed-by: Helm namespace: kube-system 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 ad5ab3943..a76a39484 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.1.2 + helm.sh/chart: opentelemetry-kube-stack-0.1.3 app.kubernetes.io/version: "0.105.0" app.kubernetes.io/managed-by: Helm spec: 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 3ab63740b..0fd227631 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.1.2 + helm.sh/chart: opentelemetry-kube-stack-0.1.3 app.kubernetes.io/version: "0.105.0" app.kubernetes.io/managed-by: Helm namespace: kube-system 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 73348c36f..d487a5e24 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.1.2 + helm.sh/chart: opentelemetry-kube-stack-0.1.3 app.kubernetes.io/version: "0.105.0" app.kubernetes.io/managed-by: Helm spec: 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 ea1a9ff26..1a4c73dea 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.1.2 + helm.sh/chart: opentelemetry-kube-stack-0.1.3 app.kubernetes.io/version: "0.105.0" app.kubernetes.io/managed-by: Helm namespace: kube-system 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 c3eb42400..0a7c28915 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.1.2 + helm.sh/chart: opentelemetry-kube-stack-0.1.3 app.kubernetes.io/version: "0.105.0" app.kubernetes.io/managed-by: Helm spec: 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 4b830ebc8..f3659311b 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.1.2 + helm.sh/chart: opentelemetry-kube-stack-0.1.3 app.kubernetes.io/version: "0.105.0" app.kubernetes.io/managed-by: Helm namespace: kube-system 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 4a5f05f6d..4c7eb6a98 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.1.2 + helm.sh/chart: opentelemetry-kube-stack-0.1.3 app.kubernetes.io/version: "0.105.0" app.kubernetes.io/managed-by: Helm spec: diff --git a/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/hooks.yaml b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/hooks.yaml new file mode 100644 index 000000000..aa31a6136 --- /dev/null +++ b/charts/opentelemetry-kube-stack/examples/prometheus-otel/rendered/hooks.yaml @@ -0,0 +1,65 @@ +--- +# Source: opentelemetry-kube-stack/templates/hooks.yaml +apiVersion: v1 +kind: ServiceAccount +metadata: + name: delete-resources-sa + annotations: + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +--- +# Source: opentelemetry-kube-stack/templates/hooks.yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: delete-resources-role + annotations: + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +rules: + - apiGroups: + - opentelemetry.io + resources: + - instrumentations + - opampbridges + - opentelemetrycollectors + verbs: + - get + - list + - delete +--- +# Source: opentelemetry-kube-stack/templates/hooks.yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: delete-resources-rolebinding + annotations: + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: delete-resources-role +subjects: + - kind: ServiceAccount + name: delete-resources-sa +--- +# Source: opentelemetry-kube-stack/templates/hooks.yaml +apiVersion: batch/v1 +kind: Job +metadata: + name: opentelemetry-kube-stack-pre-delete-job + annotations: + "helm.sh/hook": pre-delete + "helm.sh/hook-delete-policy": hook-succeeded,hook-failed +spec: + template: + spec: + restartPolicy: Never + serviceAccountName: delete-resources-sa + containers: + - name: delete-resources + image: bitnami/kubectl:latest + command: + - /bin/sh + - -c + - | + kubectl delete instrumentations,opampbridges,opentelemetrycollectors \ + -l helm.sh/chart=opentelemetry-kube-stack-0.1.3 diff --git a/charts/opentelemetry-kube-stack/examples/prometheus-otel/values.yaml b/charts/opentelemetry-kube-stack/examples/prometheus-otel/values.yaml index 66c3bc1b4..57e3a544f 100644 --- a/charts/opentelemetry-kube-stack/examples/prometheus-otel/values.yaml +++ b/charts/opentelemetry-kube-stack/examples/prometheus-otel/values.yaml @@ -1,6 +1,4 @@ clusterName: demo -opentelemetry-operator: - enabled: true collectors: daemon: enabled: true diff --git a/charts/opentelemetry-kube-stack/templates/hooks.yaml b/charts/opentelemetry-kube-stack/templates/hooks.yaml new file mode 100644 index 000000000..95c7898d5 --- /dev/null +++ b/charts/opentelemetry-kube-stack/templates/hooks.yaml @@ -0,0 +1,63 @@ +{{- if .Values.cleanupJob.enabled }} +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: delete-resources-sa + annotations: + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: delete-resources-role + annotations: + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +rules: + - apiGroups: + - opentelemetry.io + resources: + - instrumentations + - opampbridges + - opentelemetrycollectors + verbs: + - get + - list + - delete +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: delete-resources-rolebinding + annotations: + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: delete-resources-role +subjects: + - kind: ServiceAccount + name: delete-resources-sa +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ include "opentelemetry-kube-stack.name" . }}-pre-delete-job + annotations: + "helm.sh/hook": pre-delete + "helm.sh/hook-delete-policy": hook-succeeded,hook-failed +spec: + template: + spec: + restartPolicy: Never + serviceAccountName: delete-resources-sa + containers: + - name: delete-resources + image: bitnami/kubectl:latest + command: + - /bin/sh + - -c + - | + kubectl delete instrumentations,opampbridges,opentelemetrycollectors \ + -l helm.sh/chart={{ include "opentelemetry-kube-stack.chart" . }} +{{- end }} diff --git a/charts/opentelemetry-kube-stack/values.schema.json b/charts/opentelemetry-kube-stack/values.schema.json index f79d5d855..f37ef4ad0 100644 --- a/charts/opentelemetry-kube-stack/values.schema.json +++ b/charts/opentelemetry-kube-stack/values.schema.json @@ -3827,6 +3827,14 @@ } }, "properties": { + "cleanupJob": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + } + } + }, "crds": { "type": "object", "properties": { diff --git a/charts/opentelemetry-kube-stack/values.yaml b/charts/opentelemetry-kube-stack/values.yaml index cda2bcaf1..ab63ff236 100644 --- a/charts/opentelemetry-kube-stack/values.yaml +++ b/charts/opentelemetry-kube-stack/values.yaml @@ -9,6 +9,13 @@ clusterName: "" # Extra environment variables to add to each collector, bridge and instrumentation extraEnvs: [] +# Enables a cleanup job to make sure the CRs are uninstalled before the operator +cleanupJob: + # It is recommended to always keep this enabled so that running helm uninstall works properly. + # 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 + # Should the CRDs be installed by this chart. crds: # Should the CRDs be installed @@ -17,8 +24,7 @@ crds: # Top level field related to the OpenTelemetry Operator opentelemetry-operator: # Field indicating whether the operator is enabled or not - # This is disabled for now while the chart is under development - enabled: false + enabled: true manager: collectorImage: repository: otel/opentelemetry-collector-k8s