helmify icon indicating copy to clipboard operation
helmify copied to clipboard

Allow more configuration to be customised

Open smitthakkar96 opened this issue 3 years ago • 2 comments

The generated helm chart should allow changing things like:

  • annotations
  • nodeSelector
  • affinity rules
  • etc

It would be great if we could support a config file where the user can specify schema/attribute name and field-ref/s and helmify will automatically templatize it.

Example:

vars:
- name: annotations
  optional: true
  objref:
    kind: Deployment
    group: apps
    version: v1
    name: xyz
  fieldrefs:
    - fieldpath: spec.template.metadata.annotation

PS: If this the community and maintainers are interested in I am happy to contribute

smitthakkar96 avatar Nov 24 '22 12:11 smitthakkar96

@smitthakkar96 great idea! Such config will enable users to easily adjust helmify to other use-cases.

Let's discuss specs first. Maybe we can reuse the config to implement 57 and 54.

My first question is about optional: true/false values. For optional: false helmify must templatize it but what happens for optional: true? Maybe we can rename it to enabled: so users will be able to override default behavior to force template or force skip property?

What is name: annotations property? Is it a human-readable alias for config which will be ignored by helmify?

PS: I just started thinking of how it can be integrated into the codebase and it looks very painful. Because existing code is just a go script transforming kubebuilder output into helm 😄. I think we should revisit helmify code and list all currently templated fields as a default config. Then we can rewrite code into a single generic yaml processor taking config and manifest as input and producing a template. The only problem is maintaining templated object links inside the chart (ex: deployment->volume, deployment->configmap, etc.). Do you have any thoughts about implementation?

arttor avatar Nov 26 '22 11:11 arttor

Hi @smitthakkar96 and @arttor, for nodeSelector I proposed a simple solution here https://github.com/arttor/helmify/pull/77 what do you think?

RealAnna avatar Feb 20 '23 16:02 RealAnna