Skip to content

Commit

Permalink
better support for the validatingWebhook
Browse files Browse the repository at this point in the history
Signed-off-by: Travis Glenn Hansen <[email protected]>
  • Loading branch information
travisghansen committed Aug 2, 2022
1 parent a8fa3ad commit baf7762
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 6 deletions.
2 changes: 1 addition & 1 deletion stable/snapshot-controller/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.4
version: 0.2.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.rbac.enabled }}
{{- if .Values.controller.rbac.enabled }}
# RBAC file for the snapshot controller.
#
# The snapshot controller implements the control loop for CSI snapshot functionality.
Expand Down
36 changes: 36 additions & 0 deletions stable/snapshot-controller/templates/rbac-snapshot-webhook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{{- if .Values.validatingWebhook.rbac.enabled }}
# RBAC file for the snapshot webhook.
#
# The snapshot webhook implements the validation and admission for CSI snapshot functionality.
# It should be installed as part of the base Kubernetes distribution in an appropriate
# namespace for components implementing base system functionality. For installing with
# Vanilla Kubernetes, kube-system makes sense for the namespace.

apiVersion: v1
kind: ServiceAccount
metadata:
name: snapshot-webhook
namespace: {{ .Release.Namespace | quote }}
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: snapshot-webhook-runner
rules:
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotclasses"]
verbs: ["get", "list", "watch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: snapshot-webhook-role
subjects:
- kind: ServiceAccount
name: snapshot-webhook
namespace: {{ .Release.Namespace | quote }}
roleRef:
kind: ClusterRole
name: snapshot-webhook-runner
apiGroup: rbac.authorization.k8s.io
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
labels:
app: snapshot-controller
spec:
{{- if .Values.rbac.enabled }}
{{- if .Values.controller.rbac.enabled }}
serviceAccount: snapshot-controller
{{- end }}
containers:
Expand Down
3 changes: 3 additions & 0 deletions stable/snapshot-controller/templates/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ spec:
labels:
app: snapshot-validation
spec:
{{- if .Values.validatingWebhook.rbac.enabled }}
serviceAccountName: snapshot-webhook
{{- end }}
containers:
- name: snapshot-validation
image: {{ .Values.validatingWebhook.image.repository }}:{{ .Values.validatingWebhook.image.tag }}
Expand Down
9 changes: 6 additions & 3 deletions stable/snapshot-controller/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

rbac:
enabled: true

controller:
enabled: true
rbac:
enabled: true

replicaCount: 3
image:
repository: k8s.gcr.io/sig-storage/snapshot-controller
Expand All @@ -27,10 +28,12 @@ controller:

validatingWebhook:
enabled: false
rbac:
enabled: true
replicaCount: 3
image:
repository: k8s.gcr.io/sig-storage/snapshot-validation-webhook
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: v5.0.1
tag: v6.0.1

0 comments on commit baf7762

Please sign in to comment.