IssueRaiser

Helm lookup Function Support

Hello, Happy new year Guys !! So, I have this requirement to build the imagePath by reading the dockerRegistryIP value from configMap, so that I need not ask user explicitly where the registry is located. ``` apiVersion: apps/v1 kind: Deployment metadata: name: {{ template "helm-guestbook.fullname" . }} spec: containers: - name: {{ .Chart.Name }} image: {{ printf "%s/%s:%s" **$dockerRegistryIP** .Values.image.repository .Values.image.tag }} ``` Helm3 has introduced support for this where they introduced a **lookup** function through which configMap can be read at runtime like this, `{{ (lookup "v1" "ConfigMap" "default" "my-configmap").data.registryURL}}` But the lookup function will return nil when templates are rendered using "helm dryrun" or "helm template" as a result when you parse a field on nil, you will see an exception like this, "nil pointer evaluating interface {}.registryURL Use --debug flag to render out invalid YAML" The solution which was proposed on stack overflow is to use "helm template --validate" instead of "helm template" Can you guys add support for this ? Right now am populating docker-registry-ip like this, but with this kustomize-plugin approach am loosing the ability to render values.yaml file as an config screen through which user can override certain values i.e. the fix to solve one issue has lead to an other issue ``` kubectl -n argocd get cm argocd-cm -o yaml apiVersion: v1 data: configManagementPlugin

Posted by rajivml on Jan 7, 2021, 4:21 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments

support (Software)

Helm lookup Function Support

rajivmlJan 7, 2021, 4:21 AM

Hello, Happy new year Guys !! So, I have this requirement to build the imagePath by reading the dockerRegistryIP value from configMap, so that I need not ask user explicitly where the registry is located. ``` apiVersion: apps/v1 kind: Deployment metadata: name: {{ template "helm-guestbook.fullname" . }} spec: containers: - name: {{ .Chart.Name }} image: {{ printf "%s/%s:%s" **$dockerRegistryIP** .Values.image.repository .Values.image.tag }} ``` Helm3 has introduced support for this where they introduced a **lookup** function through which configMap can be read at runtime like this, `{{ (lookup "v1" "ConfigMap" "default" "my-configmap").data.registryURL}}` But the lookup function will return nil when templates are rendered using "helm dryrun" or "helm template" as a result when you parse a field on nil, you will see an exception like this, "nil pointer evaluating interface {}.registryURL Use --debug flag to render out invalid YAML" The solution which was proposed on stack overflow is to use "helm template --validate" instead of "helm template" Can you guys add support for this ? Right now am populating docker-registry-ip like this, but with this kustomize-plugin approach am loosing the ability to render values.yaml file as an config screen through which user can override certain values i.e. the fix to solve one issue has lead to an other issue ``` kubectl -n argocd get cm argocd-cm -o yaml apiVersion: v1 data: configManagementPlugin

Comments (0)

No comments yet. Start the discussion.

Comment on this issue