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

OPA v1 support #275

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions charts/opa-kube-mgmt/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,18 @@ spec:
TOKEN=`cat /bootstrap/mgmt-token`
cat > /bootstrap/authz.rego <<EOF
package system.authz
default allow = false
import rego.v1
default allow := false
# Allow anonymous access to the default policy decision.
allow { input.path = [""]; input.method = "POST" }
allow { input.path = [""]; input.method = "GET" }
allow if { input.path = [""]; input.method == "POST" }
allow if { input.path = [""]; input.method == "GET" }
# This is only used for health check in liveness and readiness probe
allow { input.path = ["health"]; input.method = "GET" }
allow if { input.path = ["health"]; input.method == "GET" }
{{- if .Values.prometheus.enabled }}
# This allows metrics to be scraped by prometheus
allow { input.path = ["metrics"]; input.method = "GET" }
allow if { input.path = ["metrics"]; input.method == "GET" }
{{- end }}
allow { input.identity == "$TOKEN" }
allow if { input.identity == "$TOKEN" }
EOF
{{- end }}
{{- range $policyName, $policy := .Values.bootstrapPolicies }}
Expand Down
2 changes: 1 addition & 1 deletion charts/opa-kube-mgmt/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ hostNetwork:
# OPA docker image configuration.
image:
repository: openpolicyagent/opa
tag: 0.69.0
tag: 1.0.1
pullPolicy: IfNotPresent

# One or more secrets to be used when pulling images
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ test-e2e-all: build
#!/usr/bin/env bash
set -euo pipefail

for E in $(find test/e2e/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | sort); do
for E in $(find test/e2e/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n'|grep -E -v '^skip_'|sort); do
echo "===================================================="
echo "= Running e2e: \`${E}\` "
echo "===================================================="
Expand Down
6 changes: 4 additions & 2 deletions test/e2e/fixture-multi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ apiVersion: v1
data:
a.rego: |
package my_pkg
import rego.v1
import data.my_pkg.functions.my_func
default my_rule := false
my_rule {
my_rule if {
my_func(input.hello)
}
b.rego: |
Expand All @@ -28,8 +29,9 @@ apiVersion: v1
data:
f.rego: |
package my_pkg_fail
import rego.v1
import data.my_pkg_fail.functions.my_func
default my_rule := false
my_rule {
my_rule if {
my_func(input.hello)
}
Loading