Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template-Based Helm Chart Versioning in ClusterProfile Using Labels #794

Open
emreberber opened this issue Nov 4, 2024 · 2 comments · May be fixed by #800
Open

Template-Based Helm Chart Versioning in ClusterProfile Using Labels #794

emreberber opened this issue Nov 4, 2024 · 2 comments · May be fixed by #800

Comments

@emreberber
Copy link

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)
@gianlucam76
Copy link
Member

Thank you @emreberber

I will think a little more on this tomorrow before confirming, but I believe this should be easy to implement. But again, I will spend some time on it before confirming it.

Thanks for suggesting this.

@emreberber
Copy link
Author

Thank you in advance @gianlucam76 🙏🏻 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants