Skip to content

Commit 55ac08a

Browse files
hrakg-gaston
authored andcommitted
Update to CAPI v1.4
Signed-off-by: Hans Rakers <[email protected]>
1 parent 7ce8a27 commit 55ac08a

File tree

67 files changed

+513
-1249
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+513
-1249
lines changed

Makefile

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ GH_REPO ?= kubernetes-sigs/cluster-api-provider-cloudstack
2727

2828
# Binaries
2929
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/controller-gen
30-
GINKGO_V1 := $(TOOLS_BIN_DIR)/ginkgo_v1
31-
GINKGO_V2 := $(TOOLS_BIN_DIR)/ginkgo_v2
30+
GINKGO := $(TOOLS_BIN_DIR)/ginkgo
3231
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/golangci-lint
3332
KUSTOMIZE := $(TOOLS_BIN_DIR)/kustomize
3433
MOCKGEN := $(TOOLS_BIN_DIR)/mockgen
@@ -70,10 +69,6 @@ endif
7069
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
7170
# SHELL = /usr/bin/env bash -o pipefail
7271
.SHELLFLAGS = -ec
73-
# Quiet Ginkgo for now.
74-
# The warnings are in regards to a future release.
75-
export ACK_GINKGO_DEPRECATIONS := 1.16.5
76-
export ACK_GINKGO_RC=true
7772

7873
export PATH := $(TOOLS_BIN_DIR):$(PATH)
7974

@@ -85,7 +80,7 @@ all: build
8580
## --------------------------------------
8681

8782
.PHONY: binaries
88-
binaries: $(CONTROLLER_GEN) $(GOLANGCI_LINT) $(STATIC_CHECK) $(GINKGO_V1) $(GINKGO_V2) $(MOCKGEN) $(KUSTOMIZE) managers # Builds and installs all binaries
83+
binaries: $(CONTROLLER_GEN) $(GOLANGCI_LINT) $(STATIC_CHECK) $(GINKGO) $(MOCKGEN) $(KUSTOMIZE) managers # Builds and installs all binaries
8984

9085
.PHONY: managers
9186
managers:
@@ -95,7 +90,7 @@ managers:
9590
manager-cloudstack-infrastructure: ## Build manager binary.
9691
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -ldflags "${LDFLAGS} -extldflags '-static'" -o $(BIN_DIR)/manager .
9792

