mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-06 23:23:23 +09:00
Tenants read every user's S3 keys in plain text from the per-user credentials Secret, and the only way to rotate them was to delete the BucketAccess and force two Helm upgrades. The chart now renders a CredentialTemplate per tenant user that names the BucketAccess, in the plaintext format, instead of rendering the BucketAccess itself, so cozystack-controller owns the grant, a mint re-creates it and a revoke deletes it; the keys are shown once, by the mint. The per-user Secret of a tenant user keeps only the endpoint and bucket name. It is rendered as data rather than stringData: Helm's three-way merge removes a live key only when the previous manifest named it, and a stringData key never shows up in data, so a key the chart stops emitting would otherwise stay. A tenant user's BucketAccess keeps the name the chart gave it, which the conversion hands over by name; a user name that is not a valid object name never had one and takes the account name instead. A user whose account name is longer than 63 characters is refused at render, as credentials-migrate refuses it. A user marked platform, which backupstrategy-controller now sets on the backup bucket's system user, keeps its chart-rendered BucketAccess and its keys in a Secret no tenant role selects or grants, so default backups keep reading it; its keys are never minted. Clearing the flag drops that BucketAccess, which revokes those keys, and the user becomes a normal account whose keys are minted. values.yaml documents both. BREAKING CHANGE: clients that read accessKey and secretKey from <bucket>-<user>-credentials must mint the user's credential instead; every mint rotates both keys. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
559 lines
27 KiB
YAML
559 lines
27 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
|
|
- templates/strategy-kubernetes-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
|
|
# The system user is a platform account: its keys stay in the Secret
|
|
# this controller reads, and no tenant credential can rotate them.
|
|
- equal:
|
|
path: spec.users.system
|
|
value:
|
|
readonly: false
|
|
platform: true
|
|
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 carries the system-bucket
|
|
# coordinates ($bucketName), so it needs the gate for the same reason the
|
|
# others do: 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/strategy-kubernetes-default.yaml
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/velero-bsl.yaml
|
|
|
|
- it: "cozy-default BackupClass is the Day-1 tenant interface: renders unconditionally with all twelve 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: 12
|
|
template: templates/backupclass-default.yaml
|
|
- contains:
|
|
path: spec.strategies
|
|
content:
|
|
application:
|
|
apiGroup: apps.cozystack.io
|
|
kind: Kubernetes
|
|
strategyRef:
|
|
apiGroup: strategy.backups.cozystack.io
|
|
kind: Kubernetes
|
|
name: cozy-default-kubernetes
|
|
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: Valkey
|
|
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
|
|
- equal:
|
|
path: spec.template.s3.bucket
|
|
value: test-bucket
|
|
template: templates/strategy-mongodb-default.yaml
|
|
- equal:
|
|
path: spec.template.s3.credentialsSecret
|
|
value: cozy-backups-creds
|
|
template: templates/strategy-mongodb-default.yaml
|
|
- equal:
|
|
path: spec.template.s3.region
|
|
value: us-east-1
|
|
template: templates/strategy-mongodb-default.yaml
|
|
- equal:
|
|
path: spec.template.s3.forcePathStyle
|
|
value: true
|
|
template: templates/strategy-mongodb-default.yaml
|
|
# insecureSkipTLSVerify is plumbed end-to-end (strategy -> driver-injected
|
|
# storage entry). This case pins the default (knob off -> false); the
|
|
# "renders insecureSkipTLSVerify from the platform knob" case below flips
|
|
# the knob on, so the pair discriminates the rendered value from a
|
|
# hardcoded literal (either would redden one of the two).
|
|
- equal:
|
|
path: spec.template.s3.insecureSkipTLSVerify
|
|
value: false
|
|
template: templates/strategy-mongodb-default.yaml
|
|
# prefix must reach the CR as a literal go-template string: Helm must NOT
|
|
# evaluate it, so the driver templates it per-application at BackupJob time.
|
|
# A stray brace would empty it with every doc-count assertion still green.
|
|
- equal:
|
|
path: spec.template.s3.prefix
|
|
value: "{{ .Application.metadata.namespace }}/{{ .Application.metadata.name }}"
|
|
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/strategy-kubernetes-default.yaml
|
|
# The driver renders these per BackupJob; Helm must leave them literal.
|
|
- equal:
|
|
path: spec.template.spec.volumes[0].secret.secretName
|
|
value: "{{ .Datastore.CertificateSecret }}"
|
|
template: templates/strategy-kubernetes-default.yaml
|
|
# A cluster's own etcd denies its client port to every Pod without this
|
|
# label, the dump Job's included.
|
|
- equal:
|
|
path: spec.template.metadata.labels["policy.cozystack.io/allow-to-etcd-cluster"]
|
|
value: "{{ .Release.Prefix }}{{ .Release.Name }}-etcd"
|
|
template: templates/strategy-kubernetes-default.yaml
|
|
- equal:
|
|
path: spec.velero.spec.orLabelSelectors[2].matchLabels["cluster.x-k8s.io/cluster-name"]
|
|
value: "kubernetes-{{ .Application.metadata.name }}"
|
|
template: templates/strategy-kubernetes-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: "the MongoDB strategy renders insecureSkipTLSVerify from the platform knob"
|
|
# Pairs with the default (false) assertion above: with the knob flipped on,
|
|
# the injected storage entry must carry true. A template that hardcoded either
|
|
# literal would redden one of the two cases, so together they prove the value
|
|
# tracks backupStorage.insecureSkipTLSVerify rather than a constant.
|
|
set:
|
|
backupStorage.bucketNameOverride: test-bucket
|
|
backupStorage.insecureSkipTLSVerify: true
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.s3.insecureSkipTLSVerify
|
|
value: true
|
|
template: templates/strategy-mongodb-default.yaml
|
|
|
|
- it: "external S3 (provisionBucket=false): Strategy CRs render against the configured bucketName, no Bucket CR is created"
|
|
# The CRDs are reported Established, as on any render after the first: the
|
|
# CRD gate is what holds these CRs back on the first one.
|
|
set:
|
|
backupStorage.provisionBucket: false
|
|
backupStorage.bucketName: ext-bucket
|
|
kubernetesProvider:
|
|
scheme:
|
|
"apiextensions.k8s.io/v1/CustomResourceDefinition":
|
|
gvr:
|
|
group: apiextensions.k8s.io
|
|
version: v1
|
|
resource: customresourcedefinitions
|
|
namespaced: false
|
|
objects:
|
|
- apiVersion: apiextensions.k8s.io/v1
|
|
kind: CustomResourceDefinition
|
|
metadata:
|
|
name: cnpgs.strategy.backups.cozystack.io
|
|
status:
|
|
conditions: [{type: Established, status: "True"}]
|
|
- apiVersion: apiextensions.k8s.io/v1
|
|
kind: CustomResourceDefinition
|
|
metadata:
|
|
name: mariadbs.strategy.backups.cozystack.io
|
|
status:
|
|
conditions: [{type: Established, status: "True"}]
|
|
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: "Strategies gate on their CRD as well as on the bucket, so a render whose CRDs are not served yet 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, and of the first render of an
|
|
# external-S3 install — 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
|
|
# for any of these is that wedge, green. hack/backupstrategy-crd-gate.bats
|
|
# holds the same property for every template, listed here or not.
|
|
set:
|
|
backupStorage.provisionBucket: false
|
|
backupStorage.bucketName: ext-bucket
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-mongodb-default.yaml
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-kafka-default.yaml
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-rabbitmq-default.yaml
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/strategy-redis-default.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}
|
|
- {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/strategy-kubernetes-default.yaml}
|
|
# The ungated BackupClass keeps rendering, which is what makes the counts
|
|
# above an assertion about the CRD gate rather than about a chart-wide
|
|
# render failure.
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/backupclass-default.yaml
|
|
|
|
- it: "the CRD-gated Strategies render once the apiserver reports their CRDs Established"
|
|
# The counterpart of the case above, and the only one that resolves the CRD
|
|
# gate through a real lookup: bucketNameOverride short-circuits it, so every
|
|
# other case would stay green with a misspelt CRD name that never resolves on
|
|
# a live cluster, leaving the CR absent and DefaultObjectsGate forcing
|
|
# upgrades for good.
|
|
set:
|
|
backupStorage.provisionBucket: false
|
|
backupStorage.bucketName: ext-bucket
|
|
kubernetesProvider:
|
|
scheme:
|
|
"apiextensions.k8s.io/v1/CustomResourceDefinition":
|
|
gvr:
|
|
group: apiextensions.k8s.io
|
|
version: v1
|
|
resource: customresourcedefinitions
|
|
namespaced: false
|
|
objects:
|
|
- apiVersion: apiextensions.k8s.io/v1
|
|
kind: CustomResourceDefinition
|
|
metadata:
|
|
name: mongodbs.strategy.backups.cozystack.io
|
|
status:
|
|
conditions: [{type: Established, status: "True"}]
|
|
- apiVersion: apiextensions.k8s.io/v1
|
|
kind: CustomResourceDefinition
|
|
metadata:
|
|
name: kafkas.strategy.backups.cozystack.io
|
|
status:
|
|
conditions: [{type: Established, status: "True"}]
|
|
- apiVersion: apiextensions.k8s.io/v1
|
|
kind: CustomResourceDefinition
|
|
metadata:
|
|
name: rabbitmqs.strategy.backups.cozystack.io
|
|
status:
|
|
conditions: [{type: Established, status: "True"}]
|
|
- apiVersion: apiextensions.k8s.io/v1
|
|
kind: CustomResourceDefinition
|
|
metadata:
|
|
name: redis.strategy.backups.cozystack.io
|
|
status:
|
|
conditions: [{type: Established, status: "True"}]
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-mongodb-default.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-kafka-default.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-rabbitmq-default.yaml
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/strategy-redis-default.yaml
|
|
|
|
- it: "with every CRD Established, the bucket gate alone still holds every Strategy CR back until the BucketClaim resolves"
|
|
# The CRD gate is closed in every render that has no apiserver, so the
|
|
# bootstrap-window case above would stay green with any bucket gate deleted.
|
|
# Only a render that serves the CRDs and leaves the BucketClaim unresolved
|
|
# pins that gate, and its absence ships a Strategy CR with an empty bucket.
|
|
kubernetesProvider:
|
|
scheme:
|
|
"apiextensions.k8s.io/v1/CustomResourceDefinition":
|
|
gvr: {group: apiextensions.k8s.io, version: v1, resource: customresourcedefinitions}
|
|
namespaced: false
|
|
"objectstorage.k8s.io/v1alpha1/BucketClaim":
|
|
gvr: {group: objectstorage.k8s.io, version: v1alpha1, resource: bucketclaims}
|
|
namespaced: true
|
|
"v1/Secret":
|
|
gvr: {group: "", version: v1, resource: secrets}
|
|
namespaced: true
|
|
objects:
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: altinities.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: cnpgs.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: etcds.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: foundationdbs.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: kafkas.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: kubernetes.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: mariadbs.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: mongodbs.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: rabbitmqs.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: redis.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: veleroes.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
asserts:
|
|
- {hasDocuments: {count: 0}, template: templates/strategy-altinity-default.yaml}
|
|
- {hasDocuments: {count: 0}, template: templates/strategy-cnpg-default.yaml}
|
|
- {hasDocuments: {count: 0}, template: templates/strategy-etcd-default.yaml}
|
|
- {hasDocuments: {count: 0}, template: templates/strategy-foundationdb-default.yaml}
|
|
- {hasDocuments: {count: 0}, template: templates/strategy-kafka-default.yaml}
|
|
- {hasDocuments: {count: 0}, template: templates/strategy-mariadb-default.yaml}
|
|
- {hasDocuments: {count: 0}, template: templates/strategy-mongodb-default.yaml}
|
|
- {hasDocuments: {count: 0}, template: templates/strategy-rabbitmq-default.yaml}
|
|
- {hasDocuments: {count: 0}, template: templates/strategy-redis-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/strategy-kubernetes-default.yaml}
|
|
|
|
- it: "with every CRD Established and the BucketClaim resolved, every Strategy CR renders against the COSI bucket name"
|
|
# The positive half of the case above, through the same live lookups and no
|
|
# offline override: the state every forced upgrade after bootstrap renders.
|
|
kubernetesProvider:
|
|
scheme:
|
|
"apiextensions.k8s.io/v1/CustomResourceDefinition":
|
|
gvr: {group: apiextensions.k8s.io, version: v1, resource: customresourcedefinitions}
|
|
namespaced: false
|
|
"objectstorage.k8s.io/v1alpha1/BucketClaim":
|
|
gvr: {group: objectstorage.k8s.io, version: v1alpha1, resource: bucketclaims}
|
|
namespaced: true
|
|
"v1/Secret":
|
|
gvr: {group: "", version: v1, resource: secrets}
|
|
namespaced: true
|
|
objects:
|
|
- {apiVersion: objectstorage.k8s.io/v1alpha1, kind: BucketClaim, metadata: {name: bucket-cozy-backups, namespace: tenant-root}, status: {bucketName: cozy-backups-0123}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: altinities.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: cnpgs.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: etcds.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: foundationdbs.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: kafkas.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: kubernetes.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: mariadbs.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: mongodbs.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: rabbitmqs.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: redis.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
- {apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, metadata: {name: veleroes.strategy.backups.cozystack.io}, status: {conditions: [{type: Established, status: "True"}]}}
|
|
asserts:
|
|
- {hasDocuments: {count: 1}, template: templates/strategy-altinity-default.yaml}
|
|
- {hasDocuments: {count: 1}, template: templates/strategy-cnpg-default.yaml}
|
|
- {matchRegex: {path: spec.template.barmanObjectStore.destinationPath, pattern: ^s3://cozy-backups-0123/}, template: templates/strategy-cnpg-default.yaml}
|
|
- {hasDocuments: {count: 1}, template: templates/strategy-etcd-default.yaml}
|
|
- {hasDocuments: {count: 1}, template: templates/strategy-foundationdb-default.yaml}
|
|
- {hasDocuments: {count: 1}, template: templates/strategy-kafka-default.yaml}
|
|
- {hasDocuments: {count: 1}, template: templates/strategy-mariadb-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-velero-vminstance-default.yaml}
|
|
- {hasDocuments: {count: 1}, template: templates/strategy-velero-vmdisk-default.yaml}
|
|
- {hasDocuments: {count: 1}, template: templates/strategy-kubernetes-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
|