Skip to content

Instantly share code, notes, and snippets.

@shpwrck
Created April 9, 2021 21:11
Show Gist options
  • Save shpwrck/024b31de8181b995bbf0dce0516a2b8f to your computer and use it in GitHub Desktop.
Save shpwrck/024b31de8181b995bbf0dce0516a2b8f to your computer and use it in GitHub Desktop.
OPA Examples
apiVersion: mutations.gatekeeper.sh/v1alpha1
kind: AssignMetadata
metadata:
name: demo-annotation-owner
spec:
match:
scope: Namespaced
location: "metadata.annotations.owner"
parameters:
assign:
value: "admin"
apiVersion: mutations.gatekeeper.sh/v1alpha1
kind: Assign
metadata:
name: demo-sidecar
namespace: default
spec:
applyTo:
- groups: [""]
kinds: ["Pod"]
versions: ["v1"]
match:
scope: Namespaced
kinds:
- apiGroups: ["*"]
kinds: ["Pod"]
location: "spec.containers[name:networking]"
parameters:
assign:
value:
name: "networking"
imagePullPolicy: Always
image: quay.io/foo/bar:latest
command: ["/bin/bash", "-c", "sleep INF"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment