Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mateobur/680e1cc6efea861bcdf109d823a933b8 to your computer and use it in GitHub Desktop.
Save mateobur/680e1cc6efea861bcdf109d823a933b8 to your computer and use it in GitHub Desktop.
Docker Scan Anchore ValidatingWebhookConfiguration
Anchore engine policy validator is now installed.
Create a validating webhook resources to start enforcement:
KUBE_CA=$(kubectl config view --minify=true --flatten -o json | jq '.clusters[0].cluster."certificate-authority-data"' -r)
cat > validating-webook.yaml <<EOF
apiVersion: admissionregistration.k8s.io/v1beta1
kind: ValidatingWebhookConfiguration
metadata:
name: analysis-anchore-policy-validator.admission.anchore.io
webhooks:
- name: analysis-anchore-policy-validator.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
EOF
kubectl apply -f validating-webook.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment