Skip to content

Commit

Permalink
fix: put webhook disable option back (aws#6534)
Browse files Browse the repository at this point in the history
  • Loading branch information
rschalo authored Jul 23, 2024
1 parent 6f881e9 commit 604abe5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/karpenter/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ rules:
# Write
- apiGroups: ["karpenter.k8s.aws"]
resources: ["ec2nodeclasses", "ec2nodeclasses/status"]
verbs: ["patch", "update"]
verbs: ["patch", "update"]
6 changes: 6 additions & 0 deletions charts/karpenter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,14 @@ spec:
value: "1.19.0-0"
- name: KARPENTER_SERVICE
value: {{ include "karpenter.fullname" . }}
{{- if .Values.webhook.enabled }}
- name: WEBHOOK_PORT
value: "{{ .Values.webhook.port }}"
- name: WEBHOOK_METRICS_PORT
value: "{{ .Values.webhook.metrics.port }}"
{{- end }}
- name: DISABLE_WEBHOOK
value: "{{ not .Values.webhook.enabled }}"
{{- with .Values.logLevel }}
- name: LOG_LEVEL
value: "{{ . }}"
Expand Down Expand Up @@ -155,12 +159,14 @@ spec:
- name: http-metrics
containerPort: {{ .Values.controller.metrics.port }}
protocol: TCP
{{- if .Values.webhook.enabled }}
- name: webhook-metrics
containerPort: {{ .Values.webhook.metrics.port }}
protocol: TCP
- name: https-webhook
containerPort: {{ .Values.webhook.port }}
protocol: TCP
{{- end }}
- name: http
containerPort: {{ .Values.controller.healthProbe.port }}
protocol: TCP
Expand Down
4 changes: 4 additions & 0 deletions charts/karpenter/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@ rules:
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "watch"]
{{- if .Values.webhook.enabled }}
- apiGroups: [""]
resources: ["configmaps", "secrets"]
verbs: ["get", "list", "watch"]
{{- end }}
# Write
{{- if .Values.webhook.enabled }}
- apiGroups: [""]
resources: ["secrets"]
verbs: ["update"]
resourceNames:
- "{{ include "karpenter.fullname" . }}-cert"
{{- end }}
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["patch", "update"]
Expand Down
2 changes: 2 additions & 0 deletions charts/karpenter/templates/secret-webhook-cert.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.webhook.enabled }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -10,3 +11,4 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
# data: {} # Injected by karpenter-webhook
{{- end }}
2 changes: 2 additions & 0 deletions charts/karpenter/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ spec:
port: {{ .Values.controller.metrics.port }}
targetPort: http-metrics
protocol: TCP
{{- if .Values.webhook.enabled }}
- name: webhook-metrics
port: {{ .Values.webhook.metrics.port }}
targetPort: webhook-metrics
Expand All @@ -24,5 +25,6 @@ spec:
port: {{ .Values.webhook.port }}
targetPort: https-webhook
protocol: TCP
{{- end }}
selector:
{{- include "karpenter.selectorLabels" . | nindent 4 }}
2 changes: 2 additions & 0 deletions charts/karpenter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ controller:
# -- The container port to use for http health probe.
port: 8081
webhook:
# -- Whether to enable the webhooks and webhook permissions.
enabled: true
# -- The container port to use for the webhook.
port: 8443
metrics:
Expand Down

0 comments on commit 604abe5

Please sign in to comment.