Kind in make
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
KIND_CLUSTER_NAME ?= "opa-rego-teammapping" | |
WAIT_FOR_KIND_READY = '{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}' | |
WAIT_FOR_OPA_READY = '{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}' | |
.PHONY: all build test integration | |
all: test kind-integration | |
build: test | |
test: | |
opa test ./*.rego -v --explain full | |
kind-start: | |
ifeq (1, $(shell kind get clusters | grep ${KIND_CLUSTER_NAME} | wc -l)) | |
@echo "Cluster already exists - deleting it to start from clean cluster" | |
kind delete cluster --name ${KIND_CLUSTER_NAME} | |
endif | |
@echo "Creating Cluster" | |
kind create cluster --name ${KIND_CLUSTER_NAME} --image=kindest/node:v1.16.2 | |
until kubectl get nodes -o jsonpath="${WAIT_FOR_KIND_READY}" 2>&1 | grep -q "Ready=True"; do sleep 5; echo "--------> waiting for cluster node to be available"; done | |
kind-deploy: | |
./integration/deploy/deploy.sh | |
# Wait for OPA to be ready | |
until kubectl -n opa -lapp=opa get pods -o jsonpath="${WAIT_FOR_OPA_READY}" 2>&1 | grep -q "Ready=True"; do sleep 5;echo "--------> waiting for operator to be available"; kubectl get pods -n opa; done | |
kind-integration: kind-start kind-deploy integration | |
integration: | |
# Run integration tests | |
python3 ./integration/test/int_test.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment