Skip to content

Commit a1324fc

Browse files
kvapsclaude
andcommitted
feat(cpprovider): rebuild kamaji control-plane provider from upstream master
Replaces the v0.16.0+local-patches fork (image v0.16.0-talos-csr-signer.0 paired with ConfigMap v0.16.0-cp-talos-csr-signer.1 — the patch counters no longer matched, and the local backport of AdditionalServicePorts to v1alpha1 is now obsolete) with a clean upstream master HEAD build: - new images/cluster-api-control-plane-provider-kamaji/Dockerfile builds the manager binary from upstream master at a pinned COMMIT (no patches, distroless/static:nonroot); - new `image` + `update` Makefile targets handle build, manifest regen via kustomize, and components.gz refresh; - files/control-plane-components.yaml + files/components.gz regenerated from upstream master via `make update`; - templates/providers.yaml + templates/configmaps.yaml renamed to the master-<sha> label with a TODO pointing at v0.20.0 once it ships upstream. Master HEAD drops the legacy v1alpha1 API, so cluster.yaml's KamajiControlPlane resource and its controlPlaneRef are bumped to v1alpha2. The fields we use (apiServer, controllerManager, scheduler, dataStoreName, addons.konnectivity, kubelet, network.{additionalServicePorts, certSANs,ingress}, deployment.{podAdditionalMetadata,extraContainers, extraVolumes}, replicas, version) are unchanged across the migration; the .status.version path that migrations/15 patches also still exists. Co-Authored-By: Claude <[email protected]> Signed-off-by: Andrei Kvapil <[email protected]>
1 parent 6ac54ac commit a1324fc

8 files changed

Lines changed: 2568 additions & 645 deletions

File tree

‎Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ build: build-deps
2828
make -C packages/system/dashboard image
2929
make -C packages/system/metallb image
3030
make -C packages/system/kamaji image
31+
make -C packages/system/capi-providers-cpprovider image
3132
make -C packages/system/multus image
3233
make -C packages/system/bucket image
3334
make -C packages/system/objectstorage-controller image

‎packages/apps/kubernetes/templates/cluster.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ spec:
228228
- {{ $serviceCIDR }}
229229
controlPlaneRef:
230230
namespace: {{ .Release.Namespace }}
231-
apiVersion: controlplane.cluster.x-k8s.io/v1alpha1
231+
apiVersion: controlplane.cluster.x-k8s.io/v1alpha2
232232
kind: KamajiControlPlane
233233
name: {{ .Release.Name }}
234234
infrastructureRef:
@@ -237,7 +237,7 @@ spec:
237237
name: {{ .Release.Name }}
238238
namespace: {{ .Release.Namespace }}
239239
---
240-
apiVersion: controlplane.cluster.x-k8s.io/v1alpha1
240+
apiVersion: controlplane.cluster.x-k8s.io/v1alpha2
241241
kind: KamajiControlPlane
242242
metadata:
243243
name: {{ .Release.Name }}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,45 @@
11
export NAME=capi-providers-cpprovider
22
export NAMESPACE=cozy-cluster-api
33

