Currently, ClusterProfile in Sveltos allows defining a fixed chartVersion for Helm charts across clusters that match a clusterSelector. However, in complex environments where clusters vary in Kubernetes version, region, or other metadata, a single chartVersion may not meet compatibility or regional deployment requirements. A templating approach, where chart versions (or other configurations) can dynamically adjust based on metadata labels, would offer more flexible and efficient management.
apiVersion: config.projectsveltos.io/v1alpha1
kind: ClusterProfile
metadata:
name: prometheus-grafana
spec:
clusterSelector: env=fv
helmCharts:
- repositoryURL: https://prometheus-community.github.io/helm-charts
repositoryName: prometheus-community
chartName: prometheus-community/prometheus
chartVersion: |
{{- if eq .metadata.labels.k8s-version "1.20" }}23.4.0
{{- else if eq .metadata.labels.k8s-version "1.22" }}24.1.0
{{- else if eq .metadata.labels.k8s-version "1.25" }}25.0.2
{{- else }}23.4.0
{{- end }}
releaseName: prometheus
releaseNamespace: prometheus
helmChartAction: Install
Example Use Case:
For instance, if clusters have metadata labels such as k8s-version, region, or env, ClusterProfile could use these to set the chartVersion or other parameters automatically:
- chartVersion: 23.4.0 for k8s-version=1.20
- chartVersion: 24.1.0 for region=us-east
- Different release names or namespaces based on environment (env=prod or env=dev)
Currently, ClusterProfile in Sveltos allows defining a fixed chartVersion for Helm charts across clusters that match a clusterSelector. However, in complex environments where clusters vary in Kubernetes version, region, or other metadata, a single chartVersion may not meet compatibility or regional deployment requirements. A templating approach, where chart versions (or other configurations) can dynamically adjust based on metadata labels, would offer more flexible and efficient management.
Example Use Case:
For instance, if clusters have metadata labels such as k8s-version, region, or env, ClusterProfile could use these to set the chartVersion or other parameters automatically: