Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
LeonD9 opened this issue Mar 19, 2025 · 6 comments
Open

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

LeonD9 opened this issue Mar 19, 2025 · 6 comments

Comments

@LeonD9
Copy link

LeonD9 commented Mar 19, 2025

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)?

@yxxhero
Copy link
Collaborator

yxxhero commented Mar 19, 2025

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

@LeonD9
Copy link
Author

LeonD9 commented Mar 19, 2025

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

@yxxhero
Copy link
Collaborator

yxxhero commented Mar 19, 2025

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

@LeonD9
Copy link
Author

LeonD9 commented Mar 20, 2025

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.

@yxxhero
Copy link
Collaborator

yxxhero commented Mar 22, 2025

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

@LeonD9
Copy link
Author

LeonD9 commented Apr 2, 2025

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants