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 a pre-install Helm hook to ensure InPlacePodVerticalScaling is enabled #26

Merged
merged 1 commit into from
Mar 24, 2024
Merged
Changes from all 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
67 changes: 67 additions & 0 deletions helm/templates/pre-install-hook-check-feature-gate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: check-in-place-pod-vertical-scaling-enabled
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "-3"
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: get-kubernetes-metrics
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "-3"
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
rules:
- nonResourceURLs:
- "/metrics"
verbs:
- "get"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: check-in-place-pod-vertical-scaling-enabled
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "-2"
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: get-kubernetes-metrics
subjects:
- kind: ServiceAccount
name: check-in-place-pod-vertical-scaling-enabled
namespace: {{ .Release.Namespace }}
---
apiVersion: v1
kind: Pod
metadata:
name: check-in-place-pod-vertical-scaling-enabled
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "-1"
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
spec:
serviceAccountName: check-in-place-pod-vertical-scaling-enabled
restartPolicy: Never
containers:
- name: check-in-place-pod-vertical-scaling-enabled
image: "bitnami/kubectl"
command:
- sh
- -c
- |
if ! kubectl get --raw /metrics | grep -q -E '^kubernetes_feature_enabled.*name="InPlacePodVerticalScaling".*1$'
then
printf "InPlacePodVerticalScaling feature gate is required to install this chart, see README." | tee /dev/termination-log
exit 1
fi

printf "InPlacePodVerticalScaling feature gate is enabled; will continue!" | tee /dev/termination-log
terminationMessagePath: /dev/termination-log
Loading