mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-04 22:21:46 +09:00
A tenant Kubernetes cluster could only start once an ancestor Tenant had an etcd module turned on, which nobody creating a cluster may do, and every cluster below that tenant then shared one etcd, one CA and one disk. Anything that orders clusters on a tenant's behalf had to flip the tenant's etcd on first. A new cluster now renders its own EtcdCluster and DataStore, from the cozy-lib shapes the etcd chart uses, and is created and deleted with them. The awaiting-etcd state goes, since a datastore always exists. An existing cluster stays on the DataStore its live KamajiControlPlane names, and renders what it rendered before. Changing that name starts a Kamaji datastore migration, which freezes the tenant's writes and leaves every worker kubelet needing a restart, so no upgrade may do it. _namespace.etcd cannot decide this: tenant-root publishes one to every tenant whether or not an etcd runs behind it. On uninstall, Kamaji's datastore finalizer drops the tenant's role, prefix and user from an etcd this release deletes next, and it never completes while that etcd is down. The pre-delete hook therefore removes it from a TenantControlPlane on the cluster's own DataStore that outlives the wait, and deletes the etcd's PKI, which cert-manager issues without an owner. If the finalizer stays on, or the TenantControlPlane cannot be read, the hook fails before the PKI goes, so the uninstall is retried with the etcd still in place. A TenantControlPlane on a shared DataStore is left to Kamaji as before. A Cilium deny policy keeps the rest of the tenant namespace, ancestor tenants and off-cluster sources off the etcd ports; the Kubernetes backup strategy's dump Job carries the label it admits. The tenant etcd's scrape now selects its own members by instance, because every member etcd-operator runs carries app.kubernetes.io/name: etcd. The platform waits for etcd-operator before offering the application. The defrag job both charts share pulls its image through the configured registry, pinned by digest to the multi-architecture index, so a mirrored installation does not depend on ghcr.io for it. Tested with helm-unittest on both the own and the shared branch, the pre-delete hook's bats suite run against a stub kubectl for both, and a render of an existing cluster that matches main byte for byte. The guest e2e runs the defrag CronJob once, and probes the etcd client port from a labelled Pod, an unlabelled one and one in tenant-root. Co-authored-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com> Assisted-by: LLM Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com> Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
551 lines
27 KiB
YAML
551 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
|
|
- 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
|