diff --git a/.codeclimate.yml b/.codeclimate.yml index 79b24830..723325e8 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -27,3 +27,4 @@ exclude_patterns: - '**/*.d.ts' - 'e2e/lib/' - '**/zz_generated.deepcopy.go' +- '**/mock/' diff --git a/.gitignore b/.gitignore index ab83aa3b..6a5235ce 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,6 @@ crd*.yaml # Go releaser dist/ + +# apiserver-runtime +apiserver.local.config/ diff --git a/Makefile b/Makefile index 0f4778c3..14dd1ad4 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,7 @@ build: generate fmt vet $(BIN_FILENAME) ## Build manager binary .PHONY: generate generate: ## Generate manifests e.g. CRD, RBAC etc. + go generate ./... # Generate code go run sigs.k8s.io/controller-tools/cmd/controller-gen object paths="./..." # Generate CRDs @@ -58,6 +59,11 @@ build.docker: $(BIN_FILENAME) ## Build the docker image clean: ## Cleans up the generated resources rm -rf dist/ cover.out $(BIN_FILENAME) || true +.PHONY: run +KUBECONFIG ?= ~/.kube/config +run: build ## Starts control api against the configured kuberentes cluster + $(BIN_FILENAME) --secure-port 9443 --kubeconfig $(KUBECONFIG) --authentication-kubeconfig $(KUBECONFIG) --authorization-kubeconfig $(KUBECONFIG) + .PHONY: local-env local-env-setup: ## Setup local kind-based dev environment $(localenv_make) setup diff --git a/README.md b/README.md index 6b69929c..2b4d120b 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,62 @@ See the [local-env/README.md](./local-env/README.md) for more details on the loc Please be aware that the productive deployment of the control-api may run on a different Kubernetes distribution than [kind]. [kind]: https://kind.sigs.k8s.io/ + + +### Running the control-api locally + +You can run the control-api locally against the currently configured Kubernetes cluster with + +```bash +make run +``` + +To access the locally running API server you need to register it with the [kind]-based local environment. +You can do this by applying the following. + + +The `externalName` needs to be changed to your specific host IP. +When running kind on Linux you can find it with `docker inspect + + +```bash +HOSTIP=$(docker inspect control-api-v1.22.1-control-plane | jq '.[0].NetworkSettings.Networks.kind.Gateway') + +cat <