Files
Myasnikov DaniilandClaude Opus 4.8 b5cc2ae120 fix(kubernetes): address review findings on Talos worker bootstrap
- talos-reconcile-job: emit a `---` separator inside the nodeGroups
  range so a tenant with multiple node groups renders valid
  multi-document YAML instead of two Jobs concatenated into one doc
- talos-reconcile + bootstrap-token jobs: add a restricted
  securityContext (drop ALL caps, no privilege escalation, read-only
  root fs) and CPU/memory requests+limits; drop the unused management
  SA token mount on the bootstrap-token job, which only talks to the
  tenant apiserver via the mounted admin kubeconfig
- migration 44: list Helm-managed resources by the
  app.kubernetes.io/managed-by=Helm label, not meta.helm.sh/release-name
  (an annotation, so it never matched as a --selector — the keep
  annotation was silently never applied)
- cluster.yaml: fail fast on a malformed nodeHealthCheck.maxUnhealthy
  rather than silently coercing it to 0 via `| int`
- config: make helm-install-disable-wait parsing genuinely
  case-insensitive (EqualFold + trim) to match its documented contract
- capi-providers bootstrap/cpprovider Makefiles: guard the
  patches/*.diff loop against an empty glob

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-06-23 14:45:53 +05:00

55 lines
2.7 KiB
Makefile

export NAME=capi-providers-cpprovider
export NAMESPACE=cozy-cluster-api
include ../../../hack/common-envs.mk
include ../../../hack/package.mk
.PHONY: image update
# Upstream tag pinned in the Dockerfile and reused below for the
# kustomize re-render. Keep them in lockstep when bumping.
UPSTREAM_VERSION = $(shell awk -F= '/^ARG VERSION=/{print $$2}' images/cluster-api-control-plane-provider-kamaji/Dockerfile)
# Counter for cozystack-side respins on top of the same UPSTREAM_VERSION
# (e.g. patches/ refresh, Go toolchain bump). Bump when something other
# than UPSTREAM_VERSION changes.
COZYSTACK_REV = 0
IMAGE_BASE = $(REGISTRY)/cluster-api-control-plane-provider-kamaji
IMAGE_TAG = $(UPSTREAM_VERSION)-cozystack.$(COZYSTACK_REV)
image:
docker buildx build images/cluster-api-control-plane-provider-kamaji \
--tag $(IMAGE_BASE):$(IMAGE_TAG) \
--tag $(IMAGE_BASE):$(IMAGE_TAG)-$(TAG) \
--cache-from type=registry,ref=$(IMAGE_BASE):latest \
--cache-to type=inline \
--metadata-file images/cluster-api-control-plane-provider-kamaji.json \
$(BUILDX_ARGS)
digest=$$(yq e '."containerimage.digest"' images/cluster-api-control-plane-provider-kamaji.json -o json -r); \
IMG="$(IMAGE_BASE):$(IMAGE_TAG)@$$digest"; \
echo "$$IMG" > images/cluster-api-control-plane-provider-kamaji.tag; \
sed -i.bak -E "s|image: ghcr\.io/.+/cluster-api-control-plane-provider-kamaji:[^[:space:]]+|image: $$IMG|" files/control-plane-components.yaml; \
rm files/control-plane-components.yaml.bak; \
gzip -nc files/control-plane-components.yaml > files/components.gz
rm -f images/cluster-api-control-plane-provider-kamaji.json
# Refreshes files/control-plane-components.yaml + files/components.gz from
# upstream sources at UPSTREAM_VERSION with patches/ applied, leaving the
# manager image ref pointing at our mirror. Use when bumping UPSTREAM_VERSION
# or editing patches/. Requires kustomize on PATH.
update:
@command -v kustomize >/dev/null || { echo "kustomize required (https://kustomize.io)"; exit 1; }
rm -rf .update-tmp
mkdir .update-tmp
curl -sSL "https://github.com/clastix/cluster-api-control-plane-provider-kamaji/archive/refs/tags/$(UPSTREAM_VERSION).tar.gz" \
| tar -xzf - --strip=1 -C .update-tmp
cd .update-tmp && git init -q && git add . && git commit -qm init && \
for p in ../images/cluster-api-control-plane-provider-kamaji/patches/*.diff; do \
[ -e "$$p" ] || continue; \
git apply --recount "$$p"; \
done
cd .update-tmp/config/manager && \
kustomize edit set image controller=$(IMAGE_BASE):$(IMAGE_TAG)
kustomize build .update-tmp/config/default > files/control-plane-components.yaml
gzip -nc files/control-plane-components.yaml > files/components.gz
rm -rf .update-tmp