Skip to content

Commit

Permalink
Configure webhook if enabled
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Feb 11, 2024
1 parent 8dc36af commit 9aca7d8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions charts/petset/templates/rbac/auth_proxy.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if or .Values.apiserver.enableMutatingWebhook .Values.apiserver.enableValidatingWebhook }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
Expand All @@ -16,6 +17,7 @@ rules:
verbs:
- create
---

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
Expand All @@ -28,3 +30,4 @@ subjects:
- kind: ServiceAccount
name: {{ include "petset.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{ end }}
2 changes: 2 additions & 0 deletions charts/petset/templates/webhook-server/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{- $major := default "0" .Capabilities.KubeVersion.Major | trimSuffix "+" | int64 }}
{{- $minor := default "0" .Capabilities.KubeVersion.Minor | trimSuffix "+" | int64 }}
{{- $criticalAddon := and .Values.criticalAddon (or (eq .Release.Namespace "kube-system") (and (ge $major 1) (ge $minor 17))) -}}
{{- if or .Values.apiserver.enableMutatingWebhook .Values.apiserver.enableValidatingWebhook }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -120,3 +121,4 @@ spec:
{{- if $criticalAddon }}
priorityClassName: system-cluster-critical
{{- end -}}
{{ end }}
2 changes: 2 additions & 0 deletions charts/petset/templates/webhook-server/service.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if or .Values.apiserver.enableMutatingWebhook .Values.apiserver.enableValidatingWebhook }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -23,3 +24,4 @@ spec:
port: 443
protocol: TCP
targetPort: 9443
{{ end }}
2 changes: 2 additions & 0 deletions charts/petset/templates/webhook-server/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if or .Values.apiserver.enableMutatingWebhook .Values.apiserver.enableValidatingWebhook }}
{{- if eq .Values.monitoring.agent "prometheus.io/operator" }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
Expand Down Expand Up @@ -33,3 +34,4 @@ spec:
serverName: "{{ include "petset.fullname" . }}.{{ .Release.Namespace }}.svc"
{{- end }}
{{- end }}
{{ end }}

0 comments on commit 9aca7d8

Please sign in to comment.