Skip to content

Commit

Permalink
Bump CI Go version to 1.16
Browse files Browse the repository at this point in the history
- Make kind version used in e2e tests configurable
- Update kind version to 0.11.1
- Update kind node image version to 1.19.11
- These are needed to get e2e tests running. Please see:
  crossplane-contrib/provider-aws#782 (comment)

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
  • Loading branch information
ulucinar committed Aug 19, 2021
1 parent d7e7249 commit 031156b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

env:
# Common versions
GO_VERSION: '1.14'
GO_VERSION: '1.16'
GOLANGCI_VERSION: 'v1.31'
DOCKER_BUILDX_VERSION: 'v0.4.2'

Expand Down
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ PROJECT_NAME := provider-azure
PROJECT_REPO := github.com/crossplane/$(PROJECT_NAME)

PLATFORMS ?= linux_amd64 linux_arm64

# kind-related versions
KIND_VERSION ?= v0.11.1
KIND_NODE_IMAGE_TAG ?= v1.19.11
# -include will silently skip missing files, which allows us
# to load those files with a target in the Makefile. If only
# "include" was used, the make command would fail and refuse
Expand Down Expand Up @@ -92,7 +96,7 @@ e2e.run: test-integration
# Run integration tests.
test-integration: $(KIND) $(KUBECTL) $(HELM3)
@$(INFO) running integration tests using kind $(KIND_VERSION)
@$(ROOT_DIR)/cluster/local/integration_tests.sh || $(FAIL)
@KIND_NODE_IMAGE_TAG=${KIND_NODE_IMAGE_TAG} KIND_VERSION=${KIND_VERSION} $(ROOT_DIR)/cluster/local/integration_tests.sh || $(FAIL)
@$(OK) integration tests passed

# Update the submodules, such as the common build scripts.
Expand All @@ -115,6 +119,8 @@ manifests:
# using unit tests.
KUBEBUILDER_VERSION ?= 1.0.8
KUBEBUILDER := $(TOOLS_HOST_DIR)/kubebuilder-$(KUBEBUILDER_VERSION)
KUBEBUILDER_OS ?= $(GOHOSTOS)
KUBEBUILDER_ARCH ?= $(GOHOSTARCH)
TEST_ASSET_KUBE_APISERVER := $(KUBEBUILDER)/kube-apiserver
TEST_ASSET_ETCD := $(KUBEBUILDER)/etcd
export TEST_ASSET_KUBE_APISERVER TEST_ASSET_ETCD
Expand Down Expand Up @@ -150,7 +156,7 @@ help-special: crossplane.help
$(KUBEBUILDER):
@$(INFO) installing kubebuilder $(KUBEBUILDER_VERSION)
@mkdir -p $(TOOLS_HOST_DIR)/tmp || $(FAIL)
@curl -fsSL https://github.com/kubernetes-sigs/kubebuilder/releases/download/v$(KUBEBUILDER_VERSION)/kubebuilder_$(KUBEBUILDER_VERSION)_$(GOHOSTOS)_$(GOHOSTARCH).tar.gz | tar -xz -C $(TOOLS_HOST_DIR)/tmp || $(FAIL)
@mv $(TOOLS_HOST_DIR)/tmp/kubebuilder_$(KUBEBUILDER_VERSION)_$(GOHOSTOS)_$(GOHOSTARCH)/bin $(KUBEBUILDER) || $(FAIL)
@curl -fsSL https://github.com/kubernetes-sigs/kubebuilder/releases/download/v$(KUBEBUILDER_VERSION)/kubebuilder_$(KUBEBUILDER_VERSION)_$(KUBEBUILDER_OS)_$(KUBEBUILDER_ARCH).tar.gz | tar -xz -C $(TOOLS_HOST_DIR)/tmp || $(FAIL)
@mv $(TOOLS_HOST_DIR)/tmp/kubebuilder_$(KUBEBUILDER_VERSION)_$(KUBEBUILDER_OS)_$(KUBEBUILDER_ARCH)/bin $(KUBEBUILDER) || $(FAIL)
@rm -fr $(TOOLS_HOST_DIR)/tmp
@$(OK) installing kubebuilder $(KUBEBUILDER_VERSION)
5 changes: 3 additions & 2 deletions cluster/local/integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ echo "created cache dir at ${CACHE_PATH}"
docker save "${BUILD_IMAGE}" -o "${CACHE_PATH}/${PACKAGE_NAME}.xpkg" && chmod 644 "${CACHE_PATH}/${PACKAGE_NAME}.xpkg"

# create kind cluster with extra mounts
echo_step "creating k8s cluster using kind"
KIND_NODE_IMAGE="kindest/node:${KIND_NODE_IMAGE_TAG}"
echo_step "creating k8s cluster using kind ${KIND_VERSION} and node image ${KIND_NODE_IMAGE}"
KIND_CONFIG="$( cat <<EOF
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
Expand All @@ -82,7 +83,7 @@ nodes:
containerPath: /cache
EOF
)"
echo "${KIND_CONFIG}" | "${KIND}" create cluster --name="${K8S_CLUSTER}" --wait=5m --config=-
echo "${KIND_CONFIG}" | "${KIND}" create cluster --name="${K8S_CLUSTER}" --wait=5m --image="${KIND_NODE_IMAGE}" --config=-

# tag controller image and load it into kind cluster
docker tag "${CONTROLLER_IMAGE}" "${PACKAGE_CONTROLLER_IMAGE}"
Expand Down
9 changes: 5 additions & 4 deletions pkg/controller/database/postgresqlserver/managed.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ func (e *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex
}

func (e *external) getPassword(ctx context.Context, cr *v1beta1.PostgreSQLServer) (string, error) {
if cr == nil || cr.Spec.WriteConnectionSecretToReference.Name == "" || cr.Spec.WriteConnectionSecretToReference.Namespace == "" {
if cr.Spec.WriteConnectionSecretToReference == nil ||
cr.Spec.WriteConnectionSecretToReference.Name == "" || cr.Spec.WriteConnectionSecretToReference.Namespace == "" {
return "", nil
}

Expand Down Expand Up @@ -179,9 +180,9 @@ func (e *external) Create(ctx context.Context, mg resource.Managed) (managed.Ext
}
if pw == "" {
pw, err = e.newPasswordFn()
}
if err != nil {
return managed.ExternalCreation{}, errors.Wrap(err, errGenPassword)
if err != nil {
return managed.ExternalCreation{}, errors.Wrap(err, errGenPassword)
}
}
if err := e.client.CreateServer(ctx, cr, pw); err != nil {
return managed.ExternalCreation{}, errors.Wrap(err, errCreatePostgreSQLServer)
Expand Down

0 comments on commit 031156b

Please sign in to comment.