Skip to content

diff not showing changes with values that contain # (hash) #757

Open

Description

@LeonD9

Hey,
when running helmfile diff command on values.yaml that look like this:

ingress:
  rules:
  - host: test
    paths:
    - path: /example
      backend:
        actions:
          type: redirect
          redirectConfig:
            host: example.com
            path: '/#{path}'
            port: '443'
            protocol: HTTPS
            query: '#{query}'
            statusCode: HTTP_302

while using this template:

    {{- range $rule := .Values.ingress.rules }}
    {{- $index := 0 }}
    {{- range $path := $rule.paths }}
    {{- if or .backend.actions .backend.conditions }}
    {{- $index = add $index 1 }}
    {{- end }}
    {{- if $path.backend.actions }}
    alb.ingress.kubernetes.io/actions.rule-{{ $index }}: {{ $path.backend.actions | toJson | squote }}
    {{- end }}
    {{- if $path.backend.conditions }}
    alb.ingress.kubernetes.io/conditions.rule-{{ $index }}: {{ $path.backend.conditions | toJson | squote }}
    {{- end }}
    {{- end }}
    {{- end }}

I don't see the diff, but when running helmfile template i do see the changes being applied and also after running helmfile apply the changes were applied, they look like this from the template run:

    alb.ingress.kubernetes.io/actions.rule-3: '{"redirectConfig":{"host":"example.com","path":"/#{path}","port":"443","protocol":"HTTPS","query":"#{query}"},"type":"redirect"}'

when i change query and path values to not include # i am able to see the diff which means that for some reason # is ignored in diff run.
is this a bug? or its intended to ignore values that contain # (hash)?

Activity

  1. yxxhero commented on Mar 19, 2025

    @yxxhero
    Collaborator

    @LeonD9 thanks for your issue. maybe this is a bug. could you post an demo for debuging?

  2. LeonD9 commented on Mar 19, 2025

    @LeonD9
    Author

    @yxxhero you can use the values and helm template i put in the description of this issue.

  3. yxxhero commented on Mar 19, 2025

    @yxxhero
    Collaborator

    @LeonD9 I need whole chart and values to debug and find the issue quickly. thanks so much.

  4. LeonD9 commented on Mar 20, 2025

    @LeonD9
    Author

    This is the helm template i am using:

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: test
      labels:
       environment: test
      annotations:
        {{- range $rule := .Values.ingress.rules }}
        {{- $index := 0 }}
        {{- range $path := $rule.paths }}
        {{- if or .backend.actions .backend.conditions }}
        {{- $index = add $index 1 }}
        {{- end }}
        {{- if $path.backend.actions }}
        alb.ingress.kubernetes.io/actions.rule-{{ $index }}: {{ $path.backend.actions | toJson | squote }}
        {{- end }}
        {{- if $path.backend.conditions }}
        alb.ingress.kubernetes.io/conditions.rule-{{ $index }}: {{ $path.backend.conditions | toJson | squote }}
        {{- end }}
        {{- end }}
        {{- end }}
    spec:
      rules:
      {{- range $key, $value := .Values.ingress.rules }}
      {{- $index := 0 }}
      - http:
          paths:
          {{- range .paths }}
          {{- if or .backend.actions .backend.conditions }}
          {{- $index = add $index 1 }}
          {{- end }}
          - path: {{ .path }}
            pathType: ImplementationSpecific
            backend:
              service:
                name: {{ if or .backend.actions .backend.conditions }}rule-{{ $index }}{{ else }}http-service{{ end }}
                port:
                  name: {{ if or .backend.actions .backend.conditions }}use-annotation{{- else }}http{{ end }}
          {{- end }}
        {{- if .host }}
        host: {{ .host }}
        {{- end }}
      {{- end }}
    

    And this is my values.yaml:

    ingress:
      rules:
      - host: test
        paths:
        - path: /example
          backend:
            actions:
              type: redirect
              redirectConfig:
                host: example.com
                path: '/#{path}'
                port: '443'
                protocol: HTTPS
                query: '#{query}'
                statusCode: HTTP_302
    

    @yxxhero please check if it helps you debug this issue.

  5. yxxhero commented on Mar 22, 2025

    @yxxhero
    Collaborator

    @LeonD9 sorry. I can't reproduce your issue.

  6. LeonD9 commented on Apr 2, 2025

    @LeonD9
    Author

    @yxxhero I checked again and i can reproduce it using this chart and values:

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: test
      labels:
       environment: test
      annotations:
        {{- range $rule := .Values.ingress.rules }}
        {{- $index := 0 }}
        {{- range $path := $rule.paths }}
        {{- if or .backend.actions .backend.conditions }}
        {{- $index = add $index 1 }}
        {{- end }}
        {{- if $path.backend.actions }}
        alb.ingress.kubernetes.io/actions.rule-{{ $index }}: {{ $path.backend.actions | toJson | squote }}
        {{- end }}
        {{- if $path.backend.conditions }}
        alb.ingress.kubernetes.io/conditions.rule-{{ $index }}: {{ $path.backend.conditions | toJson | squote }}
        {{- end }}
        {{- end }}
        {{- end }}
    spec:
      rules:
      {{- range $key, $value := .Values.ingress.rules }}
      {{- $index := 0 }}
      - http:
          paths:
          {{- range .paths }}
          {{- if or .backend.actions .backend.conditions }}
          {{- $index = add $index 1 }}
          {{- end }}
          - path: {{ .path }}
            pathType: ImplementationSpecific
            backend:
              service:
                name: {{ if or .backend.actions .backend.conditions }}rule-{{ $index }}{{ else }}http-service{{ end }}
                port:
                  name: {{ if or .backend.actions .backend.conditions }}use-annotation{{- else }}http{{ end }}
          {{- end }}
        {{- if .host }}
        host: {{ .host }}
        {{- end }}
      {{- end }}
    

    values.yaml:

    ingress:
      rules:
      - host: test
        paths:
        - path: /example
          backend:
            actions:
              type: redirect
              redirectConfig:
                host: example.com
                path: '/#{path}'
                port: '443'
                protocol: HTTPS
                query: '#{query}'
                statusCode: HTTP_302
    

    the expected output should be:

    alb.ingress.kubernetes.io/actions.rule-1: '{"redirectConfig":{"host":"example.com","path":"/#{path}","port":"443","protocol":"HTTPS","query":"#{query}","statusCode":"HTTP_302"},"type":"redirect"}'
    

    Instead i don't see any output but when i change the values.yaml to this:

    ingress:
      rules:
      - host: test
        paths:
        - path: /example
          backend:
            actions:
              type: redirect
              redirectConfig:
                host: example.com
                path: path
                port: '443'
                protocol: HTTPS
                query: query
                statusCode: HTTP_302
    

    I see the correct output:

    alb.ingress.kubernetes.io/actions.rule-1: '{"redirectConfig":{"host":"example.com","path":"path","port":"443","protocol":"HTTPS","query":"query","statusCode":"HTTP_302"},"type":"redirect"}'
    

    which seems like helm diff doesn't know how to handle # values.

  7. yxxhero commented on May 10, 2025

    @yxxhero
    Collaborator
    Image

    is this right?

  8. yxxhero commented on May 10, 2025

    @yxxhero
    Collaborator
  9. LeonD9 commented on May 27, 2025

    @LeonD9
    Author

    @yxxhero Yes, exactly what i expected to see in the helm diff.

  10. yxxhero commented on May 27, 2025

    @yxxhero
    Collaborator

    @LeonD9 in my side, it works fine.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions