Skip to content

Commit

Permalink
Merge pull request #120 from phisco/update_docs
Browse files Browse the repository at this point in the history
docs: switch to crossplane-system namespace everywhere for consistency
  • Loading branch information
turkenh authored May 24, 2023
2 parents 4b05bd0 + 83e6005 commit d966cc7
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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
```

Expand All @@ -77,6 +97,8 @@ sudo kubectl proxy --port=8081

### Cleanup

To delete the local kind cluster:

```
make local.down
make controlplane.down
```
2 changes: 1 addition & 1 deletion build
2 changes: 1 addition & 1 deletion cluster/test/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF | ${KUBECTL} apply -f -
Expand Down
2 changes: 1 addition & 1 deletion examples/provider/config-in-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ metadata:
name: kubernetes-provider
spec:
credentials:
source: InjectedIdentity
source: InjectedIdentity
3 changes: 2 additions & 1 deletion examples/provider/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ spec:
# secretRef:
# name: gcp-credentials
# namespace: crossplane-system
# key: credentials.json
# key: credentials.json

0 comments on commit d966cc7

Please sign in to comment.