feat(operator): support private OCI registry credentials for platform source

Added --platform-source-secret flag to cozystack-operator that allows
specifying a Secret name for registry authentication. This enables using
private OCI registries and Git repositories as platform sources.

Changes:
- cmd/cozystack-operator/main.go:
  - Add --platform-source-secret flag
  - Pass secretName to generateOCIRepository() and generateGitRepository()
  - Set spec.secretRef in generated resources when secret is specified

- packages/core/installer/values.yaml:
  - Add cozystackOperator.platformSourceSecret parameter

- packages/core/installer/templates/cozystack-operator.yaml:
  - Pass --platform-source-secret flag to operator container

Usage:
1. Create registry credentials secret in cozy-system namespace:
   kubectl create secret docker-registry my-registry-creds \
     --namespace cozy-system \
     --docker-server=registry.example.com \
     --docker-username=user \
     --docker-password=token

2. Configure Helm values:
   cozystackOperator:
     platformSourceUrl: 'oci://registry.example.com/repo/packages'
     platformSourceSecret: 'my-registry-creds'

Closes #2455

Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
This commit is contained in:
IvanHunters authored and Ivan Okhotnikov committed 2026-06-24 22:54:06 +03:00
1 parent 29bf56f550
commit 0427b184fa
4 files changed
+74 -13

No files matched your search

@@ -78,6 +78,9 @@ spec:
{{- if .Values.cozystackOperator.platformSourceRef }}
- --platform-source-ref={{ .Values.cozystackOperator.platformSourceRef }}
{{- end }}
{{- if .Values.cozystackOperator.platformSourceSecret }}
- --platform-source-secret={{ .Values.cozystackOperator.platformSourceSecret }}
{{- end }}
{{- if eq .Values.cozystackOperator.variant "talos" }}
env:
# Talos KubePrism endpoint
+9
View File
@@ -29,6 +29,15 @@ cozystackOperator:
# (operator default: 5). Number of release revisions Helm keeps per HR.
# Use 0 for unlimited; lower values reduce Secret accumulation in test clusters.
helmReleaseMaxHistory: ""
# Name of the Secret in cozy-system namespace containing credentials for the
# platform source. When non-empty, sets spec.secretRef on the generated
# OCIRepository or GitRepository resource. Secret type depends on source kind:
# OCI (oci://...): kubernetes.io/dockerconfigjson with registry credentials.
# Git over HTTPS: Opaque/generic secret with `username` + `password` keys.
# Git over SSH: Opaque/generic secret with `identity`, `identity.pub`,
# and `known_hosts` keys.
# See FluxCD source-controller docs for the exact key layout per scheme.
platformSourceSecret: ''
# Generic variant configuration (only used when cozystackOperator.variant=generic)
cozystack:
# Kubernetes API server host (IP only, no protocol/port)