Skip to content

Commit a1c862e

Browse files
committed
feat: update CACPPT to Talos 1.10
Update CAPI to 1.10-rc.1. Signed-off-by: Andrey Smirnov <[email protected]>
1 parent 7fb93f5 commit a1c862e

File tree

10 files changed

+331
-318
lines changed

10 files changed

+331
-318
lines changed

Dockerfile

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# syntax = docker/dockerfile-upstream:1.2.0-labs
1+
# syntax = docker/dockerfile-upstream:1.14.1-labs
22

33
# Meta args applied to stage base names.
44

@@ -14,21 +14,19 @@ FROM ghcr.io/siderolabs/fhs:${PKGS} AS pkg-fhs
1414
# code
1515

1616
FROM --platform=${BUILDPLATFORM} ${TOOLS} AS build
17-
SHELL ["/toolchain/bin/bash", "-c"]
18-
ARG CGO_ENABLED
19-
ENV PATH /toolchain/bin:/toolchain/go/bin:/go/bin
20-
RUN ["/toolchain/bin/mkdir", "/bin", "/tmp"]
21-
RUN ["/toolchain/bin/ln", "-svf", "/toolchain/bin/bash", "/bin/sh"]
22-
RUN ["/toolchain/bin/ln", "-svf", "/toolchain/etc/ssl", "/etc/ssl"]
23-
ENV GO111MODULE on
24-
ENV GOPROXY https://proxy.golang.org
25-
ENV GOCACHE /.cache/go-build
26-
ENV GOMODCACHE /.cache/mod
27-
ENV GOTOOLCHAIN local
17+
ENV GOTOOLCHAIN=local
18+
ENV CGO_ENABLED=0
19+
ENV GO111MODULE=on
20+
ENV GOPROXY=https://proxy.golang.org
21+
ENV GOCACHE=/.cache/go-build
22+
ENV GOMODCACHE=/.cache/mod
23+
SHELL ["/bin/bash", "-c"]
2824
ARG CONTROLLER_GEN_VERSION
2925
ARG CONVERSION_GEN_VERSION
30-
RUN --mount=type=cache,target=/.cache go install sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_GEN_VERSION}
31-
RUN --mount=type=cache,target=/.cache go install k8s.io/code-generator/cmd/conversion-gen@${CONVERSION_GEN_VERSION}
26+
RUN --mount=type=cache,target=/.cache go install sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_GEN_VERSION} \
27+
&& mv /root/go/bin/controller-gen /usr/bin/controller-gen
28+
RUN --mount=type=cache,target=/.cache go install k8s.io/code-generator/cmd/conversion-gen@${CONVERSION_GEN_VERSION} \
29+
&& mv /root/go/bin/conversion-gen /usr/bin/conversion-gen
3230
WORKDIR /src
3331
COPY ./go.mod ./
3432
COPY ./go.sum ./
@@ -53,12 +51,12 @@ COPY --from=generate-build /src/api /api
5351
# runs unit-tests
5452
FROM build AS unit-tests-run
5553
ARG TESTPKGS
56-
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg --mount=type=cache,target=/tmp go test -v -covermode=atomic -coverprofile=coverage.txt -coverpkg=${TESTPKGS} -count 1 ${TESTPKGS}
54+
RUN --mount=type=cache,target=/root/.cache --mount=type=cache,target=/tmp go test -v -covermode=atomic -coverprofile=coverage.txt -coverpkg=${TESTPKGS} -count 1 ${TESTPKGS}
5755

5856
FROM scratch AS unit-tests
5957
COPY --from=unit-tests-run /src/coverage.txt /coverage.txt
6058

61-
FROM --platform=${BUILDPLATFORM} alpine:3.13 AS release-build
59+
FROM --platform=${BUILDPLATFORM} alpine:3.21 AS release-build
6260
ADD https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.1.0/kustomize_v4.1.0_linux_amd64.tar.gz .
6361
RUN tar -xf kustomize_v4.1.0_linux_amd64.tar.gz -C /usr/local/bin && rm kustomize_v4.1.0_linux_amd64.tar.gz
6462
COPY ./config ./config

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ TESTPKGS ?= ./controllers/...
1111

1212
KRES_IMAGE ?= ghcr.io/siderolabs/kres:latest
1313

14-
CONTROLLER_GEN_VERSION ?= v0.16.2
15-
CONVERSION_GEN_VERSION ?= v0.31.0
14+
CONTROLLER_GEN_VERSION ?= v0.17.0
15+
CONVERSION_GEN_VERSION ?= v0.32.3
1616

1717
ifneq (, $(filter $(WITH_RACE), t true TRUE y yes 1))
1818
GO_BUILDFLAGS += -race
@@ -24,8 +24,8 @@ GO_LDFLAGS += -s -w
2424

2525
ARTIFACTS := _out
2626

27-
TOOLS ?= ghcr.io/siderolabs/tools:v1.9.0
28-
PKGS ?= v1.9.0
27+
TOOLS ?= ghcr.io/siderolabs/tools:v1.10.0
28+
PKGS ?= v1.10.0
2929

