Repository navigation
Description
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:
configManagementPlugins: |
- name: kustomized-helm
generate:
command: [sh, -c]
args: ["DOCKER_REG_IP=$(kubectl -n registry get svc registry -o jsonpath={.spec.clusterIP}) && sed -i \"s/DOCKER_REGISTRY_IP/$DOCKER_REG_IP/g\" kustomization.yaml | helm template $ARGOCD_APP_NAME --namespace $ARGOCD_APP_NAMESPACE . > all.yaml && kustomize build"]
- name: kustomized
generate:
command: [sh, -c]
args: ["DOCKER_REG_IP=$(kubectl -n registry get svc registry -o jsonpath={.spec.clusterIP}) && sed -i \"s/DOCKER_REGISTRY_IP/$DOCKER_REG_IP/g\" kustomization.yaml | kustomize build"]
Activity
jessesuen commentedon Jan 7, 2021
Note that even if we allowed configuring Argo CD to append the
--validatearg when running thehelm templatecommand, the repo-server would still need to be given API server credentials (i.e. mount a service account token) in order to perform thelookup. We would not ever allow kubernetes credentials to repo-server as a default (though you are welcome to modify your deployment in your environment) so there would not be a value in adding a--validateoption configuration.Since you would anyways need a customized repo-server, you can already accomplish this today using a wrapper script around the
helmbinary which appends the argument in the script (coupled with the service account given to the repo server).kvaps commentedon Jan 7, 2021
@jessesuen, I guess this workaround is possible only with in-cluster configuration, and wont work for the external ones.
jessesuen commentedon Jan 8, 2021
Ah yes, you are right about that unfortunately.
Gowiem commentedon Feb 16, 2021
@jessesuen just coming across this issue and I'm running into the same. There is duplicate issue here as well: #3640
You mentioned two things to accomplish as a work around for Argo not supporting this:
Can you expand more on the wrapper script? How would one inject that into a standard Argo deployment?
dvcanton commentedon Apr 14, 2021
Hi @jessesuen, @Gowiem,
any updates on this?
Thanks in advance, Dave
Gowiem commentedon Apr 14, 2021
@dvcanton I tried the Argo plugin / wrapper script approach that @jessesuen mentioned after asking about it directly in the Argo Slack. You can find more about that by looking at the plugins documentation.
Unfortunately, that solution seemed overly hacky and pretty esoteric to me and my team. Instead we've now moved towards not using
lookupin our charts and copy / pasting certain configuration manually instead. It's not great and I wish Argo would support this, but doesn't seem like there is enough momentum unfortunately.randrusiak commentedon Apr 27, 2021
A lot of charts use build-in objects such as Capabilities to provide backward compatibility for old APIs. Capabilities.APIVersions works properly only with --validate flag because without this flag it returns only API versions without available resources.
There is an example in grafana chart: https://github.com/grafana/helm-charts/blob/main/charts/grafana/templates/ingress.yaml#L7
kvaps commentedon Apr 27, 2021
As about Capabilities,
helm templatecommand supports setting capabilities manually, ref #3594randrusiak commentedon Apr 28, 2021
@kvaps take a look for an example which I posted.
{{- $newAPI := .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}}it returns false because without--validateflag only APIs versions are returned.kvaps commentedon Apr 28, 2021
@randrusiak, it works to me:
my idea was that ArgoCD could provide repo-server list of api-versions from destination Kubernets API. eg:
will return all available apiversions for the cluster.
Not sure if lookup function support can be implemented with the same simplicity, as it already requires direct access to the cluster.
randrusiak commentedon Apr 28, 2021
@kvaps I understand how it works on the helm level, but I don't know how to pass this additional flag
--api-versions networking.k8s.io/v1/Ingressvia argo manifest. It's still unclear to me. Could you explain that to me? I'd appreciate your help.kvaps commentedon Apr 28, 2021
Actually my note was more likely for contributors than for users :)
They could implement api-versions passing from the argocd-application-controller to the argocd-repo-server via API call.
On current stage, I think you got nothing to do. The only workaround for you is to add serviceAccount to your repo-server and use
--validateflag forhelm template(you would need to create small shell wrapper script forhelmcommand, or use custom plugin). Unfortunately this is less secure and would work only with the single cluster (the current one).Another option for you is to hardcode those parameters somewhere, eg. save the output of the following command:
And pass it to helm, using any suitable way for you, eg, you can still use wrapper script for
helm, something like that:where:
/usr/local/bin/helm.bin- the original helm binary#HELM_EXTRA_ARGS- extra variable for your repo-serveror using custom-plugin
jgoeres commentedon May 7, 2021
We also ran into the issue with the non-working lookup function. Background is that we want to make sure that for a certain service, a secure random password is generated instead of having a hardcoded default. If desired, the use can explicitly set his own password, but most people don't.
Since we are using Helm's random function, the password is newly generated with each helm upgrade (resp. helm template), so the password would not remain stable. So we use the lookup function to check if the secret holding the password already exists and only generate the password if it doesn't. So effectively, it will only be generated initially on "helm install".
With the non-working lookup function in Argo, we have the issue that the password will be regenerated on each sync, wreaking quite some havoc, as you might guess.
Our goal is to keep the helmchart usage as simple as possible and require as little parameters for simple installations. So I would like to keep the "generate a secure (and stable) random password" as the default for "pure" Helm usage.
Is there a way to find out in the helmchart that we are actually running inside Argo? That would allow me to react to this and add a validation that enforces explicitly setting a password in Argo-based deployments.
103 remaining items
bennypea commentedon Jan 14, 2025
Great! Thank you
jacob-kuder commentedon Feb 12, 2025
I know we are closer with the merging of the impersonation work. How's this work going beyond that to resolve this overall issue? Been re-reading everything here and feel that we're closer to a resolution but one hasn't been completed yet. Thanks so much!
niklasfrick commentedon Mar 20, 2025
Any news on this?
vistasunil commentedon Apr 4, 2025
Are you also going to enable helm template --dry-run=server option in the enhancement as mentioned in #16367?
mzupan commentedon Apr 20, 2025
So i got this working sort of
The issue with this is repo-server is a role and probably needs a clusterrole for it to work and look for things outside of the namespace it lives in. Also I think its a large amount of work if you need to do a lookup on a remote server. That was just on my laptop and a cluster that lives on my laptop.
I'm not sure if repo-server handles the auth into a remote server or if that's something like application controller.
Happy to put up a fork if someone wants to take what I did and build on it. It would be super nice to somehow be able to use lookup(). It makes doing things in terraform and have TF drop a configmap somewhere and then helm template picks it up to use pretty nice
JuryA commentedon Jul 19, 2025
@acelinkio I tend to agree with you—ideally, all such orchestration and lookup functionality would be solved natively within Kubernetes itself, rather than as ad-hoc extensions in tools like Helm. The challenge, though, is that getting any changes or new features approved and implemented in Kubernetes is a notoriously slow and complex process. This is understandable, given how conservative and stability-focused the project is, but it inevitably leads to “workarounds” like Helm’s
lookupfunction or hooks.Frankly, I’d also prefer not to have to use these mechanisms, since they’re almost always awkward hacks, as you pointed out. But to be realistic, sometimes there’s simply no practical alternative, especially when user experience is on the line (as long as it doesn’t compromise healthy security practices). I’ve seen situations where a strictly declarative, “pure” implementation ended up being far less usable than one that made limited use of a hook or lookup.
So I wouldn’t be too quick to dismiss these features entirely—while they are far from ideal, the alternatives aren’t always as clear-cut or pragmatic in real-world scenarios.
akessner commentedon Jul 20, 2025
Might want to look into KRO or Crossplane 2.0 for "Server side" configurations.
JuryA commentedon Aug 4, 2025
I hear this argument a lot:
Okay. Let me respond clearly — not out of ego, but out of operational reality.
Yes,
lookupis a compromise.But no, it's not the mistake.
The real mistake is pretending we live in a world where we always get to choose.
We don’t.
Some of us work in environments where:
In that world, there's no "clean architecture," no "freedom of choice," and definitely no time for “waiting until Kubernetes maybe solves it upstream.”
There’s just money, uptime, and consequences.
You know what passed all reviews, audits, and actually made it into production?
lookup.Because it's:
I love Crossplane. I actively prefer Crossplane.
Where I can use it, I absolutely do.
But
lookup? That’s not a substitute. It’s a different tool, solving a specific operational gap inside Helm.And it does that safely, cleanly, and predictably, as long as you’re not using it like a monkey with a wrench.
Let’s ask the real question here:
helm-secrets? → Not pure. That’s a plugin. Which might not even work on your hardened kernel.If it’s not integrated, auditable, and deployable by default in standard Helm, it’s not "pure" — it’s just fragile and non-portable.
You know what’s pure?
Shipping working software, on time, without breaking production.
Shipping something that doesn't require 10 external tools, CI mutations, or heroic ops scripting just to survive.
And here’s the hard truth:
Until that gap is addressed upstream (if ever),
lookupis:So let’s stop pretending this is about taste or style.
It’s about what works under pressure, under constraints, and under fire.
You want to stop misuse of
lookup?Great.
Teach people how not to abuse it.
That’s the only battle worth fighting.
Everything else is blogpost theater.
This is not theoretical. This is delivery.
And unless you’ve shipped into a live environment with 7-figure liability behind every deploy,
you might want to hold off on calling working solutions "mistakes."
crenshaw-dev commentedon Aug 4, 2025
Reminder to please balance passion for the subject with empathetic and diplomatic delivery.
Stevenpc3 commentedon Aug 4, 2025
@JuryA I would up vote this a billion times if I could. I would follow it up with similar examples if I was allowed and I would add more if it wasn't already complete.
In certain life or death, save the country infrastructures this all applies and it really makes the job hard. Not everything is commercial, not everything is easy and open, not everything can be explained. It's certainly a hard balance and it's tough to get that shared with others.
TheUnableDeveloper commentedon Oct 22, 2025
@farioas I want to marry you after this, you saved my life 😭
add lakekeeper bootstrap: namespace + encryption key + S3 svcacct seal
feat: lakekeeper Iceberg REST catalog
32a1a9d: feat: lakekeeper Iceberg REST catalog
Fix bundled Postgres Secret password drift durably (bug #1)