Add the release name to the label/selector
Opened this issue · 1 comments
Back when we were in OpenShift and thus using Routes, life was good. But now that we're running in environments like EKS, and using a load balancer on the Kube Service, we need to fix up the labels used by the selector. That means adding the helm release name prefix. Today, if only one copy of Stock Trader is installed in a given namespace in EKS, all is fine. But as soon as we install multiple copies, each with their own helm release name, we are getting routing weirdness, because of not including that helm release name in the label to scope it to the one we want.
So this in the Deployment:
spec:
replicas: {{ .Values.trader.replicas }}
selector:
matchLabels:
app: trader
Needs to change to this:
spec:
replicas: {{ .Values.trader.replicas }}
selector:
matchLabels:
app: {{ .Release.Name }}-trader
And this in the Service:
selector:
app: trader
Needs to change to this:
selector:
app: {{ .Release.Name }}-trader
Note this needs to be done in the yaml template for each of the microservices in the helm chart.