mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-22 04:33:36 +09:00
The Kafka metadata strategy pinned kafkaBackupClientImage to an upstream Strimzi tag with no producer: nothing stamped it and Renovate does not manage helm-values, so it drifted from the broker version the operator provisions. A dedicated small client image (the sibling curl-only drivers' follow-up) is not viable here because the driver runs the Kafka Admin-API CLI, which only the broker image ships. Resolve the client image from a live broker pod of the target Strimzi Kafka at reconcile time instead, so the CLI always matches the broker (any version the operator picks, not only the chart default), and record it on the Backup so cleanup can reuse it once the source cluster is gone. The chart no longer pins the image; the strategy template renders it as the .ClientImage placeholder the controller fills. Signed-off-by: Andrey Kolkov <androndo@gmail.com> Assisted-by: LLM
278 lines
11 KiB
YAML
278 lines
11 KiB
YAML
suite: rendering gates — bucketName helper, BackupClass always-on, strategy/BSL gating
|
|
|
|
# This whole chart is lookup-driven conditional rendering: the
|
|
# backupstrategy-controller.bucketName helper decides whether the Strategy
|
|
# CRs and the Velero BSL materialise, while the cozy-default BackupClass and
|
|
# the cozy-backups Bucket follow different rules. helm-unittest renders with
|
|
# no live cluster, so `lookup` returns nil — exactly the bootstrap window
|
|
# these cases pin.
|
|
|
|
templates:
|
|
- templates/backupclass-default.yaml
|
|
- templates/bucket.yaml
|
|
- templates/velero-bsl.yaml
|
|
- templates/strategy-cnpg-default.yaml
|
|
- templates/strategy-mariadb-default.yaml
|
|
- templates/strategy-etcd-default.yaml
|
|
- templates/strategy-altinity-default.yaml
|
|
- templates/strategy-mongodb-default.yaml
|
|
- templates/strategy-rabbitmq-default.yaml
|
|
- templates/strategy-redis-default.yaml
|
|
- templates/strategy-kafka-default.yaml
|
|
- templates/strategy-foundationdb-default.yaml
|
|
- templates/strategy-velero-vminstance-default.yaml
|
|
- templates/strategy-velero-vmdisk-default.yaml
|
|
|
|
release:
|
|
name: t
|
|
namespace: cozy-backup-controller
|
|
|
|
tests:
|
|
- it: "bootstrap window (no resolvable bucket name): only Bucket + BackupClass render"
|
|
# defaults: provisionBucket=true, bucketNameOverride="" -> lookup nil -> $bucketName=""
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/backupclass-default.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/bucket.yaml
|
|
- equal:
|
|
path: metadata.namespace
|
|
value: tenant-root
|
|
template: templates/bucket.yaml
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-cnpg-default.yaml
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-mariadb-default.yaml
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-etcd-default.yaml
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-altinity-default.yaml
|
|
# MongoDB is gated like every sibling, and this count is the assertion
|
|
# that keeps the chart installable. Its Strategy needs no bucket
|
|
# coordinates (the S3 target lives on the MongoDB application's
|
|
# spec.backup, the driver only names the storage), so the gate is there
|
|
# purely for ordering: this chart ships its own CRDs as templates, Helm
|
|
# resolves the whole manifest through the RESTMapper before applying any
|
|
# of it, and one ungated Strategy CR makes the first install apply zero
|
|
# objects with "no matches for kind" and never recover. A count of 1 here
|
|
# is that bug, green, which is how it shipped once already.
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-mongodb-default.yaml
|
|
# RabbitMQ Job strategy carries bucket coordinates (endpoint, bucket,
|
|
# object key), so it MUST stay off the first render like the others -
|
|
# an ungated Strategy CR trips the same "no matches for kind" install
|
|
# failure described above.
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-rabbitmq-default.yaml
|
|
# Kafka metadata Job strategy carries bucket coordinates too, so it stays
|
|
# off the first render for the same ordering reason as its siblings.
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-kafka-default.yaml
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-redis-default.yaml
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-foundationdb-default.yaml
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-velero-vminstance-default.yaml
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-velero-vmdisk-default.yaml
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/velero-bsl.yaml
|
|
|
|
- it: "cozy-default BackupClass is the Day-1 tenant interface: renders unconditionally with all ten routes (FoundationDB intentionally unbound)"
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/backupclass-default.yaml
|
|
- equal:
|
|
path: metadata.name
|
|
value: cozy-default
|
|
template: templates/backupclass-default.yaml
|
|
- lengthEqual:
|
|
path: spec.strategies
|
|
count: 10
|
|
template: templates/backupclass-default.yaml
|
|
- contains:
|
|
path: spec.strategies
|
|
content:
|
|
application:
|
|
apiGroup: apps.cozystack.io
|
|
kind: RabbitMQ
|
|
strategyRef:
|
|
apiGroup: strategy.backups.cozystack.io
|
|
kind: Rabbitmq
|
|
name: cozy-default-rabbitmq
|
|
template: templates/backupclass-default.yaml
|
|
- contains:
|
|
path: spec.strategies
|
|
content:
|
|
application:
|
|
apiGroup: apps.cozystack.io
|
|
kind: Redis
|
|
strategyRef:
|
|
apiGroup: strategy.backups.cozystack.io
|
|
kind: Redis
|
|
name: cozy-default-redis
|
|
template: templates/backupclass-default.yaml
|
|
- contains:
|
|
path: spec.strategies
|
|
content:
|
|
application:
|
|
apiGroup: apps.cozystack.io
|
|
kind: Kafka
|
|
strategyRef:
|
|
apiGroup: strategy.backups.cozystack.io
|
|
kind: Kafka
|
|
name: cozy-default-kafka
|
|
template: templates/backupclass-default.yaml
|
|
|
|
- it: "all Strategy CRs and the Velero BSL render once a bucket name resolves"
|
|
# bucketNameOverride marks an offline render, and the MongoDB count below is
|
|
# what pins that the CRD gate honours it: without that short-circuit no
|
|
# `helm template` or CI diff could ever produce this Strategy, since neither
|
|
# has an apiserver to ask about the CRD.
|
|
set:
|
|
backupStorage.bucketNameOverride: test-bucket
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-cnpg-default.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-mariadb-default.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-etcd-default.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-altinity-default.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-mongodb-default.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-rabbitmq-default.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-redis-default.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-kafka-default.yaml
|
|
- isKind:
|
|
of: Kafka
|
|
template: templates/strategy-kafka-default.yaml
|
|
- equal:
|
|
path: metadata.name
|
|
value: cozy-default-kafka
|
|
template: templates/strategy-kafka-default.yaml
|
|
- equal:
|
|
path: spec.artifactURITemplate
|
|
value: "s3://test-bucket/{{ .Release.Namespace }}/{{ .Release.Name }}/{{ .BackupName }}/kafka-metadata.txt"
|
|
template: templates/strategy-kafka-default.yaml
|
|
# The chart pins no client image: the controller fills the placeholder with
|
|
# the target broker's own image at reconcile time.
|
|
- equal:
|
|
path: spec.template.spec.containers[0].image
|
|
value: "{{ .ClientImage }}"
|
|
template: templates/strategy-kafka-default.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-foundationdb-default.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-velero-vminstance-default.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-velero-vmdisk-default.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/velero-bsl.yaml
|
|
- equal:
|
|
path: spec.objectStorage.bucket
|
|
value: test-bucket
|
|
template: templates/velero-bsl.yaml
|
|
- equal:
|
|
# s3ForcePathStyle is rendered as a quoted string, not a bool
|
|
path: spec.config.s3ForcePathStyle
|
|
value: "true"
|
|
template: templates/velero-bsl.yaml
|
|
|
|
- it: "external S3 (provisionBucket=false): Strategy CRs render against the configured bucketName, no Bucket CR is created"
|
|
set:
|
|
backupStorage.provisionBucket: false
|
|
backupStorage.bucketName: ext-bucket
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/bucket.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-cnpg-default.yaml
|
|
- matchRegex:
|
|
path: spec.template.barmanObjectStore.destinationPath
|
|
pattern: ^s3://ext-bucket/
|
|
template: templates/strategy-cnpg-default.yaml
|
|
- equal:
|
|
path: spec.template.storage.s3.bucket
|
|
value: ext-bucket
|
|
template: templates/strategy-mariadb-default.yaml
|
|
|
|
- it: "MongoDB Strategy gates on its CRD too, so shipping the kind to an installed chart cannot wedge the release"
|
|
# provisionBucket=false is what makes this case load-bearing: it resolves
|
|
# $bucketName WITHOUT the offline bucketNameOverride, which is the shape of a
|
|
# cluster that has been running for releases — bucket gate open, and only the
|
|
# CRD gate still able to hold the CR back. helm-unittest renders with no
|
|
# apiserver, so the CRD lookup answers "absent", which is the same answer a
|
|
# real cluster gives on the upgrade that first ships that CRD. Rendering the
|
|
# CR there fails Build() for the WHOLE release ("no matches for kind
|
|
# MongoDB") and applies zero objects, including the CRD that would have
|
|
# fixed it, so a count of 1 here is that wedge, green.
|
|
set:
|
|
backupStorage.provisionBucket: false
|
|
backupStorage.bucketName: ext-bucket
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-mongodb-default.yaml
|
|
# A sibling whose CRD shipped in an earlier release keeps rendering, which
|
|
# is what makes the count above an assertion about the MongoDB gate rather
|
|
# than about a chart-wide render failure.
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-cnpg-default.yaml
|
|
|
|
- it: "velero.bslEnabled=false: Velero strategies and BSL drop out while other strategies keep rendering"
|
|
set:
|
|
backupStorage.bucketNameOverride: test-bucket
|
|
velero.bslEnabled: false
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/velero-bsl.yaml
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-velero-vminstance-default.yaml
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-velero-vmdisk-default.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-cnpg-default.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-etcd-default.yaml
|