From 210b672501c7568a0f0879c16a78dee12ff56a65 Mon Sep 17 00:00:00 2001 From: Philippe Scorsolini Date: Tue, 23 May 2023 17:06:17 +0200 Subject: [PATCH 1/4] docs: switch back to crossplane-system namespace everywhere for consistency Signed-off-by: Philippe Scorsolini --- Makefile | 4 ++-- README.md | 2 +- cluster/test/setup.sh | 2 +- examples/provider/config-in-cluster.yaml | 2 +- examples/provider/config.yaml | 3 ++- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index d9e2e15b..d88f703b 100644 --- a/Makefile +++ b/Makefile @@ -85,7 +85,7 @@ cobertura: # ==================================================================================== # End to End Testing -CROSSPLANE_NAMESPACE = upbound-system +CROSSPLANE_NAMESPACE = crossplane-system -include build/makelib/local.xpkg.mk -include build/makelib/controlplane.mk @@ -99,7 +99,7 @@ local-dev: controlplane.up local-deploy: build controlplane.up local.xpkg.deploy.provider.$(PROJECT_NAME) @$(INFO) running locally built provider @$(KUBECTL) wait provider.pkg $(PROJECT_NAME) --for condition=Healthy --timeout 5m - @$(KUBECTL) -n upbound-system wait --for=condition=Available deployment --all --timeout=5m + @$(KUBECTL) -n $(CROSSPLANE_NAMESPACE) wait --for=condition=Available deployment --all --timeout=5m @$(OK) running locally built provider e2e: local-deploy uptest diff --git a/README.md b/README.md index 872bdb20..56669fde 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ sudo kubectl proxy --port=8081 ``` KUBECONFIG=$(kind get kubeconfig --name local-dev | sed -e 's|server:\s*.*$|server: http://localhost:8081|g') - kubectl -n crossplane-system create secret generic cluster-config --from-literal=kubeconfig="${KUBECONFIG}" + kubectl -n crossplane-system create secret generic cluster-config --from-literal=kubeconfig="${KUBECONFIG}" kubectl apply -f examples/provider/config.yaml ``` diff --git a/cluster/test/setup.sh b/cluster/test/setup.sh index d696dad1..e22dcef1 100755 --- a/cluster/test/setup.sh +++ b/cluster/test/setup.sh @@ -4,7 +4,7 @@ set -aeuo pipefail echo "Running setup.sh" echo "Creating the provider config with cluster admin permissions in cluster..." -SA=$(${KUBECTL} -n upbound-system get sa -o name | grep provider-kubernetes | sed -e 's|serviceaccount\/|upbound-system:|g') +SA=$(${KUBECTL} -n crossplane-system get sa -o name | grep provider-kubernetes | sed -e 's|serviceaccount\/|crossplane-system:|g') ${KUBECTL} create clusterrolebinding provider-kubernetes-admin-binding --clusterrole cluster-admin --serviceaccount="${SA}" --dry-run=client -o yaml | ${KUBECTL} apply -f - cat < Date: Wed, 24 May 2023 08:45:25 +0200 Subject: [PATCH 2/4] docs: explicitly show how to deploy in-cluster Signed-off-by: Philippe Scorsolini --- README.md | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 56669fde..b80d9c70 100644 --- a/README.md +++ b/README.md @@ -39,22 +39,42 @@ make make local-dev ``` -Run controller against the cluster: +Now you can either run the controller locally or in-cluster. + +### Running locally + +Run controller locally against the cluster: ``` make run ``` -Since the controller is running outside the Kind cluster, you need to make api server accessible (on a separate terminal): +Since the controller is running outside the Kind cluster, you need to make the +API server accessible to the controller. You can do this by running a proxy: ``` +# on a separate terminal sudo kubectl proxy --port=8081 ``` -### Testing in Local Cluster +See [below](#required-configuration) for how to properly setup the RBAC for the +locally running controller. + +### Running in-cluster + +Run controller in-cluster: + +``` +make local-deploy +``` + +See [below](#required-configuration) for how to properly setup the RBAC for the +locally running controller. + +### Required configuration 1. Prepare provider config for the local cluster: - 1. If provider kubernetes running in the cluster (e.g. provider installed with crossplane): + 1. If provider kubernetes running in the cluster (e.g. provider installed with crossplane or using `make local-deploy`): ``` SA=$(kubectl -n crossplane-system get sa -o name | grep provider-kubernetes | sed -e 's|serviceaccount\/|crossplane-system:|g') From ecb7ec28444b82c3d876556b273207754a73f6ec Mon Sep 17 00:00:00 2001 From: Philippe Scorsolini Date: Wed, 24 May 2023 08:54:01 +0200 Subject: [PATCH 3/4] ci(build): bump to have custom crossplane namespace Signed-off-by: Philippe Scorsolini --- build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build b/build index 292f958d..f2bc2378 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 292f958d2d97f26b450723998f82f7fc1767920c +Subproject commit f2bc2378a7bfc4b409a59b97a945eb11c7da052e From 83e6005e891f66432d1b7ba7b7ced993ab3b02c4 Mon Sep 17 00:00:00 2001 From: Philippe Scorsolini Date: Wed, 24 May 2023 10:28:16 +0200 Subject: [PATCH 4/4] docs: fix cleanup make target Signed-off-by: Philippe Scorsolini --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b80d9c70..3305ce6b 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,8 @@ locally running controller. ### Cleanup +To delete the local kind cluster: + ``` -make local.down +make controlplane.down ```