-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add webhook handling and watchdog webhook Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * feat(helm): add webhook values and test Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * fix: disregard delete and generic events for watchdog Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: align makefile$ Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> --------- Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
- Loading branch information
1 parent
c338410
commit 69d8dda
Showing
13 changed files
with
475 additions
and
35 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
webhooks: | ||
enabled: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{{- if $.Values.webhooks.enabled }} | ||
--- | ||
apiVersion: cert-manager.io/v1 | ||
kind: Issuer | ||
metadata: | ||
name: {{ include "capsule-proxy.fullname" . }}-webhook-issuer | ||
spec: | ||
selfSigned: {} | ||
--- | ||
apiVersion: cert-manager.io/v1 | ||
kind: Certificate | ||
metadata: | ||
name: {{ include "capsule-proxy.fullname" . }}-webhook-ca | ||
spec: | ||
isCA: true | ||
commonName: {{ include "capsule-proxy.fullname" . }}-webhook-ca | ||
secretName: {{ include "capsule-proxy.fullname" . }}-webhook-ca | ||
privateKey: | ||
algorithm: ECDSA | ||
size: 256 | ||
issuerRef: | ||
name: {{ include "capsule-proxy.fullname" . }}-webhook-issuer | ||
kind: Issuer | ||
group: cert-manager.io | ||
--- | ||
apiVersion: cert-manager.io/v1 | ||
kind: Issuer | ||
metadata: | ||
name: {{ include "capsule-proxy.fullname" . }}-webhook | ||
spec: | ||
ca: | ||
secretName: {{ include "capsule-proxy.fullname" . }}-webhook-ca | ||
--- | ||
apiVersion: cert-manager.io/v1 | ||
kind: Certificate | ||
metadata: | ||
name: {{ include "capsule-proxy.fullname" . }}-webhook-cert | ||
spec: | ||
{{- with .Values.webhooks.certificate.fields }} | ||
{{ toYaml . | nindent 2 }} | ||
{{- end }} | ||
dnsNames: | ||
{{- range $dns := .Values.webhooks.certificate.dnsNames }} | ||
- {{ $dns | quote }} | ||
{{- end }} | ||
- {{ include "capsule-proxy.fullname" . }}-webhook-service | ||
- {{ include "capsule-proxy.fullname" . }}-webhook-service.{{ .Release.Namespace }}.svc | ||
{{- with .Values.webhooks.certificate.ipAddresses }} | ||
ipAddresses: | ||
{{- range $ip := . }} | ||
- {{ $ip }} | ||
{{- end }} | ||
{{- end }} | ||
{{- with .Values.webhooks.certificate.uris }} | ||
uris: | ||
{{- range $uri := . }} | ||
- {{ $uri }} | ||
{{- end }} | ||
{{- end }} | ||
issuerRef: | ||
kind: "Issuer" | ||
name: {{ include "capsule-proxy.fullname" . }}-webhook | ||
secretName: {{ include "capsule-proxy.fullname" . }}-webhook-cert | ||
subject: | ||
organizations: | ||
- projectcapsule.dev | ||
{{- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{{- if $.Values.webhooks.enabled }} | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: MutatingWebhookConfiguration | ||
metadata: | ||
name: {{ include "capsule-proxy.fullname" . }}-webhook | ||
labels: | ||
{{- include "capsule-proxy.labels" . | nindent 4 }} | ||
annotations: | ||
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ include "capsule-proxy.fullname" . }}-webhook-cert | ||
webhooks: | ||
{{- with .Values.webhooks.watchdog }} | ||
{{- if .enabled }} | ||
- admissionReviewVersions: | ||
- v1 | ||
clientConfig: | ||
{{- include "capsule-proxy.webhooks.service" (dict "path" "/mutate/watchdog" "ctx" $) | nindent 4 }} | ||
failurePolicy: {{ .failurePolicy }} | ||
name: watchdog.proxy.projectcapsule.dev | ||
{{- with .rules }} | ||
rules: | ||
{{- toYaml .| nindent 4}} | ||
{{- end }} | ||
{{- with .namespaceSelector }} | ||
namespaceSelector: | ||
{{- toYaml .| nindent 4}} | ||
{{- end }} | ||
sideEffects: None | ||
timeoutSeconds: {{ $.Values.webhooks.mutatingWebhooksTimeoutSeconds }} | ||
{{- end }} | ||
{{- end }} | ||
{{- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{{- if $.Values.webhooks.enabled }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "capsule-proxy.fullname" . }}-webhook-service | ||
labels: | ||
{{- include "capsule-proxy.labels" . | nindent 4 }} | ||
spec: | ||
ports: | ||
- port: 443 | ||
name: https | ||
protocol: TCP | ||
targetPort: {{ .Values.options.webhookPort }} | ||
selector: | ||
{{- include "capsule-proxy.selectorLabels" . | nindent 4 }} | ||
sessionAffinity: None | ||
type: ClusterIP | ||
{{- end }} |
Oops, something went wrong.