Skip to content

Commit

Permalink
allow helm chart to override failurePolicy (#1417)
Browse files Browse the repository at this point in the history
Signed-off-by: Heba Elayoty <hebaelayoty@gmail.com>

Co-authored-by: Sertaç Özercan <852750+sozercan@users.noreply.github.com>
Co-authored-by: Max Smythe <smythe@google.com>
  • Loading branch information
3 people committed Jul 10, 2021
1 parent d9495ad commit b791188
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cmd/build/helmify/kustomize-for-helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ webhooks:
path: /v1/admit
name: validation.gatekeeper.sh
timeoutSeconds: HELMSUBST_VALIDATING_WEBHOOK_TIMEOUT
failurePolicy: HELMSUBST_VALIDATING_WEBHOOK_FAILURE_POLICY
rules:
- apiGroups:
- "*"
Expand All @@ -163,6 +164,7 @@ webhooks:
path: /v1/admitlabel
name: check-ignore-label.gatekeeper.sh
timeoutSeconds: HELMSUBST_VALIDATING_WEBHOOK_TIMEOUT
failurePolicy: HELMSUBST_VALIDATING_WEBHOOK_CHECK_IGNORE_FAILURE_POLICY
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
Expand Down
4 changes: 4 additions & 0 deletions cmd/build/helmify/replacements.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ var replacements = map[string]string{

"HELMSUBST_VALIDATING_WEBHOOK_TIMEOUT": `{{ .Values.validatingWebhookTimeoutSeconds }}`,

"HELMSUBST_VALIDATING_WEBHOOK_FAILURE_POLICY": `{{ .Values.validatingWebhookFailurePolicy }}`,

"HELMSUBST_VALIDATING_WEBHOOK_CHECK_IGNORE_FAILURE_POLICY": `{{ .Values.validatingWebhookCheckIgnoreFailurePolicy }}`,

"HELMSUBST_RESOURCEQUOTA_POD_LIMIT": `{{ .Values.podCountLimit }}`,

"HELMSUBST_VALIDATING_WEBHOOK_OPERATION_RULES": `
Expand Down
2 changes: 2 additions & 0 deletions cmd/build/helmify/static/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ _See [Exempting Namespaces](https://open-policy-agent.github.io/gatekeeper/websi
| auditMatchKindOnly | Only check resources of the kinds specified in all constraints defined in the cluster. | `false` |
| disableValidatingWebhook | Disable the validating webhook | `false` |
| validatingWebhookTimeoutSeconds | The timeout for the validating webhook in seconds | `3` |
| validatingWebhookFailurePolicy | The failurePolicy for the validating webhook | `Ignore` |
| validatingWebhookCheckIgnoreFailurePolicy | The failurePolicy for the check-ignore-label validating webhook | `Fail` |
| enableDeleteOperations | Enable validating webhook for delete operations | `false` |
| experimentalEnableMutation | Enable mutation (alpha feature) | `false` |
| emitAdmissionEvents | Emit K8s events in gatekeeper namespace for admission violations (alpha feature) | `false` |
Expand Down
2 changes: 2 additions & 0 deletions cmd/build/helmify/static/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ constraintViolationsLimit: 20
auditFromCache: false
disableValidatingWebhook: false
validatingWebhookTimeoutSeconds: 3
validatingWebhookFailurePolicy: Ignore
validatingWebhookCheckIgnoreFailurePolicy: Fail
enableDeleteOperations: false
experimentalEnableMutation: false
auditChunkSize: 0
Expand Down
2 changes: 2 additions & 0 deletions manifest_staging/charts/gatekeeper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ _See [Exempting Namespaces](https://open-policy-agent.github.io/gatekeeper/websi
| auditMatchKindOnly | Only check resources of the kinds specified in all constraints defined in the cluster. | `false` |
| disableValidatingWebhook | Disable the validating webhook | `false` |
| validatingWebhookTimeoutSeconds | The timeout for the validating webhook in seconds | `3` |
| validatingWebhookFailurePolicy | The failurePolicy for the validating webhook | `Ignore` |
| validatingWebhookCheckIgnoreFailurePolicy | The failurePolicy for the check-ignore-label validating webhook | `Fail` |
| enableDeleteOperations | Enable validating webhook for delete operations | `false` |
| experimentalEnableMutation | Enable mutation (alpha feature) | `false` |
| emitAdmissionEvents | Emit K8s events in gatekeeper namespace for admission violations (alpha feature) | `false` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ webhooks:
name: gatekeeper-webhook-service
namespace: '{{ .Release.Namespace }}'
path: /v1/admit
failurePolicy: Ignore
failurePolicy: {{ .Values.validatingWebhookFailurePolicy }}
matchPolicy: Exact
name: validation.gatekeeper.sh
namespaceSelector:
Expand Down Expand Up @@ -48,7 +48,7 @@ webhooks:
name: gatekeeper-webhook-service
namespace: '{{ .Release.Namespace }}'
path: /v1/admitlabel
failurePolicy: Fail
failurePolicy: {{ .Values.validatingWebhookCheckIgnoreFailurePolicy }}
matchPolicy: Exact
name: check-ignore-label.gatekeeper.sh
rules:
Expand Down
2 changes: 2 additions & 0 deletions manifest_staging/charts/gatekeeper/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ constraintViolationsLimit: 20
auditFromCache: false
disableValidatingWebhook: false
validatingWebhookTimeoutSeconds: 3
validatingWebhookFailurePolicy: Ignore
validatingWebhookCheckIgnoreFailurePolicy: Fail
enableDeleteOperations: false
experimentalEnableMutation: false
auditChunkSize: 0
Expand Down

0 comments on commit b791188

Please sign in to comment.