Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add uninstall hook for the kube-stack chart #1305

Merged
merged 28 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/kube-stack-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
TylerHelmuth marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion charts/opentelemetry-kube-stack/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
clusterName: demo
opentelemetry-operator:
enabled: true
collectors:
daemon:
ports:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
clusterName: demo
opentelemetry-operator:
enabled: true
collectors:
daemon:
enabled: true
Expand Down
63 changes: 63 additions & 0 deletions charts/opentelemetry-kube-stack/templates/hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{{- if .Values.cleanupJob.enabled }}
---
apiVersion: v1
kind: ServiceAccount
TylerHelmuth marked this conversation as resolved.
Show resolved Hide resolved
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 }}
8 changes: 8 additions & 0 deletions charts/opentelemetry-kube-stack/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3827,6 +3827,14 @@
}
},
"properties": {
"cleanupJob": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
}
}
},
"crds": {
"type": "object",
"properties": {
Expand Down
Loading
Loading