Skip to content

Commit

Permalink
Upgrade Crossplane, Kube, Controller runtime, ... (#169)
Browse files Browse the repository at this point in the history
* Upgrade Crossplane, Kube, Controller runtime, ...

* Use only Helm for Crossplane deployment

* Use make target for kuttl at CI

---------

Co-authored-by: Richard Kovacs <[email protected]>
  • Loading branch information
mhmxs and Richard Kovacs authored Feb 29, 2024
1 parent 7c2ec0c commit c71af44
Show file tree
Hide file tree
Showing 25 changed files with 617 additions and 1,212 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/kuttl-e2e-test-1.26.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ jobs:
sudo chmod +x $KUTTL
- name: Build
run: make submodules build
- name: Create test environment
run: make crossplane-cluster load-package
- name: Run kuttl tests 1.26
run: kubectl-kuttl test --config e2e/kuttl/stable/provider-ceph-1.26.yaml
run: make kuttl
env:
LATEST_KUBE_VERSION: '1.26'
AWS_ACCESS_KEY_ID: 'Dummy'
AWS_SECRET_ACCESS_KEY: 'Dummy'
AWS_DEFAULT_REGION: 'us-east-1'
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/kuttl-e2e-test-1.27.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ jobs:
sudo chmod +x $KUTTL
- name: Build
run: make submodules build
- name: Create test environment
run: make crossplane-cluster load-package
- name: Run kuttl tests 1.27
run: kubectl-kuttl test --config e2e/kuttl/stable/provider-ceph-1.27.yaml
run: make kuttl
env:
LATEST_KUBE_VERSION: '1.27'
AWS_ACCESS_KEY_ID: 'Dummy'
AWS_SECRET_ACCESS_KEY: 'Dummy'
AWS_DEFAULT_REGION: 'us-east-1'
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/kuttl-e2e-test-1.28.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ jobs:
sudo chmod +x $KUTTL
- name: Build
run: make submodules build
- name: Create test environment
run: make crossplane-cluster load-package
- name: Run kuttl tests 1.28
run: kubectl-kuttl test --config e2e/kuttl/stable/provider-ceph-1.28.yaml
run: make kuttl
env:
LATEST_KUBE_VERSION: '1.28'
AWS_ACCESS_KEY_ID: 'Dummy'
AWS_SECRET_ACCESS_KEY: 'Dummy'
AWS_DEFAULT_REGION: 'us-east-1'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# This file was auto-generated by hack/generate-tests.sh
name: kuttl e2e test 1.25
name: kuttl e2e test 1.29
on: [push]
concurrency:
group: kuttl-1.25-${{ github.ref }}-1
group: kuttl-1.29-${{ github.ref }}-1
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
name: kuttl e2e test 1.25
name: kuttl e2e test 1.29
runs-on: ubuntu-latest
env:
KUTTL: /usr/local/bin/kubectl-kuttl
Expand All @@ -27,11 +27,10 @@ jobs:
sudo chmod +x $KUTTL
- name: Build
run: make submodules build
- name: Create test environment
run: make crossplane-cluster load-package
- name: Run kuttl tests 1.25
run: kubectl-kuttl test --config e2e/kuttl/stable/provider-ceph-1.25.yaml
- name: Run kuttl tests 1.29
run: make kuttl
env:
LATEST_KUBE_VERSION: '1.29'
AWS_ACCESS_KEY_ID: 'Dummy'
AWS_SECRET_ACCESS_KEY: 'Dummy'
AWS_DEFAULT_REGION: 'us-east-1'
Expand Down
5 changes: 4 additions & 1 deletion .mirrord/mirrord.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ MIRRORD_VERSION ?= 3.88.0
MIRRORD := $(TOOLS_HOST_DIR)/mirrord-$(MIRRORD_VERSION)

# Best for development - locally run provider-ceph controller.
mirrord.cluster: dev-cluster crossplane-cluster load-package
mirrord.cluster: generate-pkg generate-tests crossplane-cluster localstack-cluster load-package
@$(KUBECTL) apply -R -f package/crds
# @$(KUBECTL) apply -R -f package/webhookconfigurations
$(KUBECTL) apply -f $(PROJECT_ROOT)/e2e/localstack/localstack-provider-cfg.yaml

mirrord.run: $(MIRRORD)
@$(INFO) Starting mirrord on deployment
Expand Down
36 changes: 20 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@
# Setup Project
PROJECT_NAME := provider-ceph
PROJECT_REPO := github.com/linode/$(PROJECT_NAME)
PROJECT_ROOT = $(shell git rev-parse --show-toplevel)

PLATFORMS ?= linux_amd64 linux_arm64
-include build/makelib/common.mk

# Generate kuttl e2e tests for the following kind node versions
# TEST_KIND_NODES is not intended to be updated manually.
# Please edit LATEST_KIND_NODE instead and run 'make update-kind-nodes'.
TEST_KIND_NODES ?= 1.25.11,1.26.6,1.27.3,1.28.0
TEST_KIND_NODES ?= 1.26.14,1.27.11,1.28.7,1.29.2

LATEST_KUBE_VERSION ?= 1.28
LATEST_KIND_NODE ?= 1.28.0
LATEST_KUBE_VERSION ?= 1.29
LATEST_KIND_NODE ?= 1.29.2
REPO ?= provider-ceph

KUTTL_VERSION ?= 0.15.0

CROSSPLANE_VERSION ?= 1.14.6
CROSSPLANE_VERSION ?= 1.15.0

# For local development
ASSUME_ROLE_ARN ?= "arn:akamai:sts:::assumed-role/TestRole"

# For local development, usually IP of docker0.
WEBHOOK_HOST ?= 172.17.0.1
Expand All @@ -38,7 +42,7 @@ GO_STATIC_PACKAGES = $(GO_PROJECT)/cmd/provider
GO_LDFLAGS += -X $(GO_PROJECT)/internal/version.Version=$(VERSION)
GO_SUBDIRS += cmd internal apis
GO111MODULE = on
GOLANGCILINT_VERSION ?= 1.55.2
GOLANGCILINT_VERSION ?= 1.56.2
-include build/makelib/golang.mk

# ====================================================================================
Expand Down Expand Up @@ -124,17 +128,19 @@ run: go.build
@# To see other arguments that can be provided, run the command with --help instead
$(GO_OUT_DIR)/provider --zap-devel --webhook-tls-cert-dir=$(PWD)/bin/certs --webhook-host=$(WEBHOOK_HOST)

# Spin up a Kind cluster and localstack.
# Create k8s service to allows pods to communicate with
# localstack.
# Spin up a Kind cluster.
cluster: $(KIND) $(KUBECTL) cluster-clean
docker pull localstack/localstack:2.2
@$(INFO) Creating kind cluster
@$(KIND) create cluster --name=$(KIND_CLUSTER_NAME) --config e2e/kind/kind-config-$(LATEST_KUBE_VERSION).yaml
@$(KIND) load docker-image --name=$(KIND_CLUSTER_NAME) localstack/localstack:2.2
@$(OK) Creating kind cluster

# Spin up a Kind cluster and localstack and install Crossplane via Helm.
# Spin up localstack cluster.
localstack-cluster: $(KIND) $(KUBECTL)
docker pull localstack/localstack:2.2
@$(KIND) load docker-image --name=$(KIND_CLUSTER_NAME) localstack/localstack:2.2
@$(KUBECTL) apply -R -f e2e/localstack/localstack-deployment.yaml

# Spin up a Kind cluster and install Crossplane via Helm.
crossplane-cluster: $(HELM3) cluster
@$(INFO) Installing Crossplane
@$(HELM3) repo add crossplane-stable https://charts.crossplane.io/stable
Expand Down Expand Up @@ -175,7 +181,7 @@ load-package: $(KIND) build kustomize-webhook
# to the Provider.
# Run Kuttl test suite on newly built controller image.
# Destroy Kind and localstack.
kuttl: $(KUTTL) crossplane-cluster load-package
kuttl: $(KUTTL) crossplane-cluster localstack-cluster load-package
@$(INFO) Running kuttl test suite
@$(KUTTL) test --config e2e/kuttl/stable/provider-ceph-$(LATEST_KUBE_VERSION).yaml
@$(OK) Running kuttl test suite
Expand All @@ -191,7 +197,7 @@ ceph-kuttl: $(KIND) $(KUTTL) $(HELM3) cluster-clean
# containerised Crossplane componenets).
# Install local provider-ceph CRDs.
# Create ProviderConfig CR representing localstack.
dev-cluster: $(KUBECTL) generate-pkg generate-tests cluster
dev-cluster: $(KUBECTL) generate-pkg generate-tests crossplane-cluster localstack-cluster
@rm -rf $(PWD)/bin/certs ; mkdir $(PWD)/bin/certs
@docker cp local-dev-control-plane:/etc/kubernetes/pki/ca.key $(PWD)/bin/certs/ca.key
@docker cp local-dev-control-plane:/etc/kubernetes/pki/ca.crt $(PWD)/bin/certs/ca.crt
Expand Down Expand Up @@ -226,10 +232,8 @@ dev-cluster: $(KUBECTL) generate-pkg generate-tests cluster
@$(OK) Rendering webhook manifest.

@$(INFO) Installing CRDs, ProviderConfig and Localstack
@$(KUBECTL) apply -k https://github.com/crossplane/crossplane/cluster?ref=v$(CROSSPLANE_VERSION)
@$(KUBECTL) apply -R -f package/crds
@$(KUBECTL) apply -R -f package/webhookconfigurations
@$(KUBECTL) apply -R -f e2e/localstack/localstack-deployment.yaml
@$(KUBECTL) apply -R -f e2e/localstack/localstack-provider-cfg-host.yaml
@$(OK) Installing CRDs and ProviderConfig

Expand Down Expand Up @@ -339,7 +343,7 @@ $(NILAWAY):
@mv $(TOOLS_HOST_DIR)/nilaway $(NILAWAY)
@$(OK) installing nilaway $(NILAWAY_VERSION)

GOVULNCHECK_VERSION ?= v1.0.1
GOVULNCHECK_VERSION ?= v1.0.4
GOVULNCHECK := $(TOOLS_HOST_DIR)/govulncheck-$(GOVULNCHECK_VERSION)

.PHONY: vulncheck
Expand Down
16 changes: 0 additions & 16 deletions apis/provider-ceph/v1alpha1/zz_generated.managed.go

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

2 changes: 1 addition & 1 deletion cmd/provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (
"path/filepath"
"time"

"github.com/alecthomas/kingpin/v2"
"github.com/linode/provider-ceph/internal/otel/traces"
"go.uber.org/zap/zapcore"
"gopkg.in/alecthomas/kingpin.v2"
kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
Expand Down
2 changes: 1 addition & 1 deletion e2e/kind/kind-config-1.26.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.26.6
image: kindest/node:v1.26.14
extraPortMappings:
- containerPort: 32566
hostPort: 32566
Expand Down
2 changes: 1 addition & 1 deletion e2e/kind/kind-config-1.27.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.27.3
image: kindest/node:v1.27.11
extraPortMappings:
- containerPort: 32566
hostPort: 32566
Expand Down
2 changes: 1 addition & 1 deletion e2e/kind/kind-config-1.28.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.28.0
image: kindest/node:v1.28.7
extraPortMappings:
- containerPort: 32566
hostPort: 32566
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.25.11
image: kindest/node:v1.29.2
extraPortMappings:
- containerPort: 32566
hostPort: 32566
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: kuttl.dev/v1beta1
kind: TestSuite
testDirs:
- ./e2e/tests/ceph
kindConfig: e2e/kind/kind-config-1.25.yaml
kindConfig: e2e/kind/kind-config-1.29.yaml
startKIND: false
kindNodeCache: true
timeout: 120
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: kuttl.dev/v1beta1
kind: TestSuite
testDirs:
- ./e2e/tests/stable
kindConfig: e2e/kind/kind-config-1.25.yaml
kindConfig: e2e/kind/kind-config-1.29.yaml
startKIND: false
kindNodeCache: true
kindContainers:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: kubectl apply -f ../../../localstack/localstack-deployment.yaml
- command: kubectl apply -f ../../../localstack/localstack-provider-cfg.yaml
Loading

0 comments on commit c71af44

Please sign in to comment.