-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* handle webhook with helm. Closes #10 Signed-off-by: David J. M. Karlsen <[email protected]> * bump chart version Signed-off-by: David J. M. Karlsen <[email protected]>
- Loading branch information
1 parent
70ba473
commit 4db4fd9
Showing
5 changed files
with
39 additions
and
80 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
37 changes: 0 additions & 37 deletions
37
stable/anchore-admission-controller/files/get_validating_webhook_config.sh
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,43 +1 @@ | ||
Anchore admission controller is now installed. | ||
|
||
Create a validating webhook resources to start enforcement using the included script: | ||
|
||
./files/get_validating_webhook_config.sh <releasename> | ||
kubectl apply -f validating-webhook.yaml | ||
|
||
|
||
KUBE_CA=$(kubectl config view --minify=true --flatten -o json | jq '.clusters[0].cluster."certificate-authority-data"' -r) | ||
cat > validating-webhook.yaml <<EOF | ||
apiVersion: admissionregistration.k8s.io/v1beta1 | ||
kind: ValidatingWebhookConfiguration | ||
metadata: | ||
name: {{ template "anchore-admission-controller.fullname" . }}.admission.anchore.io | ||
webhooks: | ||
- name: {{ template "anchore-admission-controller.fullname" . }}.admission.anchore.io | ||
clientConfig: | ||
service: | ||
namespace: default | ||
name: kubernetes | ||
path: /apis/admission.anchore.io/v1beta1/imagechecks | ||
caBundle: $KUBE_CA | ||
rules: | ||
- operations: | ||
- CREATE | ||
apiGroups: | ||
- "" | ||
apiVersions: | ||
- "*" | ||
resources: | ||
- pods | ||
failurePolicy: Fail | ||
# Uncomment this and customize to exclude specific namespaces from the validation requirement | ||
# namespaceSelector: | ||
# matchExpressions: | ||
# - key: exclude.admission.anchore.io | ||
# operator: NotIn | ||
# values: ["true"] | ||
EOF | ||
|
||
|
||
|
||
|
28 changes: 28 additions & 0 deletions
28
stable/anchore-admission-controller/templates/webhook.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,28 @@ | ||
{{- if .Values.apiService.webhook.enabled }} | ||
apiVersion: admissionregistration.k8s.io/v1beta1 | ||
kind: ValidatingWebhookConfiguration | ||
metadata: | ||
name: {{ template "anchore-admission-controller.name" . }}-admission.anchore.io | ||
labels: {{- include "anchore-admission-controller.labels" . | nindent 4 }} | ||
webhooks: | ||
- name: {{ template "anchore-admission-controller.name" . }}-admission.anchore.io | ||
clientConfig: | ||
service: | ||
namespace: default | ||
name: kubernetes | ||
path: /apis/{{ .Values.apiService.group }}/v1beta1/imagechecks | ||
{{- with .Values.apiService.webhook.caBundle }} | ||
caBundle: {{ . | b64enc }} | ||
{{- end }} | ||
rules: | ||
- operations: | ||
- CREATE | ||
apiGroups: | ||
- "" | ||
apiVersions: | ||
- "*" | ||
resources: | ||
- pods | ||
failurePolicy: {{ .Values.apiService.webhook.failurePolicy }} | ||
namespaceSelector: {{- toYaml .Values.apiService.namespaceSelector | nindent 4 }} | ||
{{- 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