Using a label selector to link a service to a deployment
vbehar opened this issue · 3 comments
Question:
Hi guys,
quick question: why don't you use a label selector to link the deployment and the service ? instead of using the deployment name.
I'm asking because using the deployment name can be painful, for example when using helm - see helm/helm#2492 for example. It would have been much easier for us to use a label selector.
Thanks
When the activator serves some traffic on behalf of an application, it needs to know about precisely one corresponding deployment that needs to be scaled up from zero. A label selector isn't going to guarantee a 1:1 relationship between a service and a deployment.
fwiw, I don't think this should complicate Helm charts much. Can you show me an example of the difficulty you're running into and I can maybe help you work around it?
thanks.
So I managed to work-around my helm issue, by using the tpl
function to execute a template block which is used to retrieve the release name. Something like https://hackernoon.com/the-art-of-the-helm-chart-patterns-from-the-official-kubernetes-charts-8a7cafa86d12#a935
So I managed to work-around my helm issue, by using the tpl function to execute a template block which is used to retrieve the release name.
That's not really a workaround, imo. That's common practice in Helm charts. It's the only way that one resource can ever reference another-- a common example of which would be referencing secrets or config maps when setting an environment variable in a pod. This approach is so ubiquitous, in fact, that when you use helm create
, it automatically generates such templates for you.