Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable setting admissioncontroller annotations #121

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions charts/opa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Reference](https://www.openpolicyagent.org/docs/configuration.html).
| `certManager.servingCertificateDuration` | Duration of the Webhook's serving certificate | `8760h` (1y) |
| `admissionController.enabled` | | `true` |
| `admissionController.kind` | Type of admission controller to install. | `ValidatingWebhookConfiguration` |
| `admissionController.annotations` | Annotations placed on all admissionController resources (Secret/Certificate/Issuer/AdmissionController). | `[]` |
| `admissionController.failurePolicy` | Fail-open (`Ignore`) or fail-closed (`Fail`)? | `Ignore` |
| `admissionController.rules` | Types of operations resources to check. | `*` |
| `admissionController.namespaceSelector` | Namespace selector for the admission controller | See [values.yaml](values.yaml) |
Expand Down
23 changes: 23 additions & 0 deletions charts/opa/templates/webhookconfiguration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ metadata:
{{- if .Values.certManager.enabled }}
certmanager.k8s.io/inject-ca-from: {{ printf "%s/%s" .Release.Namespace (include "opa.rootCACertificate" .) | quote }}
cert-manager.io/inject-ca-from: {{ printf "%s/%s" .Release.Namespace (include "opa.rootCACertificate" .) | quote }}
{{- end }}
{{- if .Values.admissionController.annotations }}
{{ toYaml .Values.admissionController.annotations | indent 4 }}
{{- end }}
labels:
{{ include "opa.labels.standard" . | indent 4 }}
Expand Down Expand Up @@ -46,6 +49,10 @@ webhooks:
apiVersion: {{ include "opa.certManagerApiVersion" . }}
kind: Issuer
metadata:
{{- if .Values.admissionController.annotations }}
annotations:
{{ toYaml .Values.admissionController.annotations | indent 4 }}
{{- end }}
name: {{ include "opa.selfSignedIssuer" . }}
labels:
{{ include "opa.labels.standard" . | indent 4 }}
Expand All @@ -56,6 +63,10 @@ spec:
apiVersion: {{ include "opa.certManagerApiVersion" . }}
kind: Certificate
metadata:
{{- if .Values.admissionController.annotations }}
annotations:
{{ toYaml .Values.admissionController.annotations | indent 4 }}
{{- end }}
name: {{ include "opa.rootCACertificate" . }}
labels:
{{ include "opa.labels.standard" . | indent 4 }}
Expand All @@ -71,6 +82,10 @@ spec:
apiVersion: {{ include "opa.certManagerApiVersion" . }}
kind: Issuer
metadata:
{{- if .Values.admissionController.annotations }}
annotations:
{{ toYaml .Values.admissionController.annotations | indent 4 }}
{{- end }}
name: {{ include "opa.rootCAIssuer" . }}
labels:
{{ include "opa.labels.standard" . | indent 4 }}
Expand All @@ -82,6 +97,10 @@ spec:
apiVersion: {{ include "opa.certManagerApiVersion" . }}
kind: Certificate
metadata:
{{- if .Values.admissionController.annotations }}
annotations:
{{ toYaml .Values.admissionController.annotations | indent 4 }}
{{- end }}
name: {{ include "opa.servingCertificate" . }}
labels:
{{ include "opa.labels.standard" . | indent 4 }}
Expand All @@ -98,6 +117,10 @@ spec:
apiVersion: v1
kind: Secret
metadata:
{{- if .Values.admissionController.annotations }}
annotations:
{{ toYaml .Values.admissionController.annotations | indent 4 }}
{{- end }}
name: {{ template "opa.fullname" . }}-cert
labels:
app: {{ template "opa.fullname" . }}
Expand Down
4 changes: 4 additions & 0 deletions charts/opa/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ admissionController:
# To enforce mutating policies, change to MutatingWebhookConfiguration.
kind: ValidatingWebhookConfiguration

# To set annotations on all admissionController resources (Secret/Certificate/Issuer/AdmissionController)
# annotations:
# example: value

# To _fail closed_ on failures, change to Fail. During initial testing, we
# recommend leaving the failure policy as Ignore.
failurePolicy: Ignore
Expand Down