98-
export K8S_VERSION=1.25.0
93+
export K8S_VERSION=1.26.1
9994
$(KUBECTL) $(API_SERVER) $(ETCD) &:
10095
cd $(TOOLS_DIR) && curl --silent -L "https://go.kubebuilder.io/test-tools/${K8S_VERSION}/$(shell go env GOOS)/$(shell go env GOARCH)" --output - | \
10196
tar -C ./ --strip-components=1 -zvxf -
@@ -159,7 +154,7 @@ $(shell grep -qs "$(IMG)" config/default/manager_image_patch_edited.yaml || rm -
159154
generate-manifests: config/.flag.mk ## Generates crd, webhook, rbac, and other configuration manifests from kubebuilder instructions in go comments.
160155
config/.flag.mk: $(CONTROLLER_GEN) $(MANIFEST_GEN_INPUTS)
161156
sed -e 's@image: .*@image: '"$(IMG)"'@' config/default/manager_image_patch.yaml > config/default/manager_image_patch_edited.yaml
162-
$(CONTROLLER_GEN) crd:crdVersions=v1 rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
157+
$(CONTROLLER_GEN) crd:crdVersions=v1 rbac:roleName=manager-role webhook paths="{./api/...,./controllers/...}" output:crd:artifacts:config=config/crd/bases
163158
@touch config/.flag.mk
164159

165160
CONVERSION_GEN_TARGET=$(shell find api -type d -name "v*1" -exec echo {}\/zz_generated.conversion.go \;)
@@ -245,7 +240,7 @@ delete-kind-cluster:
245240
kind delete cluster --name $(KIND_CLUSTER_NAME)
246241

247242
cluster-api: ## Clone cluster-api repository for tilt use.
248-
git clone --branch v1.4.4 --depth 1 https://github.com/kubernetes-sigs/cluster-api.git
243+
git clone --branch v1.4.8 --depth 1 https://github.com/kubernetes-sigs/cluster-api.git
249244

250245
cluster-api/tilt-settings.json: hack/tilt-settings.json cluster-api
251246
cp ./hack/tilt-settings.json cluster-api
@@ -272,10 +267,10 @@ config/.flag-test.mk: $(CONTROLLER_GEN) $(MANIFEST_GEN_INPUTS_TEST)
272267

273268
.PHONY: test
274269
test: ## Run tests.
275-
test: generate-deepcopy-test generate-manifest-test generate-mocks lint $(GINKGO_V2) $(KUBECTL) $(API_SERVER) $(ETCD)
270+
test: generate-deepcopy-test generate-manifest-test generate-mocks lint $(GINKGO) $(KUBECTL) $(API_SERVER) $(ETCD)
276271
@./hack/testing_ginkgo_recover_statements.sh --add # Add ginkgo.GinkgoRecover() statements to controllers.
277272
@# The following is a slightly funky way to make sure the ginkgo statements are removed regardless the test results.
278-
@$(GINKGO_V2) --label-filter="!integ" --cover -coverprofile cover.out --covermode=atomic -v ./api/... ./controllers/... ./pkg/...; EXIT_STATUS=$$?;\
273+
@$(GINKGO) --label-filter="!integ" --cover -coverprofile cover.out --covermode=atomic -v ./api/... ./controllers/... ./pkg/...; EXIT_STATUS=$$?;\
279274
./hack/testing_ginkgo_recover_statements.sh --remove; exit $$EXIT_STATUS
280275

281276
CLUSTER_TEMPLATES_INPUT_FILES=$(shell find test/e2e/data/infrastructure-cloudstack/v1beta*/cluster-template* test/e2e/data/infrastructure-cloudstack/*/bases/* -type f)
@@ -285,15 +280,16 @@ e2e-cluster-templates: $(CLUSTER_TEMPLATES_OUTPUT_FILES) ## Generate cluster tem
285280
cluster-template%yaml: $(KUSTOMIZE) $(CLUSTER_TEMPLATES_INPUT_FILES)
286281
$(KUSTOMIZE) build --load-restrictor LoadRestrictionsNone $(basename $@) > $@
287282

288-
e2e-essentials: $(GINKGO_V1) $(KUBECTL) e2e-cluster-templates create-kind-cluster ## Fulfill essential tasks for e2e testing.
283+
e2e-essentials: $(GINKGO) $(KUBECTL) e2e-cluster-templates create-kind-cluster ## Fulfill essential tasks for e2e testing.
289284
IMG=$(IMG_LOCAL) make generate-manifests docker-build docker-push
290285

291286
JOB ?= .*
292287
E2E_CONFIG ?= ${REPO_ROOT}/test/e2e/config/cloudstack.yaml
288+
E2E_TIMEOUT ?= 3h
293289
run-e2e: e2e-essentials ## Run e2e testing. JOB is an optional REGEXP to select certainn test cases to run. e.g. JOB=PR-Blocking, JOB=Conformance
294290
$(KUBECTL) apply -f cloud-config.yaml && \
295291
cd test/e2e && \
296-
$(GINKGO_V1) -v -trace -tags=e2e -focus=$(JOB) -skip=Conformance -skipPackage=kubeconfig_helper -nodes=1 -noColor=false ./... -- \
292+
$(GINKGO) -v --trace --tags=e2e --focus=$(JOB) --timeout=$(E2E_TIMEOUT) --skip=Conformance --skip-package=kubeconfig_helper --nodes=1 --no-color=false ./... -- \
297293
-e2e.artifacts-folder=${REPO_ROOT}/_artifacts \
298294
-e2e.config=${E2E_CONFIG} \
299295
-e2e.skip-resource-cleanup=false -e2e.use-existing-cluster=true

config/certmanager/kustomization.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
13
resources:
24
- certificate.yaml
3-
45
configurations:
56
- kustomizeconfig.yaml

config/crd/bases/fakes.infrastructure.cluster.x-k8s.io_cloudstackmachineowners.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.8.0
6+
controller-gen.kubebuilder.io/version: v0.11.3
77
creationTimestamp: null
88
name: cloudstackmachineowners.fakes.infrastructure.cluster.x-k8s.io
99
spec:
@@ -59,9 +59,3 @@ spec:
5959
storage: true
6060
subresources:
6161
status: {}
62-
status:
63-
acceptedNames:
64-
kind: ""
65-
plural: ""
66-
conditions: []
67-
storedVersions: []

config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackaffinitygroups.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.8.0
6+
controller-gen.kubebuilder.io/version: v0.11.3
77
creationTimestamp: null
88
name: cloudstackaffinitygroups.infrastructure.cluster.x-k8s.io
99
spec:
@@ -170,9 +170,3 @@ spec:
170170
storage: true
171171
subresources:
172172
status: {}
173-
status:
174-
acceptedNames:
175-
kind: ""
176-
plural: ""
177-
conditions: []
178-
storedVersions: []

config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackclusters.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.8.0
6+
controller-gen.kubebuilder.io/version: v0.11.3
77
creationTimestamp: null
88
name: cloudstackclusters.infrastructure.cluster.x-k8s.io
99
spec:
@@ -234,6 +234,7 @@ spec:
234234
secret name must be unique.
235235
type: string
236236
type: object
237+
x-kubernetes-map-type: atomic
237238
domain:
238239
description: CloudStack domain.
239240
type: string
@@ -368,6 +369,7 @@ spec:
368369
secret name must be unique.
369370
type: string
370371
type: object
372+
x-kubernetes-map-type: atomic
371373
domain:
372374
description: CloudStack domain.
373375
type: string
@@ -448,9 +450,3 @@ spec:
448450
storage: true
449451
subresources:
450452
status: {}
451-
status:
452-
acceptedNames:
453-
kind: ""
454-
plural: ""
455-
conditions: []
456-
storedVersions: []

config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackfailuredomains.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.8.0
6+
controller-gen.kubebuilder.io/version: v0.11.3
77
creationTimestamp: null
88
name: cloudstackfailuredomains.infrastructure.cluster.x-k8s.io
99
spec:
@@ -52,6 +52,7 @@ spec:
5252
name must be unique.
5353
type: string
5454
type: object
55+
x-kubernetes-map-type: atomic
5556
domain:
5657
description: CloudStack domain.
5758
type: string
@@ -146,6 +147,7 @@ spec:
146147
name must be unique.
147148
type: string
148149
type: object
150+
x-kubernetes-map-type: atomic
149151
domain:
150152
description: CloudStack domain.
151153
type: string
@@ -203,9 +205,3 @@ spec:
203205
storage: true
204206
subresources:
205207
status: {}
206-
status:
207-
acceptedNames:
208-
kind: ""
209-
plural: ""
210-
conditions: []
211-
storedVersions: []

config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackisolatednetworks.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.8.0
6+
controller-gen.kubebuilder.io/version: v0.11.3
77
creationTimestamp: null
88
name: cloudstackisolatednetworks.infrastructure.cluster.x-k8s.io
99
spec:
@@ -223,9 +223,3 @@ spec:
223223
storage: true
224224
subresources:
225225
status: {}
226-
status:
227-
acceptedNames:
228-
kind: ""
229-
plural: ""
230-
conditions: []
231-
storedVersions: []

config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackmachines.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.8.0
6+
controller-gen.kubebuilder.io/version: v0.11.3
77
creationTimestamp: null
88
name: cloudstackmachines.infrastructure.cluster.x-k8s.io
99
spec:
@@ -107,6 +107,7 @@ spec:
107107
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
108108
type: string
109109
type: object
110+
x-kubernetes-map-type: atomic
110111
details:
111112
additionalProperties:
112113
type: string
@@ -342,6 +343,7 @@ spec:
342343
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
343344
type: string
344345
type: object
346+
x-kubernetes-map-type: atomic
345347
details:
346348
additionalProperties:
347349
type: string
@@ -566,6 +568,7 @@ spec:
566568
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
567569
type: string
568570
type: object
571+
x-kubernetes-map-type: atomic
569572
details:
570573
additionalProperties:
571574
type: string
@@ -702,9 +705,3 @@ spec:
702705
storage: true
703706
subresources:
704707
status: {}
705-
status:
706-
acceptedNames:
707-
kind: ""
708-
plural: ""
709-
conditions: []
710-
storedVersions: []

config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackmachinestatecheckers.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.8.0
6+
controller-gen.kubebuilder.io/version: v0.11.3
77
creationTimestamp: null
88
name: cloudstackmachinestatecheckers.infrastructure.cluster.x-k8s.io
99
spec:
@@ -135,9 +135,3 @@ spec:
135135
storage: true
136136
subresources:
137137
status: {}
138-
status:
139-
acceptedNames:
140-
kind: ""
141-
plural: ""
142-
conditions: []
143-
storedVersions: []

config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackmachinetemplates.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.8.0
6+
controller-gen.kubebuilder.io/version: v0.11.3
77
creationTimestamp: null
88
name: cloudstackmachinetemplates.infrastructure.cluster.x-k8s.io
99
spec:
@@ -94,6 +94,7 @@ spec:
9494
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
9595
type: string
9696
type: object
97+
x-kubernetes-map-type: atomic
9798
details:
9899
additionalProperties:
99100
type: string
@@ -294,6 +295,7 @@ spec:
294295
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
295296
type: string
296297
type: object
298+
x-kubernetes-map-type: atomic
297299
details:
298300
additionalProperties:
299301
type: string
@@ -475,6 +477,7 @@ spec:
475477
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
476478
type: string
477479
type: object
480+
x-kubernetes-map-type: atomic
478481
details:
479482
additionalProperties:
480483
type: string
@@ -578,9 +581,3 @@ spec:
578581
storage: true
579582
subresources:
580583
status: {}
581-
status:
582-
acceptedNames:
583-
kind: ""
584-
plural: ""
585-
conditions: []
586-
storedVersions: []

config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackzones.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.8.0
6+
controller-gen.kubebuilder.io/version: v0.11.3
77
creationTimestamp: null
88
name: cloudstackzones.infrastructure.cluster.x-k8s.io
99
spec:
@@ -71,9 +71,3 @@ spec:
7171
storage: true
7272
subresources:
7373
status: {}
74-
status:
75-
acceptedNames:
76-
kind: ""
77-
plural: ""
78-
conditions: []
79-
storedVersions: []

config/manager/manager.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ spec:
1717
spec:
1818
securityContext:
1919
runAsNonRoot: true
20+
seccompProfile:
21+
type: RuntimeDefault
2022
containers:
2123
- command:
2224
- /manager
@@ -28,6 +30,12 @@ spec:
2830
name: manager
2931
securityContext:
3032
allowPrivilegeEscalation: false
33+
capabilities:
34+
drop:
35+
- ALL
36+
privileged: false
37+
runAsUser: 65532
38+
runAsGroup: 65532
3139
livenessProbe:
3240
httpGet:
3341
path: /healthz

controllers/utils/base_reconciler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func (r *ReconciliationRunner) Else(fn CloudStackReconcilerMethod) CloudStackRec
163163
// GetCAPICluster gets the CAPI cluster the reconciliation subject belongs to.
164164
func (r *ReconciliationRunner) GetCAPICluster() (ctrl.Result, error) {
165165
r.Log.V(1).Info("Getting CAPI cluster.")
166-
name := r.ReconciliationSubject.GetLabels()[clusterv1.ClusterLabelName]
166+
name := r.ReconciliationSubject.GetLabels()[clusterv1.ClusterNameLabel]
167167
if name == "" {
168168
r.Log.V(1).Info("Reconciliation Subject is missing cluster label or cluster does not exist. Skipping CAPI Cluster fetch.",
169169
"SubjectKind", r.ReconciliationSubject.GetObjectKind().GroupVersionKind().Kind)
@@ -185,7 +185,7 @@ func (r *ReconciliationRunner) GetCAPICluster() (ctrl.Result, error) {
185185
// GetCSCluster gets the CAPI cluster the reconciliation subject belongs to.
186186
func (r *ReconciliationRunner) GetCSCluster() (ctrl.Result, error) {
187187
r.Log.V(1).Info("Getting CloudStackCluster cluster.")
188-
name := r.ReconciliationSubject.GetLabels()[clusterv1.ClusterLabelName]
188+
name := r.ReconciliationSubject.GetLabels()[clusterv1.ClusterNameLabel]
189189
if name == "" {
190190
r.Log.V(1).Info("Reconciliation Subject is missing cluster label or cluster does not exist. Skipping CloudStackCluster fetch.",
191191
"SubjectKind", r.ReconciliationSubject.GetObjectKind().GroupVersionKind().Kind)
@@ -482,7 +482,7 @@ func (r *ReconciliationRunner) NewChildObjectMeta(name string) metav1.ObjectMeta
482482
return metav1.ObjectMeta{
483483
Name: strings.ToLower(name),
484484
Namespace: r.Request.Namespace,
485-
Labels: map[string]string{clusterv1.ClusterLabelName: r.CAPICluster.Name},
485+
Labels: map[string]string{clusterv1.ClusterNameLabel: r.CAPICluster.Name},
486486
OwnerReferences: []metav1.OwnerReference{
487487
*metav1.NewControllerRef(r.ReconciliationSubject, ownerGVK),
488488
},

0 commit comments

Comments
 (0)