Skip to content

Commit

Permalink
feat: tests, firewall rules, and more
Browse files Browse the repository at this point in the history
  • Loading branch information
ka-myl committed Apr 10, 2024
1 parent 369375b commit 402021f
Show file tree
Hide file tree
Showing 25 changed files with 2,028 additions and 110 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ cover.out
# ignore IDE folders
.vscode/
.idea/

# ignore kubeconfig that is copied when running tests
kubeconfig
51 changes: 31 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
PROJECT_NAME ?= provider-upcloud
PROJECT_REPO ?= github.com/UpCloudLtd/$(PROJECT_NAME)

export TERRAFORM_VERSION ?= 1.2.1
export TERRAFORM_VERSION ?= 1.7.5

export TERRAFORM_PROVIDER_SOURCE ?= UpCloudLtd/upcloud
export TERRAFORM_PROVIDER_REPO ?= https://github.com/UpCloudLtd/terraform-provider-upcloud
export TERRAFORM_PROVIDER_VERSION ?= 5.2.1
export TERRAFORM_PROVIDER_DOWNLOAD_NAME ?= terraform-provider-upcloud
export TERRAFORM_PROVIDER_DOWNLOAD_URL_PREFIX ?= https://releases.hashicorp.com/$(TERRAFORM_PROVIDER_DOWNLOAD_NAME)/$(TERRAFORM_PROVIDER_VERSION)
export TERRAFORM_NATIVE_PROVIDER_BINARY ?= terraform-provider-upcloud_v5.2.1
export TERRAFORM_PROVIDER_DOWNLOAD_URL_PREFIX ?= https://github.com/UpCloudLtd/terraform-provider-upcloud/releases/download/v${TERRAFORM_PROVIDER_VERSION}
export TERRAFORM_NATIVE_PROVIDER_BINARY ?= terraform-provider-upcloud_v${TERRAFORM_PROVIDER_VERSION}
export TERRAFORM_DOCS_PATH ?= docs/resources


Expand Down Expand Up @@ -50,10 +50,10 @@ GO_SUBDIRS += cmd internal apis
# ====================================================================================
# Setup Kubernetes tools

KIND_VERSION = v0.15.0
UP_VERSION = v0.18.0
KIND_VERSION = v0.22.0
UP_VERSION = v0.28.0
UP_CHANNEL = stable
UPTEST_VERSION = v0.5.0
UPTEST_VERSION = v0.11.1
-include build/makelib/k8s_tools.mk

# ====================================================================================
Expand Down Expand Up @@ -167,22 +167,12 @@ CROSSPLANE_NAMESPACE = upbound-system
-include build/makelib/controlplane.mk

# 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.
# You can check the basic implementation here: https://github.com/upbound/uptest/blob/main/internal/upclouds/01-delete.yaml.tmpl.
# - UPTEST_CLOUD_CREDENTIALS (optional), multiple sets of AWS IAM User credentials specified as key=value pairs.
# The support keys are currently `DEFAULT` and `PEER`. So, an example for the value of this env. variable is:
# DEFAULT='[default]
# aws_access_key_id = REDACTED
# aws_secret_access_key = REDACTED'
# PEER='[default]
# aws_access_key_id = REDACTED
# aws_secret_access_key = REDACTED'
# The associated `ProviderConfig`s will be named as `default` and `peer`.
# - UPCLOUD_USERNAME - username of the account that will be used for testing
# - UPCLOUD_PASSWORD - password of the account that will be used for testing
# - UPTEST_DATASOURCE_PATH (optional), see https://github.com/upbound/uptest#injecting-dynamic-values-and-datasource
uptest: $(UPTEST) $(KUBECTL) $(KUTTL)
@$(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) KUTTL=$(KUTTL) CROSSPLANE_NAMESPACE=${CROSSPLANE_NAMESPACE} $(UPTEST) e2e $(shell find examples/basic/*.yaml | tr '\n' ',') --data-source="${UPTEST_DATASOURCE_PATH}" --setup-script=cluster/test/setup.sh --default-timeout=2400 --default-conditions="Ready" || $(FAIL)
@$(OK) running automated tests

local-deploy: build controlplane.up local.xpkg.deploy.provider.$(PROJECT_NAME)
Expand All @@ -191,7 +181,7 @@ local-deploy: build controlplane.up local.xpkg.deploy.provider.$(PROJECT_NAME)
@$(KUBECTL) -n upbound-system wait --for=condition=Available deployment --all --timeout=5m
@$(OK) running locally built provider

e2e: local-deploy uptest
e2e: controlplane.down local-deploy uptest

crddiff: $(UPTEST)
@$(INFO) Checking breaking CRD schema changes
Expand Down Expand Up @@ -242,3 +232,24 @@ crossplane.help:
help-special: crossplane.help

.PHONY: crossplane.help help-special

# ====================================================================================
# Local development

install: $(KUBECTL)
@$(INFO) installing crds
@$(KUBECTL) apply -f package/crds/

deploy-providerconfig: $(KUBECTL)
@$(KUBECTL) create namespace upcloud-example --dry-run=client -o yaml | kubectl apply -f -
@$(KUBECTL) apply -f examples/providerconfig/

delete-providerconfig: $(KUBECTL)
@$(KUBECTL) delete --ignore-not-found=true -f examples/providerconfig/
@$(KUBECTL) delete --ignore-not-found=true ns upcloud-example

deploy-examples: $(KUBECTL)
@$(KUBECTL) apply -f examples/basic/

delete-examples: $(KUBECTL)
@$(KUBECTL) delete --ignore-not-found=true -f examples/basic/
129 changes: 129 additions & 0 deletions apis/server/v1beta1/zz_firewallrules_terraformed.go

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

Loading

0 comments on commit 402021f

Please sign in to comment.