diff --git a/.editorconfig b/.editorconfig index 3955c5d..bbf1aba 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,3 +8,8 @@ indent_size = 2 tab_width = 2 trim_trailing_whitespace = true insert_final_newline = true + +[Makefile] +indent_style = tab +indent_size = 4 +tab_width = 4 diff --git a/.gitignore b/.gitignore index f1b09fa..2fd91b6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ bin/ .idea/ *.swp +charts/**/*.tgz diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0d86cc9..11f1c1c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,6 +34,18 @@ git checkout «your-branch» git rebase main ``` +## Testing + +Our CI pipeline takes care of the majority of the testing of this Chart. Other ways for you to test are by running `make test` locally using: + +> **Warning**: Ensure to run the test on a dedicated k8s cluster that does not have Spire installed yet. + +```shell +make test +``` + +Another approach to testing the chart is by installing one of the examples in your own cluster to verify your contributed changes work before issueing your PR. + ## Generating documentation Any changes to Chart.yaml or values.yaml require an update of the README.md. This update can easily be generated using [helm-docs][]. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ac98f14 --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +.PHONY: help +help: ## Display this help. + @$(MAKE) help + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) + + +##@ Testing: + +.PHONY: clean-lingering-resources +clean-lingering-resources: + @echo Cleanup potential leftovers… + @-kubectl delete csidrivers.storage.k8s.io csi.spiffe.io \ + &>/dev/null || true + @-kubectl delete ns \ + $$(kubectl get ns -o json | jq -r '.items[] | .metadata.name' | grep spire) \ + &>/dev/null || true + @-kubectl delete validatingwebhookconfigurations.admissionregistration.k8s.io \ + $$(kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io -o json | jq -r '.items[] | .metadata.name' | grep spire) \ + &>/dev/null || true + +.PHONY: test +test: ## Run tests using Helm chart-testing (ensure to run on dedicated test cluster) + @echo Running tests… + @ct install --debug \ + --charts charts/spire