You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add the ability to refer to runtime values (service's IP) in dependent resources. #949
For example, I would like to start a service and use it's IP address in another pod. Dependencies have been discussed before in other contexts. Ref: issues #53#54. This is very useful and simplifies handling dependent charts.
Reacted by Haoyuan Ge, Lorenzo Setale, Shyam Sundar C S, Chaoran Yu, xiaoyu zhou, velmafia, Nirav Patel, debu99 and Caleb Collins-Parks
Since templates are rendered before resources are loaded into Kubernetes, templates cannot find out at render time what the IPs are. But you could use label selectors, Downward API, Kubernetes environment variables, and skydns queries to find this information out.
@technosophos@bacongobbler Both the service discovery methods (environment variables and DNS) within Kubernetes clusters return the cluster local IP addresses, but not the external addresses for LoadBalancer services. Also, I don't think Downward API exposes the service IP address.
To convert these to helm, I see three options. Let me know if you have any other recommendations.
Put the service and deployment charts into separate helm packages. Submit the service chart and poll until the external IP is assigned and then submit the deployment chart with the IP address.
Build the service polling logic into the apiserver container or into the apiserver itself.
Use the new, in-alpha, init container feature and put the polling logic there.
None of these options are any better than what we have today, which in my opinion is already unnecessarily complicated and could be much simplified if there is a tool that can handle dependencies. And among the tools we have today I think helm is the closest.
In today's Helm, you could use pre-install hooks to do some of the things you were thinking of. But again, I'm not sure that that would decrease the complexity of the logic.
It sounds like what would really solve the problem for you is for some way to say to Helm: "At the time that this manifest (or resource) is loaded, do a lookup for me and inject the results here." Does that sound accurate?
I'm not sure how to best express that in Helm right now. If you had an ideal way, what would it look like? Would it be a template directive? Want to mock that out and see if we can get some ideas going?
changed the title [-]Add the ability to refer values in dependent resources.[/-][+]Add the ability to refer to runtime values (service's IP) in dependent resources.[/+]on Aug 8, 2016
This is a needed feature. Another use case:
Web frontend running in a service talking to multiple microservices over the internet (Javascript calls) deployed in their own services.
I need a way to be able to find out what's the public IP of a specific service from within the container.
Currently DNS exposes the service.namespace (which is internal), and the environment variables expose the internal load balancer IP (which won't be routable from Javascript).
Reacted by Alessandro Vozza, Roman Schiefer, Ryan Dawson, Nicholas Wright, Goran Udosic, Matheus Moraes, onlypiglet and Aulia Lionar
If someone would write up a design document with a reference implementation on how this could be solved, that would be incredibly helpful. We're not sure how to best express this in Helm, so perhaps someone from the community may know more.
Its 2019 and I'm still waiting for this feature 🤣
My need is just to get the nodes's IP address based on the label, and assign them to the value resource in the pre-install hook.
@technosophos Hi, sorry for DM, just wondering if my case is a valid request for this feature, I'm trying to assign the node's ip address base on their label during the chart installation. Or if there is a alternative way to do this? Thanks
@viane Unfortunately, I don't think this is possible in a pre-install hook since the resources haven't been created in Kubernetes yet. Essentially, the only way I can think of doing this is checking with the Kubernetes API server (like @bacongobbler mentions above) once the resources have been created -- either in a post-install hook, or once the pod container comes up at runtime.
in my case its only available thru k8s resource, a worker node ip inside the cluster... And I still couldn't find a clean way to get this resource. But the label and node's ip was already exist inside k8s, why can't helm retrieve it ....
One use case would be setting up the upstream DNS service for kube-dns using the stubDomains configuration. The stubDoamins destinations can only be IP addresses of upstream DNS services. It would be great if the IP address assigned to a service can be referred to during the helm installation so that this stubDomains configuration can be done in the same helm chart. See here and here.
Activity
[-]Ability to refer values in dependent resources.[/-][+]Add the ability to refer values in dependent resources.[/+]technosophos commentedon Jul 14, 2016
Isn't this solved by the Kubernetes environment variable and service discovery protocols? http://kubernetes.io/docs/user-guide/connecting-applications/#accessing-the-service
Since templates are rendered before resources are loaded into Kubernetes, templates cannot find out at render time what the IPs are. But you could use label selectors, Downward API, Kubernetes environment variables, and skydns queries to find this information out.
bacongobbler commentedon Jul 14, 2016
Indeed, isn't this just a re-implementation of http://kubernetes.io/docs/admin/dns/? Sounds to me this has already been solved upstream. Can you supply a use case where this would be required?
madhusudancs commentedon Jul 21, 2016
@technosophos @bacongobbler Both the service discovery methods (environment variables and DNS) within Kubernetes clusters return the cluster local IP addresses, but not the external addresses for LoadBalancer services. Also, I don't think Downward API exposes the service IP address.
Here is a more concrete use case. I am considering converting "Cluster Federation" components to helm charts. Here is the federation-apiserver pod template spec - https://github.com/kubernetes/kubernetes/blob/master/federation/manifests/federation-apiserver-deployment.yaml#L25. The
--advertise-addressflag value is parametrized and should be substituted with the external address of thetype: loadBalancerservice created for thefederation-apiserver. Look at the current code to do this - https://github.com/kubernetes/kubernetes/blob/master/federation/cluster/common.sh#L127To convert these to helm, I see three options. Let me know if you have any other recommendations.
init containerfeature and put the polling logic there.None of these options are any better than what we have today, which in my opinion is already unnecessarily complicated and could be much simplified if there is a tool that can handle dependencies. And among the tools we have today I think helm is the closest.
Btw, this is just one concrete use case.
technosophos commentedon Jul 22, 2016
Ah! I understand much better now. Thanks.
In today's Helm, you could use
pre-installhooks to do some of the things you were thinking of. But again, I'm not sure that that would decrease the complexity of the logic.It sounds like what would really solve the problem for you is for some way to say to Helm: "At the time that this manifest (or resource) is loaded, do a lookup for me and inject the results here." Does that sound accurate?
I'm not sure how to best express that in Helm right now. If you had an ideal way, what would it look like? Would it be a template directive? Want to mock that out and see if we can get some ideas going?
[-]Add the ability to refer values in dependent resources.[/-][+]Add the ability to refer to runtime values (service's IP) in dependent resources.[/+]technosophos commentedon Dec 19, 2016
We are still tossing around some ideas on how to do this. /cc @adamreese
thomastaylor312 commentedon Mar 24, 2017
@technosophos or @adamreese Is there still ongoing discussion/plans for this on a minor release or should be bump it to the "major" milestone?
pierreozoux commentedon Mar 27, 2017
I'm actually working on a public chart for jitsi, and it needs to know it's public IP.
What is the way to solve this today?
bacongobbler commentedon Mar 27, 2017
https://github.com/kubernetes/charts/blob/master/stable/drupal/templates/NOTES.txt shows some examples on how you can fetch a chart's public IP address depending on what service type was deployed. Essentially if you need the public IP at runtime, you'll have to check with the kubernetes apiserver.
sabbour commentedon Oct 3, 2017
This is a needed feature. Another use case:
Web frontend running in a service talking to multiple microservices over the internet (Javascript calls) deployed in their own services.
I need a way to be able to find out what's the public IP of a specific service from within the container.
Currently DNS exposes the service.namespace (which is internal), and the environment variables expose the internal load balancer IP (which won't be routable from Javascript).
bacongobbler commentedon Oct 31, 2017
If someone would write up a design document with a reference implementation on how this could be solved, that would be incredibly helpful. We're not sure how to best express this in Helm, so perhaps someone from the community may know more.
11 remaining items
scottlindner commentedon Aug 10, 2018
I wrote a shell script that runs at container startup that talks to the cluster to get those values and drops them in environment variables.
SachinHg commentedon Sep 30, 2018
Can someone please help with this feature?
viane commentedon Jan 16, 2019
Its 2019 and I'm still waiting for this feature 🤣
My need is just to get the nodes's IP address based on the label, and assign them to the value resource in the pre-install hook.
@technosophos Hi, sorry for DM, just wondering if my case is a valid request for this feature, I'm trying to assign the node's ip address base on their label during the chart installation. Or if there is a alternative way to do this? Thanks
AlexShemeshWix commentedon Jan 30, 2019
+1
gazhenko commentedon Feb 6, 2019
+1
SlickNik commentedon Feb 7, 2019
@viane Unfortunately, I don't think this is possible in a pre-install hook since the resources haven't been created in Kubernetes yet. Essentially, the only way I can think of doing this is checking with the Kubernetes API server (like @bacongobbler mentions above) once the resources have been created -- either in a post-install hook, or once the pod container comes up at runtime.
kierenj commentedon Feb 13, 2019
Is there some reason this approach - getting the public IP in a script - is no good?
https://github.com/RedRiverSoftware/sql-azure-firewall-opener/blob/master/azsqlfirewall.sh
viane commentedon Feb 13, 2019
in my case its only available thru k8s resource, a worker node ip inside the cluster... And I still couldn't find a clean way to get this resource. But the label and node's ip was already exist inside k8s, why can't helm retrieve it ....
archelangelo commentedon Jun 20, 2019
One use case would be setting up the upstream DNS service for
kube-dnsusing thestubDomainsconfiguration. ThestubDoaminsdestinations can only be IP addresses of upstream DNS services. It would be great if the IP address assigned to a service can be referred to during the helm installation so that thisstubDomainsconfiguration can be done in the same helm chart. See here and here.dshakey commentedon Oct 5, 2019
bacongobbler commentedon Jan 27, 2020
closing as #6752 has been merged and will be available in 3.1.0.
build(deps): bump github.com/hashicorp/go-getter from 1.7.1 to 1.7.2 (h…