Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gatekeeper workspacesettings validation example within gitops example #263

Open
smarunich opened this issue Apr 4, 2023 · 1 comment
Open

Comments

@smarunich
Copy link
Collaborator

Provide an example of gatekeeper guarding workspacesettings - the specific collection of fields like securitysettings or so.

@shamusx
Copy link
Collaborator

shamusx commented Apr 4, 2023

Sample:

Gatekeeper Constraint Template: https://open-policy-agent.github.io/gatekeeper-library/website/validation/requiredannotations

Sample enforcement:

apiVersion: constraints.gatekeeper.sh/v1beta1
kind: K8sRequiredAnnotations
metadata:
  name: bookinfo-constraint
spec:
  enforcementAction: deny
  match:
    namespaces:
      - bookinfo
    kinds:
      - apiGroups: gateway.tsb.tetrate.io
        kind: IngressGateway
      - apiGroups: security.tsb.tetrate.io
        kind: SecuritySetting
  parameters:
    message: "Must apply proper workspace annotation for namespace"
    annotations:
      - key: tsb.tetrate.io/workspace
        allowedRegex: "bookinfo"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants