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

Annotations and Labels #4

Merged
merged 4 commits into from Dec 14, 2023

Conversation

mathieu-benoit
Copy link
Contributor

@mathieu-benoit mathieu-benoit commented Dec 10, 2023

Ability to add labels and annotations to both Deployment and Service.

What does this change do?

This PR add a way to add labels and annotations on both the Deployment and the Service.

Here are some use cases:

In order to accomplish this as an example:

score-helm run \
	-f score.yaml \
	-o score-helm-values.yaml

helm install \
	test \
	--repo https://score-spec.github.io/score-helm-charts \
	workload \
	--values score-helm-values.yaml \
        --set "workload.annotations.radapp\.io/enabled=true" \
        --set "workload.containers.annotations.dapr\.io/enabled=true"

Have you read the Contributing Guidelines?

Signed-off-by: Mathieu Benoit <mathieu-benoit@hotmail.fr>
Signed-off-by: Mathieu Benoit <mathieu-benoit@hotmail.fr>
@mathieu-benoit mathieu-benoit changed the title Deployment annotations Annotations and Labels Dec 10, 2023
Signed-off-by: Mathieu Benoit <mathieu-benoit@hotmail.fr>
@@ -2,16 +2,22 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "workload.name" . }}
annotations:
{{- toYaml .Values.workload.annotations | nindent 4 }}
Copy link
Member

Choose a reason for hiding this comment

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

We really should add these to the values.yaml file as sample defaults.

workload:
  annotations: {}
  labels: {}
  containers:
    annotations: {}
    labels: {}
service:
  labels: {}

Why no annotations on the service?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

RE: values.yaml file as sample defaults - love the idea, but it's not the case today: https://github.com/score-spec/score-helm-charts/blob/main/charts/workload/values.yaml - useless for now, but let's add in another/dedicated PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why no annotations on the service?

No reasons, I missed it, just added, thanks for catching this.

Copy link
Member

Choose a reason for hiding this comment

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

Can you provide more context on this change? Why is it needed? what does it benefit?

Are you going to add to the conversion function in https://github.com/score-spec/score-helm/blob/main/internal/helm/convert.go#L42C8-L42C8 to enable this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you provide more context on this change? Why is it needed? what does it benefit?

I just updated the main description of this PR for the use cases. Let me know if you need more information.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you going to add to the conversion function in https://github.com/score-spec/score-helm/blob/main/internal/helm/convert.go#L42C8-L42C8 to enable this?

Nop, it's not related to that. These labels and annotations are not part of the Score spec anyway.

This PR is about this workflow:

score-helm run \
	-f score.yaml \
	-o score-helm-values.yaml

helm install \
	test \
	--repo https://score-spec.github.io/score-helm-charts \
	workload \
	--values score-helm-values.yaml \
        --set "workload.containers.annotations.dapr\.io/enabled=true"

So just about the second command (helm install), not the first one (score-helm run).

Let me know if you need more information around this.

Signed-off-by: Mathieu Benoit <mathieu-benoit@hotmail.fr>
Copy link
Member

@astromechza astromechza left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@sujaya-sys
Copy link
Contributor

Thanks for the review @astromechza!

@chrishumanitec does this look ok to you? If so we could go ahead merge & issue a new release. Thanks for checking 🙂

Copy link

@chrishumanitec chrishumanitec left a comment

Choose a reason for hiding this comment

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

LGTM

@sujaya-sys sujaya-sys merged commit b36aa73 into score-spec:main Dec 14, 2023
1 check passed
@mathieu-benoit mathieu-benoit deleted the deployment-annotations branch December 14, 2023 14:43
@sujaya-sys sujaya-sys mentioned this pull request Dec 15, 2023
@mathieu-benoit mathieu-benoit mentioned this pull request Dec 15, 2023
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.

None yet

4 participants