bjw-s / helm-charts

A collection of Helm charts
https://bjw-s.github.io/helm-charts/
Apache License 2.0
580 stars 106 forks source link

Cannot set pod options in individual pods, only in defaultPodOptions #332

Closed acuntex closed 3 months ago

acuntex commented 3 months ago

Details

What steps did you take and what happened:

Certain pod options like imagePullSecrets, affinity, topologySpreadConstraints etc. cannot be set under individual pods. They can only be set in the defaultPodOptions. If you set them under the pod, you get the error message:

Error: values don't meet the specifications of the schema(s) in the following chart(s):
app-template:
- controllers.pod: Additional property imagePullSecrets is not allowed
- controllers.pod: Additional property affinity is not allowed
- controllers.pod: Additional property topologySpreadConstraints is not allowed

Since there are test, that tests the override of these options, I guess it was intended to work, but somehow the validation does not work as intended. https://github.com/bjw-s/helm-charts/blob/20ca6c5003f6ef9302d3659bdfc6ef55cb955730/charts/library/common-test/tests/pod/field_topologySpreadConstraints_test.yaml#L43

What did you expect to happen:

Pod options like imagePullSecrets, affinity, topologySpreadConstraints etc. should not throw a validation error if they are used under an individual pod.

Anything else you would like to add:

Additional Information:

bjw-s commented 3 months ago

controllers.pod.affinity is indeed not a valid option as the values validation indicates. What you are (probably) looking for is something like controllers.my_controller.pod.affinity:

controllers:
  my_controller: # <-- this can of course be anything that you wish to use as the identifier for your controller
    pod:
      affinity:
        ...

Let me know if that doesn't work for you

acuntex commented 3 months ago

Shame on me, I was assuming the object "my_controller" was the pod-object type. Thanks!