Skip to content
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

Fix Helm chart service labels #615

Merged
merged 1 commit into from
Apr 11, 2022
Merged

Conversation

stevehipwell
Copy link
Contributor

Description of changes:

This PR undoes the change made in #604 and fixes the actual issue I introduced in the chart refactor work.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Signed-off-by: Steve Hipwell <steve.hipwell@gmail.com>
@stevehipwell stevehipwell requested a review from a team as a code owner April 8, 2022 16:44
@stevehipwell
Copy link
Contributor Author

/assign @bwagner5

@@ -25,5 +25,5 @@ spec:
{{- end }}
selector:
matchLabels:
{{- include "aws-node-termination-handler.labels" . | nindent 6 }}
{{- include "aws-node-termination-handler.selectorLabelsDeployment" . | nindent 6 }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is defined here, for reference:

{{- define "aws-node-termination-handler.selectorLabelsDeployment" -}}
{{ include "aws-node-termination-handler.selectorLabels" . }}
app.kubernetes.io/component: deployment
{{- end -}}

The important point is that it defines component to be deployment.

@@ -48,7 +48,6 @@ Common labels
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/component: {{ .Release.Name }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify that my understanding of this change: the bug previously was that component was set to aws-node-termination-handler, which is not correct. The value should have been daemonset or deployment (depending on the way NTH runs in the cluster). Your solution is to remove this from the generic labels and instead assign it in the supersets of labels called labelsDeployment and labelsDaemonset, and then to use the unrelated selectorLabelsDeployment for the service monitor template, which separately sets component to deployment.

Do I understand correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that is correct. When I refactored the chart I accidentally left the component in the main labels function and forgot to add the component labels functions. Without these functions the component was incorrectly set in the resource labels but the only bug would be the ServiceMonitor as that's the only selector working on these labels.

@snay2 snay2 merged commit 08d4552 into aws:main Apr 11, 2022
@stevehipwell stevehipwell deleted the chart-fix-service-labels branch April 11, 2022 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants