Skip to content

Commit

Permalink
Deploy configuration as package
Browse files Browse the repository at this point in the history
Signed-off-by: Hasan Turken <turkenh@gmail.com>
  • Loading branch information
turkenh committed Oct 14, 2022
1 parent 8101c5d commit 27df30a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:

jobs:
detect-noop:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
outputs:
noop: ${{ steps.noop.outputs.should_skip }}
steps:
Expand All @@ -25,7 +25,7 @@ jobs:
do_not_skip: '["workflow_dispatch", "schedule", "push"]'

publish-artifacts:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'

Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:

jobs:
detect-noop:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
outputs:
noop: ${{ steps.noop.outputs.should_skip }}
steps:
Expand All @@ -26,7 +26,7 @@ jobs:
do_not_skip: '["workflow_dispatch", "schedule", "push"]'

e2e:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'

Expand All @@ -53,5 +53,3 @@ jobs:
env:
UPTEST_GCP_PROJECT: ${{ secrets.UPTEST_GCP_PROJECT }}
UPTEST_GCP_CREDS: ${{ secrets.UPTEST_GCP_CREDS }}
UPBOUND_DOCKER_USERNAME: ${{ secrets.UPBOUND_DOCKER_USERNAME }}
UPBOUND_DOCKER_PASSWORD: ${{ secrets.UPBOUND_DOCKER_PASSWORD }}
28 changes: 3 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ XPKGS = $(PROJECT_NAME)

CROSSPLANE_NAMESPACE = upbound-system
-include build/makelib/local.xpkg.mk
-include build/makelib/controlplane.mk

# ====================================================================================
# Targets
Expand All @@ -52,32 +53,9 @@ build.init: $(UP)

# ====================================================================================
# End to End Testing

KIND_VERSION = v0.16.0
KIND_CLUSTER_NAME ?= uptest
PROVIDER_GCP_VERSION ?= v0.15.0
PROVIDER_HELM_VERSION ?= v0.12.0

controlplane.up: $(UP) $(KUBECTL) $(KIND)
@$(INFO) setting up controlplane
@$(KIND) get kubeconfig --name $(KIND_CLUSTER_NAME) >/dev/null 2>&1 || $(KIND) create cluster --name=$(KIND_CLUSTER_NAME)
@$(KUBECTL) -n upbound-system get cm universal-crossplane-config >/dev/null 2>&1 || $(UP) uxp install
@$(KUBECTL) -n upbound-system wait deploy crossplane --for condition=Available --timeout=120s
@$(KUBECTL) get provider.pkg upbound-provider-gcp > /dev/null 2>&1 || $(UP) ctp provider install upbound/provider-gcp:$(PROVIDER_GCP_VERSION)
@$(KUBECTL) get provider.pkg crossplane-contrib-provider-helm > /dev/null 2>&1 || $(UP) ctp provider install crossplane-contrib/provider-helm:$(PROVIDER_HELM_VERSION)
@$(KUBECTL) wait provider.pkg upbound-provider-gcp --for condition=Healthy --timeout=120s
@$(KUBECTL) wait provider.pkg crossplane-contrib-provider-helm --for condition=Healthy --timeout=120s
@$(OK) setting up controlplane

controlplane.down: $(UP) $(KUBECTL) $(KIND)
@$(INFO) deleting controlplane
@$(KIND) get kubeconfig --name $(KIND_CLUSTER_NAME) >/dev/null 2>&1 && $(KIND) delete cluster --name=$(KIND_CLUSTER_NAME)
@$(OK) deleting controlplane

uptest-local: $(UPTEST) $(KUBECTL) $(KUTTL)
uptest: build $(UPTEST) $(KUBECTL) $(KUTTL) local.xpkg.deploy-cfg.$(PROJECT_NAME)
@$(INFO) running automated tests
@$(KUBECTL) apply -R -f package/cluster
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e examples/cluster-claim.yaml --setup-script=test/setup.sh --default-timeout=2400 || $(FAIL)
@$(OK) running automated tests

e2e: controlplane.up uptest-local
e2e: controlplane.up uptest
6 changes: 3 additions & 3 deletions package/crossplane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ metadata:
customize to meet the exact needs of your organization!
spec:
crossplane:
version: ">=v1.7.0-0"
version: ">=v1.9.0-0"
dependsOn:
- provider: xpkg.upbound.io/upbound/provider-gcp
version: ">=v0.13.0"
- provider: xpkg.upbound.io/crossplane/provider-helm
version: ">=v0.11.1"
- provider: xpkg.upbound.io/crossplane-contrib/provider-helm
version: ">=v0.12.0"
7 changes: 7 additions & 0 deletions test/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@ set -aeuo pipefail

UPTEST_GCP_PROJECT=${UPTEST_GCP_PROJECT:-crossplane-playground}

echo "Running setup.sh"
echo "Waiting until configuration package is healthy/installed..."
${KUBECTL} wait configuration.pkg platform-ref-gcp --for=condition=Healthy --timeout 5m
${KUBECTL} wait configuration.pkg platform-ref-gcp --for=condition=Installed --timeout 5m

echo "Creating cloud credential secret"
${KUBECTL} -n upbound-system create secret generic gcp-creds --from-literal=credentials="${UPTEST_GCP_CREDS}" \
--dry-run=client -o yaml | ${KUBECTL} apply -f -

echo "Creating a default provider config"
cat <<EOF | ${KUBECTL} apply -f -
apiVersion: gcp.upbound.io/v1beta1
kind: ProviderConfig
Expand Down

0 comments on commit 27df30a

Please sign in to comment.