-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Helm lookup function not working for resources created in the same chart #13038
Comments
I can explain what's happening here. It's not a caching issue. First, Helm generates the manifests from the templates. All of them are handled at the same time. This is when the Second, Helm sends all of the generated manifests to the Kubernetes API at once. There is some ordering to it but it is still one large batch. Kubernetes is designed to be declarative. You pass everything to it and the controllers should continuously reconcile until everything is in a healthy state. Unfortunately, this doesn't always work. In this case it looks like you want things to behave in 2 steps. One the resource for the CIDR has completed getting the CIDRs and has them on the status then update the pods to use them. There is no good way to do this in Helm. The more idiomatic way to do this in k8s is with another CRD and custom controller over all those things. |
Thanks for the explanation! Here's some additional context: We're creating CIDR resources using pre-install hooks that include Jobs to verify their validity by checking the
In subsequent templates, we attempt to lookup these CIDRs using lookup. However, this fails (per above) because the resources haven't been deployed yet when Helm initially processes the templates. Given this, I'm wondering if splitting the chart into two parts would be a viable alternative to creating a new controller: Chart 1: Create the CIDR resources and verify.
|
Resolved the issue by splitting the original chart into two separate charts:
Installing Chart 1 first ensures CIDR resources are available for Chart 2. Having Chart 1 as a dependency in Chart 2 did not work due to conflicting values and overrides from Chart 1 being templated into Chart 2. Overall, this approach avoids conflicts and eliminates the need for a custom controller. The choice was to ship a wonky chart using:
..or structure two separate Chart |
We can close this issue as I have what I need. Could we consider an update to the The I'd be happy to draft a small change for inclusion if agreeable. Appreciate the help! |
We are encountering an issue with the Helm
lookup
function when trying to reference resources that are created within the same chart during installation. It appears that thelookup
function is unable to find the newly created resources, leading to installation failures.We have a chart that creates CIDR resources and then attempts to
lookup
those resources in subsequent parts of the chart. However, due to Helm's caching or some unknown snapshot of the Kubernetes API (??), thelookup
function fails to find the newly created CIDR resources later in the Chart's execution.Output of
helm version
:Output of
kubectl version
:Cloud Provider/Platform (AKS, GKE, Minikube etc.): Google
Here are the relevant snippets from our chart where we are encountering this issue:
../some-template.yaml
:The initial installation fails because the
lookup
function is unable to find the newly created CIDR resources generated earlier in the same chart (as pre-install hooks). However, the immediately-after and subsequenthelm upgrade
succeeds because the CIDRs are then present in the cluster when the upgrade process begins.We would like to confirm if there is some sort of caching of the kubernetes API or some "snapshot" of the cluster's resources at the beginning of the initial installation or subsequent upgrade process, and if this is a known limitation of the
lookup
function or if there are any recommended workarounds to handle this scenario.Any guidance or insights would be greatly appreciated. Thank you in advance for your help!
Similar to #10186, but
uniq
function will not work here..The text was updated successfully, but these errors were encountered: