mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-13 16:14:01 +09:00
The default backupStorage.endpoint is http://seaweedfs-s3...svc:8333, but Cozystack ships SeaweedFS with global.seaweedfs.enableSecurity=true, so its in-cluster S3 serves TLS on :8333 behind the self-signed "SeaweedFS CA". Every cozy-default backup (etcd/mariadb/velero/fdb/cnpg) therefore hits a TLS listener over plaintext and fails the handshake. This is fatal for the etcd v1alpha2 adoption migration: its mandatory pre-upgrade safety snapshot writes to this endpoint, so migration 50 hard-fails and blocks the 1.5->1.6 upgrade on any cluster with a legacy etcd. The Etcd Strategy S3 schema has no caCert/insecureSkipVerify field, so it cannot target the self-signed in-cluster endpoint at all. Add a "backupstrategy-controller.endpoint" helper that, for a provisioned bucket, resolves the endpoint from the COSI bucket's system credentials Secret (backupStorage.systemSecretName) — the external S3 ingress with an ACME cert, the same trusted endpoint COSI advertises and every backup operator can verify — and forces the https:// scheme. All Strategy CRs, the Velero BackupStorageLocation and the controller Deployment env are routed through it. It falls back to .Values.backupStorage.endpoint for external S3 (provisionBucket=false) and for offline `helm template`/unit renders and the pre-reconcile first install, where the Secret lookup returns nothing (Flux re-renders on spec.interval once the Secret exists). helm-unittest extended to assert every consumer picks up the resolved endpoint (CNPG/Etcd/Velero keep the full URL, MariaDB/FDB strip the scheme and derive their secure flag) plus the external-S3 verbatim fallback. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
75 lines
2.6 KiB
YAML
75 lines
2.6 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: backupstrategy-controller
|
|
labels:
|
|
app: backupstrategy-controller
|
|
spec:
|
|
replicas: {{ .Values.backupStrategyController.replicas }}
|
|
selector:
|
|
matchLabels:
|
|
app: backupstrategy-controller
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: backupstrategy-controller
|
|
spec:
|
|
tolerations:
|
|
- key: "node-role.kubernetes.io/control-plane"
|
|
operator: "Exists"
|
|
effect: "NoSchedule"
|
|
- key: "node-role.kubernetes.io/master"
|
|
operator: "Exists"
|
|
effect: "NoSchedule"
|
|
serviceAccountName: backupstrategy-controller
|
|
containers:
|
|
- name: backupstrategy-controller
|
|
image: "{{ .Values.backupStrategyController.image }}"
|
|
args:
|
|
- --leader-elect
|
|
{{- if .Values.backupStrategyController.metrics.enabled }}
|
|
- --metrics-bind-address={{ .Values.backupStrategyController.metrics.bindAddress }}
|
|
{{- end }}
|
|
{{- if .Values.backupStrategyController.debug }}
|
|
- --zap-log-level=debug
|
|
{{- else }}
|
|
- --zap-log-level=info
|
|
{{- end }}
|
|
env:
|
|
- name: BACKUP_STORAGE_SECRET_NAMESPACE
|
|
value: {{ .Values.backupStorage.namespace | quote }}
|
|
- name: BACKUP_STORAGE_SECRET_NAME
|
|
value: {{ .Values.backupStorage.systemSecretName | quote }}
|
|
- name: BACKUP_STORAGE_CREDS_SECRET_NAME
|
|
value: cozy-backups-creds
|
|
- name: BACKUP_STORAGE_ENDPOINT
|
|
value: {{ include "backupstrategy-controller.endpoint" . | quote }}
|
|
- name: BACKUP_STORAGE_REGION
|
|
value: {{ .Values.backupStorage.region | quote }}
|
|
- name: BACKUP_STORAGE_FORCE_PATH_STYLE
|
|
value: {{ .Values.backupStorage.forcePathStyle | quote }}
|
|
- name: BACKUP_STORAGE_SYSTEM_NAMESPACES
|
|
value: {{ .Values.backupStorage.systemNamespaces | join "," | quote }}
|
|
ports:
|
|
{{- if .Values.backupStrategyController.metrics.enabled }}
|
|
- name: metrics
|
|
containerPort: {{ splitList ":" .Values.backupStrategyController.metrics.bindAddress | mustLast }}
|
|
{{- end }}
|
|
- name: health
|
|
containerPort: 8081
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /readyz
|
|
port: health
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 10
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /healthz
|
|
port: health
|
|
initialDelaySeconds: 15
|
|
periodSeconds: 20
|
|
{{- with .Values.backupStrategyController.resources }}
|
|
resources: {{- . | toYaml | nindent 10 }}
|
|
{{- end }}
|