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

chore(localstack): add extraLabels option and align documentation #128

Merged
merged 2 commits into from
Nov 27, 2024

Conversation

levivannoort
Copy link
Contributor

@levivannoort levivannoort commented Nov 27, 2024

Motivation

We're using Localstack when spinning up temporary pull request environments. I would like to use Kyverno to act upon a time-to-live (ttl) label set on all of the resources with the temporary pull request environments. Although it had a an extraAnnotations option, I am missing an extraLabels option.

Another option would be to use the common.labels of the chart dependency.

Changes

Added a extraLabels value which is evaluated through the template.

Testing

Add a key & value under the extraLabels, an example can be see below with the Kyverno time-to-live (ttl) label.

extraLabels:
    cleanup.kyverno.io/ttl: 2m

@alexrashed alexrashed self-assigned this Nov 27, 2024
@alexrashed alexrashed added the type: enhancement Improvement to usability or performance label Nov 27, 2024
Copy link
Member

@alexrashed alexrashed left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks, @levivannoort for the contribution! It is really looking great! I only had one comment we need to address before we can merge this! 🚀

Comment on lines +98 to +99
| `extraDeploy` | Extra objects to deploy (value evaluated as a template) | `{}` |
| `extraAnnotations` | Add additional annotations to every resource (value evaluated as a template) | `{}` |
Copy link
Member

Choose a reason for hiding this comment

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

praise: ‏Thanks for adding docs on already existing features!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The whole values files could be made to adhere to a predefined structure in which the readme in it's current form is generated based on the default values file - it does seem like some of the values have these 'annotations' that are needed, e.g., https://github.com/bitnami/readme-generator-for-helm

Copy link
Member

@alexrashed alexrashed Nov 27, 2024

Choose a reason for hiding this comment

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

Sure, thanks for the tip, that's already on the bucket list 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I have some additional time I could create a pull request for it!

Copy link
Member

Choose a reason for hiding this comment

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

That would be great :)

Comment on lines 43 to 45
{{- if .Values.extraLabels }}
{{ toYaml .Values.extraLabels }}
{{- end }}
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: The evaluation of the labels does not yet include the tpm directive to evaluate the content of the value as a template itself (as mentioned in your docs addition). So we would either have to implement this similar to the localstack.annotations (see here) or remove the "(value evaluated as a template)" from the README.‏

Copy link
Contributor Author

@levivannoort levivannoort Nov 27, 2024

Choose a reason for hiding this comment

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

Aligned the behavior for extraLabels with extraAnnotations to have consistency across the template, thanks for pointing it out.

@@ -40,6 +40,9 @@ helm.sh/chart: {{ include "localstack.chart" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.extraLabels }}
{{ toYaml .Values.extraLabels }}
Copy link
Member

Choose a reason for hiding this comment

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

question: You mentioned in your PR description that we could also use commons.labels here. I do not have a strong opinion on this, so I'd leave this up to you. The upside is that you could create a cross-chart UX since for all charts that use commons.labels, setting global labels works like this.‏ On the other hand we have not been consistently using the commons chart features yet, so calling it extraLabels is more consistent in the usage of this chart.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd probably opt for going with the extraLabels to indeed have consistent usage in the chart for now, and later adopt the common chart with more of the template options if needed.

Copy link
Member

@alexrashed alexrashed left a comment

Choose a reason for hiding this comment

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

Thanks a lot for addressing the comments! 🚀
And congrats to PR # 2^7! 🥳
I'll merge this directly and create a new release :)

Comment on lines +98 to +99
| `extraDeploy` | Extra objects to deploy (value evaluated as a template) | `{}` |
| `extraAnnotations` | Add additional annotations to every resource (value evaluated as a template) | `{}` |
Copy link
Member

Choose a reason for hiding this comment

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

That would be great :)

@alexrashed alexrashed merged commit d01ed71 into localstack:main Nov 27, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Improvement to usability or performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants