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

feat(annotations): add global annotations #356

Merged

Conversation

GMartinez-Sisti
Copy link
Member

what

  • Allow adding global annotations to created resources
  • Linted some files to make reading easier

why

Requested feature.

tests

Templates were generated against the main branch and this branch and compared to ensure there were no extra changes

→ diff --color ci-init-config-values-main.yaml ci-init-config-values-new.yaml
113a114
>
127,129c128,130
<         checksum/config: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
<         checksum/repo-config: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
<         checksum/init-config: da4123f44ff227abfe55354cd7872ec561edf6bc58885cca89bea77d6f533a21
---
>         checksum/config: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
>         checksum/repo-config: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
>         checksum/init-config: e035a1806c7275d6e396d5c7d9b2b0bd51252a161e68ef3e652ee0fc5e6576d9
→ diff --color ci-values-main.yaml ci-values-new.yaml
77a78
>
91,92c92,93
<         checksum/config: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
<         checksum/repo-config: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
---
>         checksum/config: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
>         checksum/repo-config: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b

Then I tested specifying an annotation and a secret:

→ helm template atlantis ./charts/atlantis/ --set api.secret=aaa --set extraAnnotations.aaa=bbb | diff --color old.yaml 
-12a13,30
>   annotations:
>     aaa: bbb
> ---
> # Source: atlantis/templates/secret-api.yaml
> apiVersion: v1
> kind: Secret
> metadata:
>   name: atlantis-api
>   labels:
>     app: atlantis
>     chart: atlantis-4.21.1
>     helm.sh/chart: atlantis-4.21.1
>     release: atlantis
>     heritage: Helm
>   annotations:
>     aaa: bbb
> data:
>   apisecret: YWFh
24a43,44
>   annotations:
>     aaa: bbb
53a74,75
>   annotations:
>     aaa: bbb
75a98,100
>
>   annotations:
>     aaa: bbb
89,90c114,115
<         checksum/config: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
<         checksum/repo-config: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
---
>         checksum/config: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
>         checksum/repo-config: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
118a144,148
>           - name: ATLANTIS_API_SECRET
>             valueFrom:
>               secretKeyRef:
>                 name: atlantis-api
>                 key: apisecret
165a196,197
>   annotations:
>     aaa: bbb

references

Closes #140

@GMartinez-Sisti GMartinez-Sisti requested a review from a team as a code owner February 27, 2024 22:43
@GMartinez-Sisti
Copy link
Member Author

@roytev I love these unit tests 😍

FAIL  test statefulset	charts/atlantis/tests/statefulset_test.yaml
	- default values

		- asserts[12] `equal` fail
			Template:	atlantis/templates/statefulset.yaml
			DocumentIndex:	0
			Path:	spec.template.metadata.annotations
			Expected to equal:
				checksum/config: e3b0c44298fc1c149afbf4c8996fb92427ae41e[46](https://github.com/runatlantis/helm-charts/actions/runs/8072357303/job/22053924032?pr=356#step:8:47)49b934ca495991b7852b855
				checksum/repo-config: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
			Actual:
				checksum/config: 01ba[47](https://github.com/runatlantis/helm-charts/actions/runs/8072357303/job/22053924032?pr=356#step:8:48)19c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
				checksum/repo-config: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
			Diff:
				--- Expected
				+++ Actual
				@@ -1,3 +1,3 @@
				-checksum/config: e3b0c44298fc1c1[49](https://github.com/runatlantis/helm-charts/actions/runs/8072357303/job/22053924032?pr=356#step:8:50)afbf4c8996fb92427ae41e4649b934ca495991b7852b855
				-checksum/repo-config: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
				+checksum/config: 01ba4719c80b6fe911b091a7c0[51](https://github.com/runatlantis/helm-charts/actions/runs/8072357303/job/22053924032?pr=356#step:8:52)24b64eeece964e09c058ef8f9805daca[54](https://github.com/runatlantis/helm-charts/actions/runs/8072357303/job/22053924032?pr=356#step:8:55)6b
				+checksum/repo-config: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c0[58](https://github.com/runatlantis/helm-charts/actions/runs/8072357303/job/22053924032?pr=356#step:8:59)ef8f9805daca546b

Copy link
Contributor

@jamengual jamengual left a comment

Choose a reason for hiding this comment

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

LGTM

@GMartinez-Sisti GMartinez-Sisti merged commit ba2d710 into runatlantis:main Mar 6, 2024
2 checks passed
@GMartinez-Sisti GMartinez-Sisti deleted the global-annotations branch March 6, 2024 21:37
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.

Add Annotations to secrets
3 participants