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

Update simple Kubernetes deployment example #1343

Merged

Conversation

tsandall
Copy link
Member

Fixes #874

Signed-off-by: Torin Sandall torinsandall@gmail.com

input.kind == "Pod"
container := input.spec.containers[_]
not re_match("^registry.acmecorp.com/.+$", container.image)
deny["Invalid image registry"] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the goal is to show just OPA and not relate it to the admission controller should we change the policy to not look like the admission requests at all? The changes made are substantial if you know what the admission requests look like, but the policy is still showing the same sort of behavior.

Maybe we just show the same example as the docker one earlier in that page?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thought crossed my mind at the time. I've updated it to avoid lingering confusion. LMKWYT.

deny {
not input.metadata.labels.customer
deny["Missing customer label"] {
not input.tags.customer
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be useful to also show a rule that returns a true/false

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The policy now matches the Docker example above. If we want to include true/false examples here, we could come back and add it later. Not sure it's required though.

Fixes open-policy-agent#874

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
@tsandall tsandall force-pushed the add-note-to-kubernetes-deployments branch from a74f5bf to 4cecfb8 Compare April 17, 2019 01:42
Copy link
Contributor

@patrick-east patrick-east left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tsandall tsandall merged commit 41d2015 into open-policy-agent:master Apr 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Update Kubernetes deployment docs example to avoid confusion
3 participants