Compare commits

...

1 Commits

Author SHA1 Message Date
Timofei Larkin
ec33f6b980 Draft: generate cozystack values
Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
2026-01-05 19:16:45 +03:00
4 changed files with 141 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
apiVersion: v2
name: cozy-cozystack-values
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process

View File

@@ -0,0 +1,65 @@
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: cozystack-values
namespace: tenant-root
labels:
cozystack.io/repository: system
cozystack.io/system-app: "true"
spec:
interval: 5m
releaseName: cozystack-values
install:
remediation:
retries: -1
upgrade:
remediation:
retries: -1
chart:
spec:
chart: cozy-cozystack-values
reconcileStrategy: Revision
sourceRef:
kind: HelmRepository
name: cozystack-system
namespace: cozy-system
version: '>= 0.0.0-0'
valuesFrom:
# Cluster configuration from cozystack ConfigMap
# The ConfigMap data keys (root-host, bundle-name, etc.) will be mapped to _cluster
- kind: ConfigMap
name: cozystack
namespace: cozy-system
targetPath: _cluster
# Branding configuration from cozystack-branding ConfigMap
# All keys from the ConfigMap data will be nested under _cluster.branding
- kind: ConfigMap
name: cozystack-branding
namespace: cozy-system
targetPath: _cluster.branding
optional: true
# Scheduling configuration from cozystack-scheduling ConfigMap
# All keys from the ConfigMap data will be nested under _cluster.scheduling
- kind: ConfigMap
name: cozystack-scheduling
namespace: cozy-system
targetPath: _cluster.scheduling
optional: true
# Kube root CA from kube-root-ca.crt ConfigMap
# Extract the ca.crt key and place it at _cluster.kubeRootCa
- kind: ConfigMap
name: kube-root-ca.crt
namespace: kube-system
targetPath: _cluster.kubeRootCa
valuesKey: ca.crt
optional: true
values:
_namespace:
etcd: tenant-root
monitoring: tenant-root
ingress: tenant-root
seaweedfs: tenant-root
# host will be determined from _cluster.root-host or tenantRootHost
# Default to example.org if neither is set
host: "example.org"

View File

@@ -0,0 +1,54 @@
{{- /* Default values for _cluster config to ensure all required keys exist */}}
{{- $clusterDefaults := dict
"root-host" ""
"bundle-name" ""
"clusterissuer" "http01"
"oidc-enabled" "false"
"expose-services" ""
"expose-ingress" "tenant-root"
"expose-external-ips" ""
"cluster-domain" "cozy.local"
"api-server-endpoint" ""
}}
{{- $clusterConfig := mergeOverwrite $clusterDefaults (.Values._cluster | default dict) }}
{{- $host := .Values._namespace.host | default "example.org" }}
{{- if .Values._cluster }}
{{- if index .Values._cluster "root-host" }}
{{- $host = index .Values._cluster "root-host" }}
{{- end }}
{{- end }}
{{- /* Check if tenant-root HelmRelease host value is available */}}
{{- if .Values.tenantRootHost }}
{{- $host = .Values.tenantRootHost }}
{{- end }}
---
apiVersion: v1
kind: Secret
metadata:
name: cozystack-values
namespace: {{ .Values._namespace.etcd | default "tenant-root" }}
labels:
reconcile.fluxcd.io/watch: Enabled
type: Opaque
stringData:
values.yaml: |
_cluster:
{{- $clusterConfig | toYaml | nindent 6 }}
{{- with .Values._cluster.branding }}
branding:
{{- . | toYaml | nindent 8 }}
{{- end }}
{{- with .Values._cluster.scheduling }}
scheduling:
{{- . | toYaml | nindent 8 }}
{{- end }}
{{- with .Values._cluster.kubeRootCa }}
kube-root-ca: {{ . | b64enc | quote }}
{{- end }}
_namespace:
etcd: {{ .Values._namespace.etcd | default "tenant-root" | quote }}
monitoring: {{ .Values._namespace.monitoring | default "tenant-root" | quote }}
ingress: {{ .Values._namespace.ingress | default "tenant-root" | quote }}
seaweedfs: {{ .Values._namespace.seaweedfs | default "tenant-root" | quote }}
host: {{ $host | quote }}

View File

@@ -0,0 +1,18 @@
# Default values for cozystack-values chart
# These values will be populated via valuesFrom in the HelmRelease
# Cluster configuration from cozystack ConfigMap
# The ConfigMap data keys will be mapped directly to _cluster
_cluster: {}
# Namespace configuration
_namespace:
etcd: tenant-root
monitoring: tenant-root
ingress: tenant-root
seaweedfs: tenant-root
host: "example.org"
# Host value from tenant-root HelmRelease (if available)
tenantRootHost: ""