3030
BUILD := docker buildx build
3131
PLATFORM ?= linux/amd64

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@ This provider's versions are compatible with the following versions of Cluster A
2626

2727
This provider's versions are able to install and manage the following versions of Kubernetes:
2828

29-
| | v1.16 | v 1.17 | v1.18 | v1.19 | v1.20 | v1.21 | v1.22 | v1.23 | v1.24 | v1.25 | v1.26 | v1.27 | v1.28 | v1.29 | v1.30 | v1.31 | v1.32 |
30-
| ------------------------------------------- | ----- | ------ | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- |
31-
| Control Plane Provider Talos v1alpha3 (v0.2) ||||||| | | | | | | | | | | |
32-
| Control Plane Provider Talos v1alpha3 (v0.3) ||||||| | | | | | | | | | | |
33-
| Control Plane Provider Talos v1alpha3 (v0.4) | | | ||||||||| | | | | | |
34-
| Control Plane Provider Talos v1alpha3 (v0.5) | | | | | | | | | |||||||||
29+
| | v1.16 | v 1.17 | v1.18 | v1.19 | v1.20 | v1.21 | v1.22 | v1.23 | v1.24 | v1.25 | v1.26 | v1.27 | v1.28 | v1.29 | v1.30 | v1.31 | v1.32 | v1.33 |
30+
| ------------------------------------------- | ----- | ------ | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- |
31+
| Control Plane Provider Talos v1alpha3 (v0.2) ||||||| | | | | | | | | | | | |
32+
| Control Plane Provider Talos v1alpha3 (v0.3) ||||||| | | | | | | | | | | | |
33+
| Control Plane Provider Talos v1alpha3 (v0.4) | | | ||||||||| | | | | | | |
34+
| Control Plane Provider Talos v1alpha3 (v0.5) | | | | | | | | | | | ||||||||
3535

3636
This provider's versions are compatible with the following versions of Talos:
3737

38-
| | v0.11 | v0.12 | v0.13 | v0.14 | v1.0 | v1.1 | v1.2 | v1.3 | v1.4 | v1.5 | v1.6 | v1.7 | v1.8 | v1.9 |
39-
| -------------------------------------------- | ----- | ------ | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- |
40-
| Control Plane Provider Talos v1alpha3 (v0.3) ||| | | | | | | | | | | | |
41-
| Control Plane Provider Talos v1alpha3 (v0.3) |||| | | | | | | | | | | |
42-
| Control Plane Provider Talos v1alpha3 (v0.4) ||||||||| | | | | | |
43-
| Control Plane Provider Talos v1alpha3 (v0.5) | | | | | | | ||||||||
38+
| | v0.11 | v0.12 | v0.13 | v0.14 | v1.0 | v1.1 | v1.2 | v1.3 | v1.4 | v1.5 | v1.6 | v1.7 | v1.8 | v1.9 | v1.10 |
39+
| -------------------------------------------- | ----- | ------ | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- |
40+
| Control Plane Provider Talos v1alpha3 (v0.3) ||| | | | | | | | | | | | | |
41+
| Control Plane Provider Talos v1alpha3 (v0.3) |||| | | | | | | | | | | | |
42+
| Control Plane Provider Talos v1alpha3 (v0.4) ||||||||| | | | | | | |
43+
| Control Plane Provider Talos v1alpha3 (v0.5) | | | | | | | |||||||||
4444

4545
## Building and Installing
4646

api/v1alpha3/taloscontrolplane_webhook.go

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package v1alpha3
66

