-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Validating admission controller for RuleSet resources (#984)
- Loading branch information
Showing
36 changed files
with
1,745 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
charts/heimdall/templates/heimdall/admissioncontroller.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{{- $rules := default dict .Values.rules }} | ||
{{- $providers := default dict $rules.providers }} | ||
{{- $kubernetes := default dict $providers.kubernetes }} | ||
{{- if $kubernetes.tls }} | ||
# Only active if .Values.rules.providers.kubernetes.tls is configured | ||
{{- $data := dict "Release" .Release "Values" .Values "Chart" .Chart "Component" "admissionController" }} | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: ValidatingWebhookConfiguration | ||
metadata: | ||
name: {{ include "heimdall.fullname" $data }}-webhook | ||
namespace: {{ include "heimdall.namespace" $data }} | ||
labels: | ||
{{- include "heimdall.labels" $data | nindent 4 }} | ||
annotations: | ||
{{- toYaml .Values.admissionController.annotations | nindent 4 }} | ||
webhooks: | ||
- name: "admission-controller.heimdall.dadrus.github.com" | ||
admissionReviewVersions: [ "v1" ] | ||
sideEffects: None | ||
timeoutSeconds: {{ .Values.admissionController.timeoutSeconds }} | ||
{{- with .Values.admissionController.namespaceSelector }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
rules: | ||
- apiGroups: ["heimdall.dadrus.github.com"] | ||
apiVersions: ["v1alpha2"] | ||
operations: ["CREATE", "UPDATE"] | ||
resources: ["rulesets"] | ||
scope: "Namespaced" | ||
matchConditions: | ||
{{- $rules := .Values.rules | default dict }} | ||
{{- $providers := $rules.providers | default dict }} | ||
{{- $kubernetes := $providers.kubernetes | default dict}} | ||
# Match only those rule sets, which relate to the configured auth class | ||
- name: 'auth-class-filter' | ||
expression: 'object.spec.authClassName == {{ default (quote "default") (quote $kubernetes.auth_class) }}' | ||
clientConfig: | ||
{{- with .Values.admissionController.caBundle }} | ||
caBundle: {{ . }} | ||
{{- end }} | ||
service: | ||
namespace: {{ include "heimdall.namespace" $data }} | ||
name: {{ include "heimdall.fullname" $data }} | ||
path: "/validate-ruleset" | ||
port: {{ .Values.service.admissionController.port }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.