-
Notifications
You must be signed in to change notification settings - Fork 710
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
Added labels following helm best practises #1783
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,13 +32,25 @@ Create chart name and version as used by the chart label. | |
{{- end -}} | ||
|
||
{{/* | ||
Common labels | ||
Common labels for additional kubeapps applications. Used on resources whose app name is different | ||
from kubeapps | ||
*/}} | ||
{{- define "kubeapps.labels" -}} | ||
app: {{ include "kubeapps.name" . }} | ||
{{- define "kubeapps.extraAppLabels" -}} | ||
chart: {{ include "kubeapps.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
helm.sh/chart: {{ template "kubeapps.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "kubeapps.labels" -}} | ||
app: {{ include "kubeapps.name" . }} | ||
app.kubernetes.io/name: {{ include "kubeapps.name" . }} | ||
{{ template "kubeapps.extraAppLabels" . }} | ||
{{- end -}} | ||
|
||
{{/* | ||
|
@@ -47,6 +59,9 @@ Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector | |
{{- define "kubeapps.matchLabels" -}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see this |
||
app: {{ include "kubeapps.name" . }} | ||
release: {{ .Release.Name }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here you are just adding one of the labels, is that intentional? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, as this did not had the |
||
app.kubernetes.io/name: {{ include "kubeapps.name" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end -}} | ||
|
||
{{/* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add the other two annotations that are recommended:
app.kubernetes.io/name
andapp.kubernetes.io/managed-by
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I see that these labels are defined in the
_helpers.tpl
file too:We can add the new labels there and simply use the helper everywhere (to avoid having to add the labels one by one).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that not all the labels added in all the cases use the same parameters. It seem the
app/app.kubernetes.io/name
usually changes.I've created a new template that adds all the labels that are common except those two ones and used it wherever those labels were the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦 this is a bit of a mess (our fault). I guess
app
should have been always the same but we changed it in several places and now we cannot fix it without making it a breaking change.From the definition in the docs:
app.kubernetes.io/name: This should be the app name, reflecting the entire app. Usually {{ template "name" . }} is used for this. This is used by many Kubernetes manifests, and is not Helm-specific.
. Can we at least have a commonapp.kubernetes.io/name
? We can move that new label to the common group.