Skip to content

Commit

Permalink
Merge pull request #118 from turkenh/local-deploy
Browse files Browse the repository at this point in the history
Setup e2e with Local Deploy and Uptest
  • Loading branch information
turkenh authored May 23, 2023
2 parents 939ae0c + 3b28fa9 commit 4b05bd0
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ jobs:
- name: Vendor Dependencies
run: make vendor vendor.check

- name: Build Helm Chart
run: make -j2 build
- name: Run the end to end tests
run: make e2e
env:
# We're using docker buildx, which doesn't actually load the images it
# builds by default. Specifying --load does so.
Expand Down
39 changes: 23 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ GOLANGCILINT_VERSION = 1.51.2

# ====================================================================================
# Setup Kubernetes tools
KIND_VERSION = v0.11.1
UP_VERSION = v0.13.0
KIND_VERSION = v0.18.0
UP_VERSION = v0.17.0
UPTEST_VERSION = v0.5.0
UP_CHANNEL = stable
USE_HELM3 = true
-include build/makelib/k8s_tools.mk
Expand Down Expand Up @@ -74,9 +75,6 @@ XPKGS = provider-kubernetes
# NOTE(hasheddan): we force image building to happen prior to xpkg build so that
# we ensure image is present in daemon.
xpkg.build.provider-kubernetes: do.build.images
# ====================================================================================
# Setup Local Dev
-include build/makelib/local.mk

# Generate a coverage report for cobertura applying exclusions on
# - generated file
Expand All @@ -85,17 +83,26 @@ cobertura:
grep -v zz_generated.deepcopy | \
$(GOCOVER_COBERTURA) > $(GO_TEST_OUTPUT)/cobertura-coverage.xml

# integration tests
e2e.run: test-integration

local-dev: local.up local.deploy.crossplane

# Run integration tests.
test-integration: $(KIND) $(KUBECTL) $(HELM3)
@$(INFO) running integration tests using kind $(KIND_VERSION)
@$(ROOT_DIR)/cluster/integration/integration_tests.sh || $(FAIL)
@$(OK) integration tests passed

# ====================================================================================
# End to End Testing
CROSSPLANE_NAMESPACE = upbound-system
-include build/makelib/local.xpkg.mk
-include build/makelib/controlplane.mk

UPTEST_EXAMPLE_LIST ?= "examples/object/object.yaml"
uptest: $(UPTEST) $(KUBECTL) $(KUTTL)
@$(INFO) running automated tests
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e "$(UPTEST_EXAMPLE_LIST)" --setup-script=cluster/test/setup.sh || $(FAIL)
@$(OK) running automated tests

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
@$(OK) running locally built provider

e2e: local-deploy uptest
# Update the submodules, such as the common build scripts.
submodules:
@git submodule sync
Expand Down
2 changes: 1 addition & 1 deletion build
1 change: 0 additions & 1 deletion cluster/local/config/config.env

This file was deleted.

1 change: 0 additions & 1 deletion cluster/local/config/crossplane/.gitignore

This file was deleted.

8 changes: 0 additions & 8 deletions cluster/local/config/crossplane/config.env

This file was deleted.

Empty file.
5 changes: 0 additions & 5 deletions cluster/local/kind.yaml

This file was deleted.

18 changes: 18 additions & 0 deletions cluster/test/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
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')
${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 -
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
name: kubernetes-provider
spec:
credentials:
source: InjectedIdentity
EOF

0 comments on commit 4b05bd0

Please sign in to comment.