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

fix!: default config #179

Merged
merged 1 commit into from
Dec 30, 2022
Merged
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
8 changes: 7 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@ jobs:
- run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
- uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: just lint
- run: just test
- uses: rinx/[email protected]
with:
skipClusterCreation: true
- run: just k3d
- run: pip install httpie
- run: just test-e2e-all
# - run: just test-e2e-all
- run: |
just build
env E2E_TEST=default just test-e2e
env E2E_TEST=custom_config just test-e2e
14 changes: 2 additions & 12 deletions charts/opa-kube-mgmt/values.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
# Default values for opa.
# -----------------------
#
# The 'opa' key embeds an OPA configuration file. See https://www.openpolicyagent.org/docs/configuration.html for more details.
# Use 'opa: false' to disable the OPA configuration and rely on configmaps for policy loading.
# See https://www.openpolicyagent.org/docs/latest/kubernetes-admission-control/#3-deploy-opa-on-top-of-kubernetes and the `mgmt.configmapPolicies` section below for more details.
opa:
services:
controller:
url: 'https://www.openpolicyagent.org'
bundles:
quickstart:
service: controller
resource: /bundles/helm-kubernetes-quickstart
default_decision: /helm_kubernetes_quickstart/main
# OPA configuration file. See https://www.openpolicyagent.org/docs/configuration.html for more details.
opa: {}

# Setup the webhook using cert-manager
certManager:
Expand Down
1 change: 1 addition & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,6 @@ test-e2e-all: build
echo "================"
echo "= Running ${E} "
echo "================"
kubectl delete deployment.apps/kube-mgmt-opa-kube-mgmt
just E2E_TEST=${E} test-e2e
done
8 changes: 8 additions & 0 deletions test/e2e/custom_config/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env sh
set -ex

TOKEN=$(kubectl exec deploy/kube-mgmt-opa-kube-mgmt -c mgmt -- cat /bootstrap/mgmt-token)
OPA="http --ignore-stdin --default-scheme=https --verify=no -A bearer -a ${TOKEN} :8443/v1"

${OPA}/data | jq -e '.result.test_helm_kubernetes_quickstart|keys|length==3'

9 changes: 9 additions & 0 deletions test/e2e/custom_config/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
opa:
services:
controller:
url: 'https://www.openpolicyagent.org'
bundles:
quickstart:
service: controller
resource: /bundles/helm-kubernetes-quickstart
default_decision: /helm_kubernetes_quickstart/main
7 changes: 3 additions & 4 deletions test/e2e/default/test.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/bin/sh
set -e
set -x
#!/usr/bin/env sh
set -ex

TOKEN=$(kubectl exec deploy/kube-mgmt-opa-kube-mgmt -c mgmt -- cat /bootstrap/mgmt-token)
OPA="http --ignore-stdin --default-scheme=https --verify=no -A bearer -a ${TOKEN} :8443/v1"

${OPA}/data | jq -e '.result.test_helm_kubernetes_quickstart|keys|length==3'
${OPA}/data | jq -e '.result|keys|length==0'

kubectl apply -f "$(dirname $0)/../fixture.yaml"

Expand Down