trident icon indicating copy to clipboard operation
trident copied to clipboard

Helm Chart: .values.affinity won't work as expected

Open kmizumar opened this issue 1 year ago • 0 comments

Describe the bug It seems that it's impossible to specify affinity for pod assignment.

Environment Provide accurate information about the environment to help us reproduce the issue.

  • Trident version: 24.02
  • Trident operator version: 100.2402.0
  • Kubernetes version: v1.28.3
  • OS: Ubuntu 24.04LTS
  • Other:
    • Kustomize version: 5.3.0

To Reproduce Steps to reproduce the behavior:

❯ cat kustomization.yaml 
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: trident
helmCharts:
- name: trident-operator
  releaseName: trident-operator
  namespace: trident
  includeCRDs: true
  version: 100.2402.0
  repo: https://netapp.github.io/trident-helm-chart
  skipTests: true
  skipHooks: true
  valuesInline:
    affinity:
      nodeAffinity:
        requiredDuringSchedulingIgnoredDuringExecution:
          nodeSelectorTerms:
          - matchExpressions:
            - key: node.owner
              operator: NotIn
              values:
              - org-foo
              - org-bar
              - org-baz

Then try to generate YAML files:

❯ kustomize version
5.3.0

❯ kustomize build . --enable-helm
Error: map[string]interface {}(nil): yaml: unmarshal errors:
  line 37: mapping key "affinity" already defined at line 23

Expected behavior A clear and concise description of what you expected to happen.

YAML files should be rendered without any errors.

Additional context Add any other context about the problem here.

Defining .values.affinity leads to duplicate spec.affinity definitions, I guess:

https://github.com/NetApp/trident/blob/6f311fca90166889d71047dab128f1fc6d5c3fe4/helm/trident-operator/templates/deployment.yaml#L30-L57

kmizumar avatar Apr 03 '24 04:04 kmizumar