forked from open-policy-agent/opa
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update simple Kubernetes deployment example
Fixes open-policy-agent#874 Signed-off-by: Torin Sandall <torinsandall@gmail.com>
- Loading branch information
Showing
3 changed files
with
23 additions
and
45 deletions.
There are no files selected for viewing
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,15 +1,7 @@ | ||
package example | ||
|
||
default deny = false | ||
|
||
# Reject objects without a customer label. | ||
deny { | ||
not input.metadata.labels.customer | ||
} | ||
|
||
# Reject pods referring to images outside the corporate registry. | ||
deny { | ||
input.kind == "Pod" | ||
container := input.spec.containers[_] | ||
not re_match("^registry.acmecorp.com/.+$", container.image) | ||
greeting = msg { | ||
info := opa.runtime() | ||
hostname := info.env["HOSTNAME"] # Kubernetes sets the HOSTNAME environment variable. | ||
msg := sprintf("hello from pod %q!", [hostname]) | ||
} |
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