77
import (
8+
"context"
89
"fmt"
910
"strings"
1011

@@ -22,20 +23,26 @@ import (
2223
func (r *TalosControlPlane) SetupWebhookWithManager(mgr ctrl.Manager) error {
2324
return ctrl.NewWebhookManagedBy(mgr).
2425
For(r).
26+
WithDefaulter(r).
27+
WithValidator(r).
2528
Complete()
2629
}
2730

2831
// +kubebuilder:webhook:verbs=create;update,path=/mutate-controlplane-cluster-x-k8s-io-v1alpha3-taloscontrolplane,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=controlplane.cluster.x-k8s.io,resources=taloscontrolplanes,versions=v1alpha3,name=default.taloscontrolplane.controlplane.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1
2932
//+kubebuilder:webhook:verbs=create;update;delete,path=/validate-controlplane-cluster-x-k8s-io-v1alpha3-taloscontrolplane,mutating=false,failurePolicy=fail,groups=controlplane.cluster.x-k8s.io,resources=taloscontrolplanes,versions=v1alpha3,name=validate.taloscontrolplane.controlplane.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1
3033

3134
var (
32-
_ webhook.Defaulter = &TalosControlPlane{}
33-
_ webhook.Validator = &TalosControlPlane{}
35+
_ webhook.CustomDefaulter = &TalosControlPlane{}
36+
_ webhook.CustomValidator = &TalosControlPlane{}
3437
)
3538

3639
// Default implements webhook.Defaulter so a webhook will be registered for the type.
37-
func (r *TalosControlPlane) Default() {
40+
func (r *TalosControlPlane) Default(ctx context.Context, obj runtime.Object) error {
41+
r = obj.(*TalosControlPlane)
42+
3843
defaultTalosControlPlaneSpec(&r.Spec, r.Namespace)
44+
45+
return nil
3946
}
4047

4148
func defaultTalosControlPlaneSpec(s *TalosControlPlaneSpec, namespace string) {
@@ -75,17 +82,21 @@ func defaultRolloutStrategy(rolloutStrategy *RolloutStrategy) *RolloutStrategy {
7582
}
7683

7784
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
78-
func (r *TalosControlPlane) ValidateCreate() (admission.Warnings, error) {
85+
func (r *TalosControlPlane) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
86+
r = obj.(*TalosControlPlane)
87+
7988
return r.validate()
8089
}
8190

8291
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
83-
func (r *TalosControlPlane) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
92+
func (r *TalosControlPlane) ValidateUpdate(ctx context.Context, oldObj runtime.Object, newObj runtime.Object) (admission.Warnings, error) {
93+
r = newObj.(*TalosControlPlane)
94+
8495
return r.validate()
8596
}
8697

8798
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
88-
func (r *TalosControlPlane) ValidateDelete() (admission.Warnings, error) {
99+
func (r *TalosControlPlane) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
89100
return nil, nil
90101
}
91102

config/crd/bases/controlplane.cluster.x-k8s.io_taloscontrolplanes.yaml

Lines changed: 17 additions & 6 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.16.2
6+
controller-gen.kubebuilder.io/version: v0.17.0
77
name: taloscontrolplanes.controlplane.cluster.x-k8s.io
88
spec:
99
group: controlplane.cluster.x-k8s.io
@@ -100,7 +100,9 @@ spec:
100100
description: |-
101101
Source of the hostname.
102102
103-
Allowed values: "MachineName" (use linked Machine's Name).
103+
Allowed values:
104+
"MachineName" (use linked Machine's Name).
105+
"InfrastructureName" (use linked Machine's infrastructure's name).
104106
type: string
105107
type: object
106108
strategicPatches:
@@ -144,7 +146,9 @@ spec:
144146
description: |-
145147
Source of the hostname.
146148
147-
Allowed values: "MachineName" (use linked Machine's Name).
149+
Allowed values:
150+
"MachineName" (use linked Machine's Name).
151+
"InfrastructureName" (use linked Machine's infrastructure's name).
148152
type: string
149153
type: object
150154
strategicPatches:
@@ -277,27 +281,32 @@ spec:
277281
properties:
278282
lastTransitionTime:
279283
description: |-
280-
Last time the condition transitioned from one status to another.
284+
lastTransitionTime is the last time the condition transitioned from one status to another.
281285
This should be when the underlying condition changed. If that is not known, then using the time when
282286
the API field changed is acceptable.
283287
format: date-time
284288
type: string
285289
message:
286290
description: |-
287-
A human readable message indicating details about the transition.
291+
message is a human readable message indicating details about the transition.
288292
This field may be empty.
293+
maxLength: 10240
294+
minLength: 1
289295
type: string
290296
reason:
291297
description: |-
292-
The reason for the condition's last transition in CamelCase.
298+
reason is the reason for the condition's last transition in CamelCase.
293299
The specific API may choose whether or not this field is considered a guaranteed API.
294300
This field may be empty.
301+
maxLength: 256
302+
minLength: 1
295303
type: string
296304
severity:
297305
description: |-
298306
severity provides an explicit classification of Reason code, so the users or machines can immediately
299307
understand the current situation and act accordingly.
300308
The Severity field MUST be set only when Status=False.
309+
maxLength: 32
301310
type: string
302311
status:
303312
description: status of the condition, one of True, False, Unknown.
@@ -307,6 +316,8 @@ spec:
307316
type of condition in CamelCase or in foo.example.com/CamelCase.
308317
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
309318
can be useful (see .node.status.conditions), the ability to deconflict is important.
319+
maxLength: 256
320+
minLength: 1
310321
type: string
311322
required:
312323
- lastTransitionTime

controllers/controllers_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ func (suite *ControllersSuite) TestReconcilePaused() {
156156
Version: "v1.16.6",
157157
},
158158
}
159-
tcp.Default()
160-
_, err := tcp.ValidateCreate()
159+
tcp.Default(suite.T().Context(), tcp)
160+
_, err := tcp.ValidateCreate(suite.T().Context(), tcp)
161161
g.Expect(err).To(Succeed())
162162
fakeClient := newFakeClient(tcp.DeepCopy(), cluster.DeepCopy())
163163
r := newReconciler(fakeClient)
@@ -206,8 +206,8 @@ func (suite *ControllersSuite) TestReconcileClusterNoEndpoints() {
206206
},
207207
}
208208

209-
tcp.Default()
210-
_, err := tcp.ValidateCreate()
209+
tcp.Default(suite.T().Context(), tcp)
210+
_, err := tcp.ValidateCreate(suite.T().Context(), tcp)
211211
g.Expect(err).To(Succeed())
212212

213213
ca := corev1.Secret{

0 commit comments

Comments
 (0)