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

how to deploy multiple daemonset according to different node affinity using helm #13010

Open
vie-serendipity opened this issue May 7, 2024 · 2 comments

Comments

@vie-serendipity
Copy link

HELP
Background
Based on different node affinities, I want to deploy distinct daemonsets with just minor differences, like different images. In my chart, there are alse many other resources, like configmap. For now I got three solutions as follows:

  1. Directly use multiple yaml files to support multiple daemonsets. It's not scalable.
  2. I considered using Helm Install twice with different values yaml, but my chart includes other resources with identical YAML. In this case, helm install will get an error and I have to split the chart repository, but it might not be ideal.
  3. I could deploy multiple daemonsets using range, but it would make the values file messy.

I'm wondering if there's a best practice for this. Is there some awesome features that I'm don't know? If you need any info more, just comment. Any suggestions are welcome.

Output of helm version:
version.BuildInfo{Version:"v3.14.3", GitCommit:"f03cc04caaa8f6d7c3e67cf918929150cf6f3f12", GitTreeState:"clean", GoVersion:"go1.22.1"}
Output of kubectl version:
Client Version: v1.29.1
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.22.7
Cloud Provider/Platform (AKS, GKE, Minikube etc.):
kind

@gjenkins8
Copy link
Contributor

gjenkins8 commented May 10, 2024

I could deploy multiple daemonsets using range, but it would make the values file messy.

This would be the standard pattern normally used in situations like this I think. Where you have "many" (ie. user can specify the parameters). In your values, then are going to need something like:

daemonsets:
  foo1:
    param1: fooy
    param2: gooy
  bar2:
    param1: booy
    param2: zooy
  ...
  zoo:
     ...

which would drive the different daemonsets via {{- range .Values.daemonsets }}.

If you are only every going to have e.g. two or three daemonsets, you would use option 1. And perhaps a named template for reducing the duplicated yaml (through I would propose you want to err on the side of readability, even if that causes some additional duplication)

@vie-serendipity
Copy link
Author

@gjenkins8 Thanks for your advice. I decide to put some common daemonset configurations at the top level, then declare unique fields for each daemonset in daemonsets dict to reduce the duplicated parts. Finally just call merge function to get the final values. Is this a good solution?

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

No branches or pull requests

2 participants