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

helm chart: Add extra labels and annotations to pods and k8s resources / Allow SSL mode to be defined. #655

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jescarri
Copy link

Allow users to specify extra labels and annotations to pods and other k8s resources.

This change allows users to set extra labels and annotations to pods and k8s resources.

How to use

In the values file:

extraLabels:
  foo: bar
 extraAnnotations:
  foo: bar

podLabels:
  another: test
podAnnotations:
   test: test

The above will label all k8s resources with foo: bar and annotate all k8s resources with foo:bar

In addition pods will be labelled with extraLabels + another: test and annotated with extraAnnotations + test: test

To test:

Deploy nebraska using the helm chart + add the above values to your values file.

Testing done

Nebraska has been deployed in our clusters using the modified helm chart, we are able to add extra labels and annotations.

  • [ *] Changelog entries added in the respective changelog/ directory (user-facing change, bug fix, security fix, update)
  • Inspected CI output for image differences: /boot and /usr size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.

@jescarri jescarri changed the title helm chart: Add extra labels and annotations to pods and k8s resources helm chart: Add extra labels and annotations to pods and k8s resources / Allow SSL mode to be defined. Jun 23, 2023
Copy link
Contributor

@mkilchhofer mkilchhofer left a comment

Choose a reason for hiding this comment

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

Version bump in Chart.yaml required. But aside this LGTM

@pothos
Copy link
Member

pothos commented Jul 24, 2023

Sorry for the review delay, we'll try to assign someone in tomorrow's planning call flatcar/Flatcar#1103

@jescarri
Copy link
Author

Ah! sweet let me bump the version.

Thanks!

Allow users to specify extra labels and annotations to pods and other k8s resources.
@jescarri
Copy link
Author

@pothos bumped the patch version.

Thanks for taking a look at this PR.

@efcy
Copy link

efcy commented Jul 31, 2023

At my company we would really like this change as well.

@pothos
Copy link
Member

pothos commented Jul 31, 2023

The CI linter complains, can someone have a look? I used the GitHub UI to bump to version 1.1.1 but it created a merge commit, maybe squash that, too.

@@ -24,6 +32,7 @@ spec:
{{- end }}
labels:
{{- include "nebraska.selectorLabels" . | nindent 8 }}
{{ toYaml .Values.podLabels | nindent 8 }}
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like adding extra pod labels in this way does not work.

Suggested change
{{ toYaml .Values.podLabels | nindent 8 }}
{{- with .Values.podLabels }}
{{ toYaml . | nindent 8 }}
{{ - end }}

should fix the linter issue.

@@ -19,7 +19,7 @@ sources:
maintainers:
- name: kinvolk
url: https://kinvolk.io/
version: 1.1.0
version: 1.1.1
Copy link
Contributor

Choose a reason for hiding this comment

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

Please bump at least the minor version as this PR adds additional features and not bugfixes.

Copy link
Member

Choose a reason for hiding this comment

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

Thank you for the review, I'm not a Helm user myself and don't know how the versioning is used in practice… So rather semver-like, it seems.

Comment on lines 13 to +19
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with.Values.extraAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

This block needs more attention.

If ingress.annotations is not set and you set extraAnnotations, the manifest is no longer valid as the annotations: line is not rendered then.

{{- with .Values.extraLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
Copy link
Contributor

Choose a reason for hiding this comment

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

Almost same here, please surround the annotations: line with an if conditional or use a sprig merge function to merge both anntations slices together.

{{- with .Values.extraLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with.Values.extraAnnotations }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

{{- with .Values.ingress.update.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with.Values.extraAnnotations }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same

@jescarri
Copy link
Author

Cool I will add the fixes today.

Thanks for the review.

@sayanchowdhury
Copy link
Member

hi @jescarri, friendly ping here, Did you get to look through the suggestions mentioned in the review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

6 participants