Skip to content

Commit

Permalink
feat: Allow to change port for Webhooks and add hostnetwork (#470)
Browse files Browse the repository at this point in the history
Signed-off-by: Mathieu Cantin <103442330+mcantinqc@users.noreply.github.com>
  • Loading branch information
mcantinqc authored Jun 22, 2023
1 parent 39b2a7f commit 36db5aa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
13 changes: 9 additions & 4 deletions keda/templates/webhooks/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
app: {{ .Values.webhooks.name }}
name: {{ .Values.webhooks.name }}
app.kubernetes.io/name: {{ .Values.webhooks.name }}
{{- include "keda.labels" . | indent 8 }}
{{- include "keda.labels" . | indent 8 }}
{{- if .Values.podLabels.webhooks }}
{{- toYaml .Values.podLabels.webhooks | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -69,6 +69,10 @@ spec:
- "--zap-encoder={{ .Values.logging.webhooks.format }}"
- "--zap-time-encoding={{ .Values.logging.webhooks.timeEncoding }}"
- "--cert-dir={{ .Values.certificates.mountPath }}"
- "--health-probe-bind-address=:{{ .Values.webhooks.healthProbePort }}"
{{- if .Values.webhooks.port }}
- "--port={{ .Values.webhooks.port }}"
{{- end }}
{{- if .Values.prometheus.webhooks.enabled }}
- --metrics-bind-address=:{{ .Values.prometheus.webhooks.port }}
{{- end }}
Expand All @@ -79,15 +83,15 @@ spec:
livenessProbe:
httpGet:
path: /healthz
port: 8081
port: {{ .Values.webhooks.healthProbePort }}
initialDelaySeconds: 25
readinessProbe:
httpGet:
path: /readyz
port: 8081
port: {{ .Values.webhooks.healthProbePort }}
initialDelaySeconds: 20
ports:
- containerPort: 9443
- containerPort: {{ .Values.webhooks.port | default 9443 }}
name: http
protocol: TCP
{{- if .Values.prometheus.webhooks.enabled }}
Expand Down Expand Up @@ -130,6 +134,7 @@ spec:
{{- if .Values.volumes.webhooks.extraVolumes }}
{{- toYaml .Values.volumes.webhooks.extraVolumes | nindent 8 }}
{{- end }}
hostNetwork: {{ .Values.metricsServer.useHostNetwork }}
nodeSelector:
kubernetes.io/os: linux
{{- with .Values.nodeSelector }}
Expand Down
2 changes: 1 addition & 1 deletion keda/templates/webhooks/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
- name: http
port: 443
protocol: TCP
targetPort: 9443
targetPort: {{ .Values.webhooks.port | default 9443 }}
{{- if .Values.prometheus.webhooks.enabled }}
- name: {{ .Values.prometheus.webhooks.serviceMonitor.port }}
port: {{ .Values.prometheus.webhooks.port }}
Expand Down
10 changes: 8 additions & 2 deletions keda/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ metricsServer:
webhooks:
# -- Enable admission webhooks (this feature option will be removed in v2.12)
enabled: true
# -- Port number to use for KEDA admission webhooks. Default is 9443.
port: ""
# -- Port number to use for KEDA admission webhooks health probe
healthProbePort: 8081
# -- Enable webhook to use host network, this is required on EKS with custom CNI
useHostNetwork: false
# -- Name of the KEDA admission webhooks
name: keda-admission-webhooks
# -- Capability to configure the number of replicas for KEDA admission webhooks
Expand Down Expand Up @@ -224,8 +230,8 @@ podIdentity:
# This will be set as a annotation on the KEDA service account.
enabled: false
# -- GCP IAM Service Account Email which you would like to use for workload identity.
gcpIAMServiceAccount: ""
gcpIAMServiceAccount: ""

# -- Set this if you are using an external scaler and want to communicate
# over TLS (recommended). This variable holds the name of the secret that
# will be mounted to the /grpccerts path on the Pod
Expand Down

0 comments on commit 36db5aa

Please sign in to comment.