[installer] Merge operator templates into single variant-based template

Consolidate three separate operator deployment templates (talos, generic,
hosted) into a single template with variant selection via values.yaml
parameter. This resolves conflicts when running `make apply` from the
installer package, which previously rendered all three deployments.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
This commit is contained in:
Andrei Kvapil 2026-02-11 22:02:58 +01:00
parent 5f27152d18
commit ba7c729066
No known key found for this signature in database
GPG key ID: 931CF7FEACEAF765
5 changed files with 27 additions and 169 deletions

View file

@ -48,13 +48,15 @@ manifests:
> _out/assets/cozystack-operator.yaml
# Generic Kubernetes variant (k3s, kubeadm, RKE2)
helm template installer packages/core/installer -n cozy-system \
-s templates/cozystack-operator-generic.yaml \
-s templates/cozystack-operator.yaml \
-s templates/packagesource.yaml \
--set cozystackOperator.variant=generic \
> _out/assets/cozystack-operator-generic.yaml
# Hosted variant (managed Kubernetes)
helm template installer packages/core/installer -n cozy-system \
-s templates/cozystack-operator-hosted.yaml \
-s templates/cozystack-operator.yaml \
-s templates/packagesource.yaml \
--set cozystackOperator.variant=hosted \
> _out/assets/cozystack-operator-hosted.yaml
cozypkg:

View file

@ -1,90 +0,0 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: cozy-system
labels:
cozystack.io/system: "true"
pod-security.kubernetes.io/enforce: privileged
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: cozystack
namespace: cozy-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: cozystack
subjects:
- kind: ServiceAccount
name: cozystack
namespace: cozy-system
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cozystack-operator
namespace: cozy-system
spec:
replicas: 1
selector:
matchLabels:
app: cozystack-operator
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
template:
metadata:
labels:
app: cozystack-operator
spec:
serviceAccountName: cozystack
containers:
- name: cozystack-operator
image: "{{ .Values.cozystackOperator.image }}"
args:
- --leader-elect=true
- --install-flux=true
- --metrics-bind-address=0
- --health-probe-bind-address=
{{- if .Values.cozystackOperator.disableTelemetry }}
- --disable-telemetry
{{- end }}
- --platform-source-name=cozystack-platform
- --platform-source-url={{ .Values.cozystackOperator.platformSourceUrl }}
{{- if .Values.cozystackOperator.platformSourceRef }}
- --platform-source-ref={{ .Values.cozystackOperator.platformSourceRef }}
{{- end }}
env:
# Generic Kubernetes: read from ConfigMap
# Create cozystack-operator-config ConfigMap before applying this manifest
- name: KUBERNETES_SERVICE_HOST
valueFrom:
configMapKeyRef:
name: cozystack-operator-config
key: KUBERNETES_SERVICE_HOST
optional: false
- name: KUBERNETES_SERVICE_PORT
valueFrom:
configMapKeyRef:
name: cozystack-operator-config
key: KUBERNETES_SERVICE_PORT
optional: false
hostNetwork: true
tolerations:
- key: "node.kubernetes.io/not-ready"
operator: "Exists"
- key: "node.kubernetes.io/unreachable"
operator: "Exists"
- key: "node.cilium.io/agent-not-ready"
operator: "Exists"
- key: "node.cloudprovider.kubernetes.io/uninitialized"
operator: "Exists"

View file

@ -1,77 +0,0 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: cozy-system
labels:
cozystack.io/system: "true"
pod-security.kubernetes.io/enforce: privileged
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: cozystack
namespace: cozy-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: cozystack
subjects:
- kind: ServiceAccount
name: cozystack
namespace: cozy-system
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cozystack-operator
namespace: cozy-system
spec:
replicas: 1
selector:
matchLabels:
app: cozystack-operator
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
template:
metadata:
labels:
app: cozystack-operator
spec:
serviceAccountName: cozystack
containers:
- name: cozystack-operator
image: "{{ .Values.cozystackOperator.image }}"
args:
- --leader-elect=true
- --install-flux=true
- --metrics-bind-address=0
- --health-probe-bind-address=
{{- if .Values.cozystackOperator.disableTelemetry }}
- --disable-telemetry
{{- end }}
- --platform-source-name=cozystack-platform
- --platform-source-url={{ .Values.cozystackOperator.platformSourceUrl }}
{{- if .Values.cozystackOperator.platformSourceRef }}
- --platform-source-ref={{ .Values.cozystackOperator.platformSourceRef }}
{{- end }}
# Hosted: use in-cluster service account, no env override needed
env: []
hostNetwork: true
tolerations:
- key: "node.kubernetes.io/not-ready"
operator: "Exists"
- key: "node.kubernetes.io/unreachable"
operator: "Exists"
- key: "node.cilium.io/agent-not-ready"
operator: "Exists"
- key: "node.cloudprovider.kubernetes.io/uninitialized"
operator: "Exists"

View file

@ -63,12 +63,33 @@ spec:
{{- if .Values.cozystackOperator.platformSourceRef }}
- --platform-source-ref={{ .Values.cozystackOperator.platformSourceRef }}
{{- end }}
{{- if eq .Values.cozystackOperator.variant "talos" }}
env:
# Talos KubePrism endpoint
- name: KUBERNETES_SERVICE_HOST
value: "localhost"
- name: KUBERNETES_SERVICE_PORT
value: "7445"
{{- else if eq .Values.cozystackOperator.variant "generic" }}
env:
# Generic Kubernetes: read from ConfigMap
# Create cozystack-operator-config ConfigMap before applying this manifest
- name: KUBERNETES_SERVICE_HOST
valueFrom:
configMapKeyRef:
name: cozystack-operator-config
key: KUBERNETES_SERVICE_HOST
optional: false
- name: KUBERNETES_SERVICE_PORT
valueFrom:
configMapKeyRef:
name: cozystack-operator-config
key: KUBERNETES_SERVICE_PORT
optional: false
{{- else if eq .Values.cozystackOperator.variant "hosted" }}
# Hosted: use in-cluster service account, no env override needed
env: []
{{- end }}
hostNetwork: true
tolerations:
- key: "node.kubernetes.io/not-ready"

View file

@ -1,4 +1,6 @@
cozystackOperator:
# Deployment variant: talos, generic, hosted
variant: talos
image: ghcr.io/cozystack/cozystack/cozystack-operator:v1.0.0-beta.3@sha256:3cacecfc318e8314300bba8538b475fb8d50b2bf3106533faa8d942e4ed14448
platformSourceUrl: 'oci://ghcr.io/cozystack/cozystack/cozystack-packages'
platformSourceRef: 'digest=sha256:e5ddcf5a02d17b17fc7ffa8c87ddeaa25a01d928a63fb297f6b25b669bb6b7c7'