4+
include ../../../hack/common-envs.mk
45
include ../../../hack/package.mk
6+
7+
.PHONY: image update
8+
9+
# COMMIT is the upstream master SHA pinned in the Dockerfile and reused
10+
# below for the kustomize re-render. Keep them in lockstep when bumping.
11+
COMMIT = $(shell awk -F= '/^ARG COMMIT=/{print $$2}' images/cluster-api-control-plane-provider-kamaji/Dockerfile)
12+
IMAGE_BASE = $(REGISTRY)/cluster-api-control-plane-provider-kamaji
13+
IMAGE_TAG = master-$(shell echo $(COMMIT) | cut -c1-7)
14+
15+
image:
16+
docker buildx build images/cluster-api-control-plane-provider-kamaji \
17+
--tag $(IMAGE_BASE):$(IMAGE_TAG) \
18+
--tag $(IMAGE_BASE):$(IMAGE_TAG)-$(TAG) \
19+
--cache-from type=registry,ref=$(IMAGE_BASE):latest \
20+
--cache-to type=inline \
21+
--metadata-file images/cluster-api-control-plane-provider-kamaji.json \
22+
$(BUILDX_ARGS)
23+
digest=$$(yq e '."containerimage.digest"' images/cluster-api-control-plane-provider-kamaji.json -o json -r); \
24+
IMG="$(IMAGE_BASE):$(IMAGE_TAG)@$$digest"; \
25+
echo "$$IMG" > images/cluster-api-control-plane-provider-kamaji.tag; \
26+
sed -i.bak -E "s|image: ghcr\.io/.+/cluster-api-control-plane-provider-kamaji:[^[:space:]]+|image: $$IMG|" files/control-plane-components.yaml; \
27+
rm files/control-plane-components.yaml.bak; \
28+
gzip -nc files/control-plane-components.yaml > files/components.gz
29+
rm -f images/cluster-api-control-plane-provider-kamaji.json
30+
31+
# Refreshes files/control-plane-components.yaml + files/components.gz from
32+
# the upstream sources at the pinned COMMIT, leaving the manager image ref
33+
# pointing at our mirror. Use this when bumping COMMIT in the Dockerfile.
34+
# Requires `kustomize` on PATH.
35+
update:
36+
@command -v kustomize >/dev/null || { echo "kustomize required (https://kustomize.io)"; exit 1; }
37+
rm -rf .update-tmp
38+
mkdir .update-tmp
39+
curl -sSL "https://github.com/clastix/cluster-api-control-plane-provider-kamaji/archive/$(COMMIT).tar.gz" \
40+
| tar -xzf - --strip=1 -C .update-tmp
41+
cd .update-tmp/config/manager && \
42+
kustomize edit set image controller=$(IMAGE_BASE):$(IMAGE_TAG)
43+
kustomize build .update-tmp/config/default > files/control-plane-components.yaml
44+
gzip -nc files/control-plane-components.yaml > files/components.gz
45+
rm -rf .update-tmp
9.15 KB
Binary file not shown.

‎packages/system/capi-providers-cpprovider/files/control-plane-components.yaml‎

Lines changed: 2486 additions & 641 deletions
Large diffs are not rendered by default.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Builds the upstream clastix/cluster-api-control-plane-provider-kamaji
2+
# manager binary from a pinned master commit. We track master HEAD (rather
3+
# than a tagged release) because the AdditionalServicePorts feature
4+
# (clastix/cluster-api-control-plane-provider-kamaji#347) that this chart
5+
# relies on landed after v0.19.0; pin to the v0.20.0 tag hash once that
6+
# release ships, then drop this Dockerfile in favour of consuming upstream
7+
# OCI images directly.
8+
FROM golang:1.26 AS builder
9+
10+
# Pinned to upstream master HEAD. Bump COMMIT and run `make update` in the
11+
# capi-providers-cpprovider package to refresh files/control-plane-components.yaml
12+
# and files/components.gz.
13+
ARG COMMIT=e52ee00a9f5fcb516314ab04da0c668a3dfaca54
14+
ARG TARGETOS
15+
ARG TARGETARCH
16+
17+
WORKDIR /workspace
18+
19+
RUN curl -sSL "https://github.com/clastix/cluster-api-control-plane-provider-kamaji/archive/${COMMIT}.tar.gz" \
20+
| tar -xzf - --strip=1
21+
22+
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} \
23+
go build -a -o manager main.go
24+
25+
FROM gcr.io/distroless/static:nonroot
26+
WORKDIR /
27+
COPY --from=builder /workspace/manager /manager
28+
USER 65532:65532
29+
30+
ENTRYPOINT ["/manager"]

‎packages/system/capi-providers-cpprovider/templates/configmaps.yaml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
apiVersion: v1
22
kind: ConfigMap
33
metadata:
4-
name: v0.16.0-cp-talos-csr-signer.1
4+
# Must match `spec.version` in templates/providers.yaml so the
5+
# ControlPlaneProvider operator selects this bundle.
6+
name: master-e52ee00
57
labels:
68
cp-components: cozy
79
annotations:

‎packages/system/capi-providers-cpprovider/templates/providers.yaml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ metadata:
44
name: kamaji
55
spec:
66
# https://github.com/clastix/cluster-api-control-plane-provider-kamaji
7-
version: v0.16.0-cp-talos-csr-signer.1
7+
# TODO: pin to a tagged release SHA once upstream cuts v0.20.0 (this is
8+
# master HEAD because the AdditionalServicePorts feature is not in
9+
# v0.19.0 yet). Bump `version` to match `images/.../Dockerfile`'s
10+
# ARG COMMIT and rerun `make update` to refresh the bundled manifests.
11+
version: master-e52ee00
812
fetchConfig:
913
selector:
1014
matchLabels:

0 commit comments

Comments
 (0)