mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
snapshot-controller v8.0.1 serves VolumeGroupSnapshots only as v1alpha1 and runs without the CSIVolumeGroupSnapshot gate, so no CSI driver on the platform can take a crash-consistent snapshot of several volumes at once. Velero 1.18 and piraeus-operator both look for groupsnapshot.storage.k8s.io/v1beta2, which v8.7.0 serves and which the upstream chart enables by default. The upstream chart renders its CRDs as ordinary templates instead of shipping them in crds/, and helm-controller takes over existing objects by default. A patch makes the chart render a CRD only when it is absent or already carries this release's ownership, so a distribution that ships its own snapshot CRDs keeps them as they are. keepCRDs is set because an uninstall would otherwise delete every VolumeSnapshot along with the CRDs. Migration 62 hands the CRDs this release installed over to it, read from its helm-controller labels, and checks the HelmRelease rather than those labels to decide whether the release exists, so a retry after a failed create still recreates what the first attempt deleted. The apiserver refuses to drop v1alpha1 from a CRD that lists it in storedVersions, so the empty v1alpha1 group snapshot CRDs are deleted and created again at v1beta2 from copies the image build renders out of the chart. Every HelmRelease waits for the pre-upgrade hook, so linstor renders against the v1beta2 API even when it upgrades first; the version is stamped only once every release-owned v1beta2 group snapshot CRD is Established, which a retry after a timed-out wait must check again. A CRD that still holds v1alpha1 objects is kept, recorded on the cozystack-version ConfigMap, and its warning spells out the manual recovery, since nothing renders either release again once it is gone. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
68 lines
3.1 KiB
Makefile
68 lines
3.1 KiB
Makefile
NAME=cozystack-platform
|
|
NAMESPACE=cozy-system
|
|
|
|
include ../../../hack/common-envs.mk
|
|
|
|
test:
|
|
helm unittest .
|
|
|
|
show:
|
|
cozyhr show --namespace $(NAMESPACE) $(NAME)
|
|
|
|
apply:
|
|
cozyhr apply --namespace $(NAMESPACE) $(NAME)
|
|
|
|
reconcile: apply
|
|
|
|
diff:
|
|
cozyhr diff --namespace $(NAMESPACE) $(NAME)
|
|
|
|
# Strip the platform.cozystack.io/no-delete label from every guarded object so
|
|
# `helm uninstall cozy-platform` (and ad-hoc deletes of protected resources)
|
|
# is no longer denied by the deletion-protection VAP. After this runs, the
|
|
# cluster has no guardrail until the next `helm upgrade` re-stamps the label.
|
|
# Intended for teardown / disaster-recovery, not routine use.
|
|
unprotect:
|
|
hack/unprotect.sh
|
|
|
|
image: image-migrations
|
|
|
|
GROUP_SNAPSHOT_CRDS_EXPR := select(.spec.group == "groupsnapshot.storage.k8s.io") \
|
|
| .metadata.annotations."meta.helm.sh/release-name" = "snapshot-controller" \
|
|
| .metadata.annotations."meta.helm.sh/release-namespace" = "cozy-snapshot-controller" \
|
|
| .metadata.labels."app.kubernetes.io/managed-by" = "Helm" \
|
|
| .metadata.labels."helm.toolkit.fluxcd.io/name" = "snapshot-controller" \
|
|
| .metadata.labels."helm.toolkit.fluxcd.io/namespace" = "cozy-snapshot-controller"
|
|
|
|
image-migrations:
|
|
# Vendor the v1alpha2 CRDs into the build context so migration 50 can ensure
|
|
# they exist before adoption (the etcd-operator-crds HelmRelease only installs
|
|
# AFTER this pre-upgrade hook). Copied from the committed source of truth —
|
|
# no build-time network fetch, stays in lockstep with the chart. Removed again
|
|
# after the build; the leading rm reclaims a stale copy from a failed build.
|
|
rm -rf images/migrations/etcd-operator-crds
|
|
mkdir -p images/migrations/etcd-operator-crds
|
|
cp ../../system/etcd-operator-crds/templates/*.yaml images/migrations/etcd-operator-crds/
|
|
# The v1beta2 group snapshot CRDs, rendered from the snapshot-controller
|
|
# chart with that release's ownership metadata, so migration 62 can create
|
|
# them before any HelmRelease renders against the cluster.
|
|
rm -rf images/migrations/snapshot-controller-crds
|
|
mkdir -p images/migrations/snapshot-controller-crds
|
|
helm template snapshot-controller ../../system/snapshot-controller \
|
|
--namespace cozy-snapshot-controller \
|
|
--show-only charts/snapshot-controller/templates/crds.yaml \
|
|
| yq --split-exp '"images/migrations/snapshot-controller-crds/" + .metadata.name + ".yaml"' \
|
|
'$(GROUP_SNAPSHOT_CRDS_EXPR)'
|
|
# yq exits 0 on empty input, so a failed render would otherwise ship an
|
|
# image whose migration 62 deletes the old CRDs and cannot recreate them.
|
|
test "$$(ls images/migrations/snapshot-controller-crds | wc -l)" -eq 3
|
|
docker buildx build images/migrations \
|
|
$(call image-tags,platform-migrations,v$(COZYSTACK_VERSION)) \
|
|
$(call cache-args,platform-migrations) \
|
|
--metadata-file images/migrations.json \
|
|
$(BUILDX_ARGS)
|
|
rm -rf images/migrations/etcd-operator-crds images/migrations/snapshot-controller-crds
|
|
IMAGE="$(REGISTRY)/platform-migrations:$(IMAGE_TAG)@$$(yq -e -o json -r '.["containerimage.digest"]' images/migrations.json)" \
|
|
yq --inplace '.migrations.image = strenv(IMAGE)' values.yaml
|
|
rm -f images/migrations.json
|