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

Configmap from value.yaml doesn't end up in the output of helm template (Or in what's eventually applied) #12429

Closed
Ryangr0 opened this issue Nov 28, 2024 · 6 comments
Labels
needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@Ryangr0
Copy link

Ryangr0 commented Nov 28, 2024

What happened:
In the directory ops/helm/ingress-nginx:

Chart.yml

apiVersion: v2
name: ingress-nginx-chart
description: A Helm chart for nginx ingress controller
version: 4.12.0-beta.0
type: application
appVersion: 1.25.5
dependencies:
  - name: ingress-nginx
    version: 4.12.0-beta.0
    repository: https://kubernetes.github.io/ingress-nginx

values.yaml

controller:
    replicaCount: 2
    resources:
        requests:
            cpu: 100m
            memory: 90Mi
    service:
        type: LoadBalancer
        externalTrafficPolicy: Local
        annotations:
            service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol: "true"
            service.beta.kubernetes.io/do-loadbalancer-tls-passthrough: "true"
    config:
        use-proxy-protocol: "true"
        use-forwarded-headers: "true"

I run

helm dependency update ops/helm/ingress-nginx
helm template ops/helm/ingress-nginx > test.yml

The relevant part is in test.yml:

---
# Source: ingress-nginx-chart/charts/ingress-nginx/templates/controller-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    helm.sh/chart: ingress-nginx-4.12.0-beta.0
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: "1.12.0-beta.0"
    app.kubernetes.io/part-of: ingress-nginx
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: controller
  name: release-name-ingress-nginx-controller
  namespace: default
data:
---

What you expected to happen:

https://github.com/kubernetes/ingress-nginx/blob/main/charts/ingress-nginx/templates/controller-configmap.yaml

This has:

{{- range $key, $value := .Values.controller.config }}
  {{- $key | nindent 2 }}: {{ tpl (toString $value) $ | quote }}
{{- end }}

So I would expect data to be populated with:

use-proxy-protocol: "true"
use-forwarded-headers: "true"

But, it is empty. I have no idea what's happening for this not to be put in there. All the docs, and the actual template point to that this should work.

NGINX Ingress controller version (exec into the pod and run /nginx-ingress-controller --version):

-------------------------------------------------------------------------------
NGINX Ingress controller
  Release:       v1.12.0-beta.0
  Build:         80154a3694b52736c88de408811ebd1888712520
  Repository:    https://github.com/kubernetes/ingress-nginx
  nginx version: nginx/1.25.5

-------------------------------------------------------------------------------

Kubernetes version (use kubectl version):
Client Version: v1.31.3
Kustomize Version: v5.4.2
Server Version: v1.31.1

Environment:

  • Cloud provider or hardware configuration:

  • OS (e.g. from /etc/os-release):
    Tried this on windows and osx

  • Kernel (e.g. uname -a):

  • Install tools:

    • Please mention how/where was the cluster created like kubeadm/kops/minikube/kind etc.
  • Basic cluster related info:

    • kubectl version
    • kubectl get nodes -o wide
  • How was the ingress-nginx-controller installed:

    • If helm was used then please show output of helm ls -A | grep -i ingress
    • If helm was used then please show output of helm -n <ingresscontrollernamespace> get values <helmreleasename>
    • If helm was not used, then copy/paste the complete precise command used to install the controller, along with the flags and options used
    • if you have more than one instance of the ingress-nginx-controller installed in the same cluster, please provide details for all the instances
  • Current State of the controller:

    • kubectl describe ingressclasses
    • kubectl -n <ingresscontrollernamespace> get all -A -o wide
    • kubectl -n <ingresscontrollernamespace> describe po <ingresscontrollerpodname>
    • kubectl -n <ingresscontrollernamespace> describe svc <ingresscontrollerservicename>
  • Current state of ingress object, if applicable:

    • kubectl -n <appnamespace> get all,ing -o wide
    • kubectl -n <appnamespace> describe ing <ingressname>
    • If applicable, then, your complete and exact curl/grpcurl command (redacted if required) and the reponse to the curl/grpcurl command with the -v flag
  • Others:

    • Any other related information like ;
      • copy/paste of the snippet (if applicable)
      • kubectl describe ... of any custom configmap(s) created and in use
      • Any other related information that may help

How to reproduce this issue:

Anything else we need to know:

