Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Resources by Identifiers (Name, etc.) #206

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,20 @@ GO_SUBDIRS += cmd internal apis

# ====================================================================================
# Setup Kubernetes tools

KIND_VERSION = v0.15.0
UP_VERSION = v0.31.0
KUBECTL_VERSION ?= v1.32.2
KIND_VERSION = v0.27.0
UP_VERSION = v0.37.0
UP_CHANNEL = stable
UPTEST_VERSION = v0.5.0
UPTEST_VERSION = v1.3.0
-include build/makelib/k8s_tools.mk

# Workaround until https://github.com/crossplane/build/pull/27 is merged
$(KUBECTL):
@$(INFO) installing kubectl $(KUBECTL_VERSION)
@curl -fsSLo $(KUBECTL) --create-dirs https://dl.k8s.io/$(KUBECTL_VERSION)/bin/$(HOSTOS)/$(SAFEHOSTARCH)/kubectl || $(FAIL)
@chmod +x $(KUBECTL)
@$(OK) installing kubectl $(KUBECTL_VERSION)

# ====================================================================================
# Setup Images

Expand Down Expand Up @@ -190,11 +197,14 @@ run: go.build

# ====================================================================================
# End to End Testing
CHAINSAW_VERSION = 0.2.12
CROSSPLANE_VERSION = 1.16.0
CROSSPLANE_NAMESPACE = upbound-system
CROSSPLANE_NAMESPACE = crossplane-system
-include build/makelib/local.xpkg.mk
-include build/makelib/controlplane.mk

UPTEST_EXAMPLE_LIST := $(shell cat cluster/test/cases.txt | tr '\n' ',')

# This target requires the following environment variables to be set:
# - UPTEST_EXAMPLE_LIST, a comma-separated list of examples to test
# To ensure the proper functioning of the end-to-end test resource pre-deletion hook, it is crucial to arrange your resources appropriately.
Expand All @@ -209,15 +219,21 @@ CROSSPLANE_NAMESPACE = upbound-system
# aws_secret_access_key = REDACTED'
# The associated `ProviderConfig`s will be named as `default` and `peer`.
# - UPTEST_DATASOURCE_PATH (optional), please see https://github.com/crossplane/uptest#injecting-dynamic-values-and-datasource
uptest: $(UPTEST) $(KUBECTL) $(KUTTL)
uptest: $(UPTEST) $(KUBECTL) $(CHAINSAW) $(CROSSPLANE_CLI)
@$(INFO) running automated tests
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e "${UPTEST_EXAMPLE_LIST}" --data-source="${UPTEST_DATASOURCE_PATH}" --setup-script=cluster/test/setup.sh --default-conditions="Test" || $(FAIL)
@KUBECTL=$(KUBECTL) CHAINSAW=$(CHAINSAW) CROSSPLANE_CLI=$(CROSSPLANE_CLI) CROSSPLANE_NAMESPACE=$(CROSSPLANE_NAMESPACE) $(UPTEST) e2e "$(UPTEST_EXAMPLE_LIST)" --data-source="${UPTEST_DATASOURCE_PATH}" --setup-script=cluster/test/setup.sh --default-conditions="Test" || $(FAIL)
@$(OK) running automated tests

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) wait crd providers.pkg.crossplane.io --for=create --timeout 5m
@$(KUBECTL) wait provider.pkg $(PROJECT_NAME) --for condition=Healthy --for condition=Installed --for=create --timeout 5m
@$(OK) running locally built provider

local-deploy-provider: build local.xpkg.deploy.provider.$(PROJECT_NAME)
@$(INFO) running locally built provider
@$(KUBECTL) wait crd providers.pkg.crossplane.io --for=create --timeout 5m
@$(KUBECTL) wait provider.pkg $(PROJECT_NAME) --for condition=Healthy --for condition=Installed --for=create --timeout 5m
@$(OK) running locally built provider

e2e: local-deploy uptest
Expand Down
53 changes: 34 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ We also support DeploymentRuntimeConfig to enable additional features in the pro
apiVersion: pkg.crossplane.io/v1beta1
kind: DeploymentRuntimeConfig
metadata:
name: enable-ess
name: runtimeconfig-provider-keycloak
spec:
deploymentTemplate:
spec:
Expand All @@ -63,7 +63,7 @@ metadata:
spec:
package: xpkg.upbound.io/crossplane-contrib/provider-keycloak:v1.5.0
+ runtimeConfigRef:
+ name: enable-ess
+ name: runtimeconfig-provider-keycloak
```
(Without the + signs of course)

Expand Down Expand Up @@ -241,41 +241,56 @@ make publish
```

### Local Environment

Change dir to `dev/` Folder
```console
cd dev/
```

Execute setup script which creates a KIND Cluster
and installs crossplane, keycloak and the official crossplane provider
via ArgoCD (for more options run script with `--help`)
```console
./setup_dev_environment.sh
./dev/setup_dev_environment.sh
```
**Hint**: If you are using rootless docker you can `--skip-metal-lb`
and run `sudo cloud-provider-kind` (how to install [see here](https://github.com/kubernetes-sigs/cloud-provider-kind) and don´t forget to give root access to your user´s docker socket)
**Hint**: If you are using rootless docker you can add the flags `--skip-metal-lb`
and `--start-cloud-provider-kind` (how to install cloud-provider-kind [see here](https://github.com/kubernetes-sigs/cloud-provider-kind))

Use created file from KIND as kubeconfig `~/.kube/<clustername>`

For debugging local source code you need to scale down
the crossplane provider which is running in the cluster
and then start your local crossplane provider instance
```console
kubectl patch DeploymentRuntimeConfig enable-ess --type='merge' -p '{"spec":{"deploymentTemplate":{"spec":{"replicas":0}}}}'
```
For debugging local source code you can run the script with `--use-local-provider` flag
this will scale down the crossplane provider which is running in the cluster
and then start your local crossplane provider instance.

### Alternative Local Environment

This make target creates a KIND Cluster
and installs crossplane and the crossplane provider
from current sources
from current sources. But no keycloak deployment is stared.
```console
make local-deploy
```

## Regression Tests
TODO: Add regression test docs
Follow the following steps to run end to end tests:


Start local dev cluster
```console
./dev/setup_dev_environment.sh
```

Remove automatically provisioned keycloak-provider
```console
kubectl delete providerconfigs keycloak-provider-config
kubectl delete providers keycloak-provider
```

Build and Deploy local provider into cluster
```console
KIND_CLUSTER_NAME=fenrir-1 make local-deploy-provider
```
Hint: crossplane pod´s filesystem based cache fpr providers is patched with local built provider


Run tests
```console
make uptest
```

## Report a Bug

Expand Down
21 changes: 20 additions & 1 deletion apis/openidclient/v1alpha1/zz_clientclientpolicy_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 21 additions & 1 deletion apis/openidclient/v1alpha1/zz_clientgrouppolicy_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 22 additions & 1 deletion apis/openidclient/v1alpha1/zz_clientrolepolicy_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 20 additions & 1 deletion apis/openidclient/v1alpha1/zz_clientuserpolicy_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading