Skip to content

Commit

Permalink
feat(annotations): add secret annotations
Browse files Browse the repository at this point in the history
Allow adding annotations to secret resources.

Signed-off-by: Alexander Chebotov <[email protected]>
  • Loading branch information
Alexander Chebotov committed Feb 20, 2025
1 parent e08a424 commit f9774ac
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 8 deletions.
7 changes: 6 additions & 1 deletion charts/atlantis/templates/secret-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "atlantis.labels" . | nindent 4 }}
{{- with .Values.extraAnnotations }}
{{- if or .Values.secretAnnotations .Values.extraAnnotations }}
annotations:
{{- with .Values.secretAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.extraAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
data:
apisecret: {{ .Values.api.secret | b64enc }}
Expand Down
7 changes: 6 additions & 1 deletion charts/atlantis/templates/secret-aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "atlantis.labels" . | nindent 4 }}
{{- with .Values.extraAnnotations }}
{{- if or .Values.secretAnnotations .Values.extraAnnotations }}
annotations:
{{- with .Values.secretAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.extraAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
data:
{{- if .Values.aws.credentials }}
Expand Down
7 changes: 6 additions & 1 deletion charts/atlantis/templates/secret-basic-auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "atlantis.labels" . | nindent 4 }}
{{- with .Values.extraAnnotations }}
{{- if or .Values.secretAnnotations .Values.extraAnnotations }}
annotations:
{{- with .Values.secretAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.extraAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
data:
username: {{ .Values.basicAuth.username | b64enc }}
Expand Down
7 changes: 6 additions & 1 deletion charts/atlantis/templates/secret-gitconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "atlantis.labels" . | nindent 4 }}
{{- with .Values.extraAnnotations }}
{{- if or .Values.secretAnnotations .Values.extraAnnotations }}
annotations:
{{- with .Values.secretAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.extraAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
data:
gitconfig: {{ .Values.gitconfig | b64enc }}
Expand Down
7 changes: 6 additions & 1 deletion charts/atlantis/templates/secret-netrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "atlantis.labels" . | nindent 4 }}
{{- with .Values.extraAnnotations }}
{{- if or .Values.secretAnnotations .Values.extraAnnotations }}
annotations:
{{- with .Values.secretAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.extraAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
data:
netrc: {{ .Values.netrc | b64enc }}
Expand Down
7 changes: 6 additions & 1 deletion charts/atlantis/templates/secret-redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "atlantis.labels" . | nindent 4 }}
{{- with .Values.extraAnnotations }}
{{- if or .Values.secretAnnotations .Values.extraAnnotations }}
annotations:
{{- with .Values.secretAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.extraAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
data:
password: {{ .Values.redis.password | b64enc }}
Expand Down
7 changes: 6 additions & 1 deletion charts/atlantis/templates/secret-service-account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ metadata:
labels:
component: service-account-secret
{{- include "atlantis.labels" $ | nindent 4 }}
{{- with $.Values.extraAnnotations }}
{{- if or .Values.secretAnnotations .Values.extraAnnotations }}
annotations:
{{- with .Values.secretAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.extraAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
data:
service-account.json: {{ $secret }}
Expand Down
7 changes: 6 additions & 1 deletion charts/atlantis/templates/secret-webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "atlantis.labels" . | nindent 4 }}
{{- with .Values.extraAnnotations }}
{{- if or .Values.secretAnnotations .Values.extraAnnotations }}
annotations:
{{- with .Values.secretAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.extraAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
data:
{{- if .Values.githubApp }}
Expand Down
10 changes: 10 additions & 0 deletions charts/atlantis/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,16 @@
"description": "SecurityContext configuration for atlantis containers.",
"$ref": "#/definitions/io.k8s.api.core.v1.SecurityContext"
},
"secretAnnotations": {
"type": "object",
"description": "Add additional secret annotations",
"items": {
"type": "object"
},
"examples": {
"team": "example"
}
},
"servicemonitor": {
"type": "object",
"description": "ServiceMonitor configuration for atlantis containers.",
Expand Down
6 changes: 6 additions & 0 deletions charts/atlantis/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,12 @@ dnsConfig: {}

hostNetwork: false

# - These annotations will be added to secrets.
# Check values.yaml for examples.
secretAnnotations: {}
# secretAnnotations:
# team: example

# - These annotations will be added to all the resources.
# Check values.yaml for examples.
extraAnnotations: {}
Expand Down

0 comments on commit f9774ac

Please sign in to comment.