Skip to content

Commit d349e0a

Browse files
AmitSahastraKun483jayesh-srivastava
authored
Bump cluster api to v1.9.4 and refactor the code accordingly (#164)
* Bump cluster api to v1.9.4 and refactor the code accordingly 1. Bumped cluster api to v1.9.4 2. Refactored deprecated code a) Added scheme to `predicates.ResourceNotPaused` b) Changed parameter in `controller.TypedController[reconcile.Request].Watch()` * upgrade go version to 1.22 in hack/tools and main, upgrade controller_gen and conversion_gen to 0.16.1, fix deprecated arg in Makefile accordingly * go version change for docker, release 1.0.0 * Code changes to read NewProviderID Check for nil systemID Code refactor for watches * Removed pod-eviction-timeout from sample templates * Change tag to v0.6.0 (#166) --------- Co-authored-by: kun zhou <[email protected]> Co-authored-by: Jayesh Srivastava <[email protected]>
1 parent 3344ecd commit d349e0a

22 files changed

+673
-812
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM golang:1.19.8 as builder
2+
FROM golang:1.23.6 as builder
33

44
WORKDIR /workspace
55
# Copy the Go Modules manifests

Makefile

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ BUILD_DIR :=_build
1212
RELEASE_DIR := _build/release
1313
DEV_DIR := _build/dev
1414
REPO_ROOT := $(shell git rev-parse --show-toplevel)
15+
ARCH ?= amd64
16+
ALL_ARCH = amd64 arm64
1517

1618
# Image URL to use all building/pushing image targets
1719
IMAGE_NAME := cluster-api-provider-maas-controller
1820
IMG_URL ?= gcr.io/spectro-dev-public/release/cluster-api
19-
IMG_TAG ?= v0.5.0
21+
IMG_TAG ?= v0.6.0
2022
IMG ?= ${IMG_URL}/${IMAGE_NAME}:${IMG_TAG}
2123

2224
# Set --output-base for conversion-gen if we are not within GOPATH
@@ -32,7 +34,7 @@ RELEASE_REGISTRY := gcr.io/spectro-images-public/release/cluster-api-provider-ma
3234
RELEASE_CONTROLLER_IMG := $(RELEASE_REGISTRY)/$(IMAGE_NAME)
3335

3436
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
35-
CRD_OPTIONS ?= "crd:trivialVersions=true"
37+
CRD_OPTIONS ?= "crd"
3638

3739
MOCKGEN := $(TOOLS_BIN_DIR)/mockgen
3840
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/controller-gen
@@ -137,23 +139,47 @@ generate-go:
137139
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
138140

139141
$(CONVERSION_GEN) \
140-
--input-dirs=./api/v1beta1 \
141142
--extra-peer-dirs=github.com/spectrocloud/cluster-api-provider-maas/api/v1beta1 \
142-
--build-tag=ignore_autogenerated_core_v1alpha3 \
143-
--output-file-base=zz_generated.conversion $(GEN_OUTPUT_BASE) \
144-
--go-header-file=./hack/boilerplate.go.txt
143+
--output-file=zz_generated.conversion \
144+
--go-header-file=./hack/boilerplate.go.txt \
145+
--v=5 \
146+
./api/v1beta1
145147

146148
generate-manifests: ## Generate manifests
147149
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
148150

149151

150152
# Build the docker image
151153
docker-build: #test
152-
docker build . -t ${IMG}
154+
docker buildx build --load --platform linux/$(ARCH) ${BUILD_ARGS} --build-arg ARCH=$(ARCH) --build-arg LDFLAGS="$(LDFLAGS)" --build-arg CRYPTO_LIB=${FIPS_ENABLE} . -t ${IMG}-$(ARCH)
153155

154156
# Push the docker image
155157
docker-push: ## Push the docker image to gcr
156-
docker push ${IMG}
158+
# docker push ${IMG}
159+
docker push ${IMG}-$(ARCH)
160+
161+
### --------------------------------------
162+
### Docker — All ARCH
163+
### --------------------------------------
164+
#.PHONY: docker-build-all ## Build all the architecture docker images
165+
#docker-build-all: $(addprefix docker-build-,$(ALL_ARCH))
166+
#
167+
#docker-build-%:
168+
# $(MAKE) ARCH=$* docker-build
169+
#
170+
#.PHONY: docker-push-all ## Push all the architecture docker images
171+
#docker-push-all: $(addprefix docker-push-,$(ALL_ARCH))
172+
# $(MAKE) docker-push-manifest
173+
#
174+
#docker-push-%:
175+
# $(MAKE) ARCH=$* docker-push
176+
#
177+
#.PHONY: docker-push-manifest
178+
#docker-push-manifest: ## Push the fat manifest docker image.
179+
# ## Minimum docker version 18.06.0 is required for creating and pushing manifest images.
180+
# docker manifest create --amend ${IMG}-$(ARCH) $(shell echo $(ALL_ARCH) | sed -e "s~[^ ]*~$(IMG)\-&:$(ARCH)~g")
181+
# @for arch in $(ALL_ARCH); do docker manifest annotate --arch $${arch} ${CONTROLLER_IMG}:${IMG_TAG} ${CONTROLLER_IMG}-$${arch}:${IMG_TAG}; done
182+
#docker manifest push --insecure --purge $(CONTROLLER_IMG):$(IMG_TAG)
157183

158184
docker-rmi: ## Remove the docker image locally
159185
docker rmi ${IMG}

clusterctl-settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"name": "infrastructure-maas",
33
"config": {
44
"componentsFile": "infrastructure-components.yaml",
5-
"nextVersion": "v0.5.0"
5+
"nextVersion": "v0.6.0"
66
}
77
}
Lines changed: 47 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
21
---
32
apiVersion: apiextensions.k8s.io/v1
43
kind: CustomResourceDefinition
54
metadata:
65
annotations:
7-
controller-gen.kubebuilder.io/version: v0.6.1
8-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.16.1
97
name: maasclusters.infrastructure.cluster.x-k8s.io
108
spec:
119
group: infrastructure.cluster.x-k8s.io
@@ -24,14 +22,19 @@ spec:
2422
description: MaasCluster is the Schema for the maasclusters API
2523
properties:
2624
apiVersion:
27-
description: 'APIVersion defines the versioned schema of this representation
28-
of an object. Servers should convert recognized schemas to the latest
29-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
25+
description: |-
26+
APIVersion defines the versioned schema of this representation of an object.
27+
Servers should convert recognized schemas to the latest internal value, and
28+
may reject unrecognized values.
29+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
3030
type: string
3131
kind:
32-
description: 'Kind is a string value representing the REST resource this
33-
object represents. Servers may infer this from the endpoint the client
34-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
32+
description: |-
33+
Kind is a string value representing the REST resource this object represents.
34+
Servers may infer this from the endpoint the client submits requests to.
35+
Cannot be updated.
36+
In CamelCase.
37+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3538
type: string
3639
metadata:
3740
type: object
@@ -58,8 +61,9 @@ spec:
5861
minLength: 1
5962
type: string
6063
failureDomains:
61-
description: FailureDomains are not usually defined on the spec. but
62-
useful for MaaS since we can limit the domains to these
64+
description: |-
65+
FailureDomains are not usually defined on the spec.
66+
but useful for MaaS since we can limit the domains to these
6367
items:
6468
type: string
6569
type: array
@@ -76,37 +80,37 @@ spec:
7680
operational state.
7781
properties:
7882
lastTransitionTime:
79-
description: Last time the condition transitioned from one status
80-
to another. This should be when the underlying condition changed.
81-
If that is not known, then using the time when the API field
82-
changed is acceptable.
83+
description: |-
84+
Last time the condition transitioned from one status to another.
85+
This should be when the underlying condition changed. If that is not known, then using the time when
86+
the API field changed is acceptable.
8387
format: date-time
8488
type: string
8589
message:
86-
description: A human readable message indicating details about
87-
the transition. This field may be empty.
90+
description: |-
91+
A human readable message indicating details about the transition.
92+
This field may be empty.
8893
type: string
8994
reason:
90-
description: The reason for the condition's last transition
91-
in CamelCase. The specific API may choose whether or not this
92-
field is considered a guaranteed API. This field may not be
93-
empty.
95+
description: |-
96+
The reason for the condition's last transition in CamelCase.
97+
The specific API may choose whether or not this field is considered a guaranteed API.
98+
This field may be empty.
9499
type: string
95100
severity:
96-
description: Severity provides an explicit classification of
97-
Reason code, so the users or machines can immediately understand
98-
the current situation and act accordingly. The Severity field
99-
MUST be set only when Status=False.
101+
description: |-
102+
severity provides an explicit classification of Reason code, so the users or machines can immediately
103+
understand the current situation and act accordingly.
104+
The Severity field MUST be set only when Status=False.
100105
type: string
101106
status:
102-
description: Status of the condition, one of True, False, Unknown.
107+
description: status of the condition, one of True, False, Unknown.
103108
type: string
104109
type:
105-
description: Type of condition in CamelCase or in foo.example.com/CamelCase.
106-
Many .condition.type values are consistent across resources
107-
like Available, but because arbitrary conditions can be useful
108-
(see .node.status.conditions), the ability to deconflict is
109-
important.
110+
description: |-
111+
type of condition in CamelCase or in foo.example.com/CamelCase.
112+
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
113+
can be useful (see .node.status.conditions), the ability to deconflict is important.
110114
type: string
111115
required:
112116
- lastTransitionTime
@@ -116,24 +120,24 @@ spec:
116120
type: array
117121
failureDomains:
118122
additionalProperties:
119-
description: FailureDomainSpec is the Schema for Cluster API failure
120-
domains. It allows controllers to understand how many failure
121-
domains a cluster can optionally span across.
123+
description: |-
124+
FailureDomainSpec is the Schema for Cluster API failure domains.
125+
It allows controllers to understand how many failure domains a cluster can optionally span across.
122126
properties:
123127
attributes:
124128
additionalProperties:
125129
type: string
126-
description: Attributes is a free form map of attributes an
130+
description: attributes is a free form map of attributes an
127131
infrastructure provider might use or require.
128132
type: object
129133
controlPlane:
130-
description: ControlPlane determines if this failure domain
134+
description: controlPlane determines if this failure domain
131135
is suitable for use by control plane machines.
132136
type: boolean
133137
type: object
134-
description: FailureDomains don't mean much in CAPMAAS since it's
135-
all local, but we can see how the rest of cluster API will use this
136-
if we populate it.
138+
description: |-
139+
FailureDomains don't mean much in CAPMAAS since it's all local, but we can see how the rest of cluster API
140+
will use this if we populate it.
137141
type: object
138142
network:
139143
description: Network represents the network
@@ -144,10 +148,10 @@ spec:
144148
type: object
145149
ready:
146150
default: false
147-
description: 'INSERT ADDITIONAL STATUS FIELD - define observed state
148-
of cluster Important: Run "make" to regenerate code after modifying
149-
this file Ready denotes that the maas cluster (infrastructure) is
150-
ready.'
151+
description: |-
152+
INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
153+
Important: Run "make" to regenerate code after modifying this file
154+
Ready denotes that the maas cluster (infrastructure) is ready.
151155
type: boolean
152156
required:
153157
- ready
@@ -157,9 +161,3 @@ spec:
157161
storage: true
158162
subresources:
159163
status: {}
160-
status:
161-
acceptedNames:
162-
kind: ""
163-
plural: ""
164-
conditions: []
165-
storedVersions: []

0 commit comments

Comments
 (0)