Skip to content

[chart/redis-ha][BUG] Templating fails when using ingressRules without port override #352

@tnaumann-wecg

Description

@tnaumann-wecg

Describe the bug
PR #313 added a template function to DRY the port definitions inside the templates.
However when using custom NetPols via .Values.networkPolicy.ingressRules, while omiting ports, templating the chart will fail, as the template scope has been changed by the range function.

 Error: Failed to render chart: exit status 1: Error: template: redis-ha/templates/redis-ha-network-policy.yaml:65:10: executing "redis-ha/templates/redis-ha-network-policy.yaml" at <include "redis-ports" .>: error calling include: template: redis-ha/templates/_helpers.tpl:138:22: executing "redis-ports" at <.Values.redis.port>: nil pointer evaluating interface {}.redis

To Reproduce

  1. Set values
# values.yaml
networkPolicy:
  enabled: true
  ingressRules:
    - selectors:
      - namespaceSelector:
          matchLabels:
            name: 'my-namespace'
  1. Template chart

Expected behavior
Templating the chart does not fail with an error.

Additional context

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions