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..3305ce6b 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') @@ -65,7 +85,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 ``` @@ -77,6 +97,8 @@ sudo kubectl proxy --port=8081 ### Cleanup +To delete the local kind cluster: + ``` -make local.down +make controlplane.down ``` diff --git a/build b/build index 292f958d..f2bc2378 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 292f958d2d97f26b450723998f82f7fc1767920c +Subproject commit f2bc2378a7bfc4b409a59b97a945eb11c7da052e 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 <