@Ryangr0 Ryangr0 added the kind/bug Categorizes issue or PR as related to a bug. label Nov 28, 2024
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Nov 28, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@Ryangr0 Ryangr0 changed the title Configmap from value.yaml doesn't end up in the out put of helm template (Or in what's eventually applied) Configmap from value.yaml doesn't end up in the output of helm template (Or in what's eventually applied) Nov 28, 2024
@longwuyuan
Copy link
Contributor

/remove-kind bug

  • Use it like this values.yanl example below
controller:
  config:
    use-proxy-protocol: "true"
  extraArgs:
    enable-ssl-passthrough: ""

/close

@k8s-ci-robot k8s-ci-robot added needs-kind Indicates a PR lacks a `kind/foo` label and requires one. and removed kind/bug Categorizes issue or PR as related to a bug. labels Dec 4, 2024
@k8s-ci-robot
Copy link
Contributor

@longwuyuan: Closing this issue.

In response to this:

/remove-kind bug

  • Use it like this values.yanl example below
controller:
 config:
   use-proxy-protocol: "true"
 extraArgs:
   enable-ssl-passthrough: ""

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@Ryangr0
Copy link
Author

Ryangr0 commented Dec 14, 2024

This is my values.yaml:

namespace: ingress-nginx

controller:
  replicaCount: 2
  resources:
    requests:
      cpu: 100m
      memory: 90Mi
  service:
    type: LoadBalancer
    externalTrafficPolicy: Local
    annotations:
      service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol: "true"
      service.beta.kubernetes.io/do-loadbalancer-tls-passthrough: "true"
  config:
    use-proxy-protocol: "true"
    use-forwarded-headers: "true"
    extraArgs:
      enable-ssl-passthrough: ""

This is the command I use to see what the output is:
helm template ingress-nginx .\ops\helm\ingress-nginx\ --namespace ingress-nginx > test.yml

And this is what test.yml contains:

apiVersion: v1
kind: Service
metadata:
  annotations:
  labels:
    helm.sh/chart: ingress-nginx-4.12.0-beta.0
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/version: "1.12.0-beta.0"
    app.kubernetes.io/part-of: ingress-nginx
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: controller
  name: ingress-nginx-controller
  namespace: ingress-nginx
spec:
  type: LoadBalancer
  ipFamilyPolicy: SingleStack
  ipFamilies: 
    - IPv4
  ports:
    - name: http
      port: 80
      protocol: TCP
      targetPort: http
      appProtocol: http
    - name: https
      port: 443
      protocol: TCP
      targetPort: https
      appProtocol: https
  selector:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/component: controller

As you can see, it's missing the annotations, and the configuration. I'm confused why this is happening.

@Ryangr0
Copy link
Author

Ryangr0 commented Dec 14, 2024

@longwuyuan Please reopen this. Your suggestion does not work. My original problem description also shows that that's what I was already doing.

@Ryangr0
Copy link
Author

Ryangr0 commented Dec 14, 2024

I finally figured it out, this happened because my understanding of helm templating is severely lacking. When the same thing happened to me trying to implement Traefik, and that ALSO wasn't applying, my IDE's autocomplete saved me by complete happenstance after 2 hours of debugging without any results.

These values are nested. So not

namespace: ingress-nginx

controller:
  replicaCount: 2
  resources:
    requests:
      cpu: 100m
      memory: 90Mi
  service:
    type: LoadBalancer
    externalTrafficPolicy: Local
    annotations:
      service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol: "true"
      service.beta.kubernetes.io/do-loadbalancer-tls-passthrough: "true"
  config:
    use-proxy-protocol: "true"
    use-forwarded-headers: "true"
    extraArgs:
      enable-ssl-passthrough: ""

But

namespace: ingress-nginx
ingress-nginx:
  controller:
    replicaCount: 2
    resources:
      requests:
        cpu: 100m
        memory: 90Mi
    service:
      type: LoadBalancer
      externalTrafficPolicy: Local
      annotations:
        service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol: "true"
        service.beta.kubernetes.io/do-loadbalancer-tls-passthrough: "true"
    config:
      use-proxy-protocol: "true"
      use-forwarded-headers: "true"
      extraArgs:
        enable-ssl-passthrough: ""

(I use the root level namespace for my CI/CD deployments, it is unrelated to the nginx helm charts)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
Development

No branches or pull requests

3 participants