Files
cozystack/examples/backups/foundationdb/03-create-foundationdb-src.sh
T
Myasnikov Daniil a2d9cc766c fix(kubernetes, opensearch, foundationdb)!: restrict managed application images
Image overrides let a tenant run an arbitrary container in the
management cluster, including helpers with access to the Talos CA
secrets and the tenant cluster's API credentials. Drop those overrides
and run the images the platform ships.

The Kubernetes and KubernetesNodes helpers (the wait-for-kubeconfig
and Proxmox cloud-config init containers, the bootstrap-token and OIDC
RBAC Jobs, the talos-csr-signer sidecar, the Talos reconcile and unpin
Jobs) take the bundled image references through cozy-lib.image, so
they still follow the configured registry. OpenSearch no longer sets
an image and leaves it to the operator, which follows the version the
chart's version map selects; an explicit version: null now fails the
render instead of falling back to v2. The Talos installer settings for
tenant worker VMs stay.

FoundationDB replaces the free-form cluster.version with version, v7.3
or v7.4, mapped to 7.3.63 and 7.4.1; the 7.1 line is no longer
offered. The chart refuses a render where cluster.version and version
name different release lines, which also covers variants without
platform migrations. Migration 60 carries an existing cluster.version
over to its release line and leaves the legacy value in place while
the old chart can still render it. It records what needs attention in
the cozystack.io/migration-60-needs-attention annotation on the
cozystack-version ConfigMap: a FoundationDB release it cannot carry
over or whose patch changes, a release that still sets one of the
removed image overrides, an OpenSearch release storing version: null.
A dry run reports them without patching, annotating or advancing the
stamp. Migration 56 stops carrying the removed kubectl override into
adopted node pools.

OpenSearch and FoundationDB get version-map update scripts that keep
the current default while it is still supported.

Stored image overrides are still accepted and the charts ignore them.
On the first reconcile OpenSearch nodes move to the image of their
selected version and Kubernetes components whose image changed
restart. Air-gapped installations need docker.io and ghcr.io mirrored
on the management-cluster nodes.

Assisted-by: LLM
(cherry picked from commit 749d401899)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-10-26 12:24:00 +00:00

59 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# Step 03: Provision the source FoundationDB cluster, wait for it to
# become available, and write a sentinel key/value so we can prove the
# restore lands the same data on the destination cluster in step 07.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/00-helpers.sh"
print_header "Step 03: Provision source FoundationDB '${FDB_NAME}'"
# Backup is disabled on the chart side: the Cozystack backups framework
# (BackupClass + FoundationDB strategy from steps 01..03) drives backups
# out-of-chart, and the in-chart backup.* values are DEPRECATED.
kubectl apply -f - <<EOF
apiVersion: apps.cozystack.io/v1alpha1
kind: FoundationDB
metadata:
name: ${FDB_NAME}
namespace: ${NAMESPACE}
spec:
version: v7.3
cluster:
processCounts:
storage: 1
stateless: -1
cluster_controller: 1
redundancyMode: "single"
storageEngine: "ssd-2"
faultDomain:
key: "foundationdb.org/none"
valueFrom: "\$FDB_ZONE_ID"
storage:
size: "1Gi"
storageClass: ""
resourcesPreset: "small"
backup:
enabled: false
monitoring:
enabled: true
imageType: "unified"
automaticReplacements: true
EOF
log_substep "Waiting for HelmRelease and FoundationDBCluster..."
timeout 120 sh -ec "until kubectl -n ${NAMESPACE} get hr foundationdb-${FDB_NAME} >/dev/null 2>&1; do sleep 2; done"
kubectl -n "$NAMESPACE" wait hr "foundationdb-${FDB_NAME}" --for=condition=ready --timeout=300s
timeout 300 sh -ec "until kubectl -n ${NAMESPACE} get foundationdbclusters.apps.foundationdb.org ${FDB_CLUSTER_NAME} >/dev/null 2>&1; do sleep 5; done"
log_substep "Waiting for the cluster to report health.available=true..."
timeout 600 sh -ec "until kubectl -n ${NAMESPACE} get foundationdbclusters.apps.foundationdb.org ${FDB_CLUSTER_NAME} -o jsonpath='{.status.health.available}' | grep -q true; do sleep 10; done"
log_substep "Writing sentinel key to ${FDB_NAME}..."
fdbcli_exec "$FDB_NAME" "writemode on; set /backup-demo/sentinel 'hello from $(date -u +%Y%m%dT%H%M%SZ)'"
fdbcli_exec "$FDB_NAME" "get /backup-demo/sentinel"
log_success "Source FoundationDB '${FDB_NAME}' is up and sentinel is set."
echo -e "\n${GREEN}${BOLD}Next:${NC} ./04-create-backupjob.sh"