Skip to content

Commit

Permalink
Merge pull request #133 from joshuagibeonm/add-service-annotations
Browse files Browse the repository at this point in the history
add service annotations
  • Loading branch information
laszlocph authored Jun 20, 2024
2 parents d66a459 + 6101584 commit ad3adca
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
7 changes: 6 additions & 1 deletion charts/onechart/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "helm-chart.labels" . | nindent 4 }}
{{- if or (or (or (or (or .Values.gitRepository .Values.gitSha) .Values.serviceName) .Values.serviceDescription) .Values.ownerName) .Values.ownerIm }}
{{- if or (or (or (or (or (or .Values.gitRepository .Values.gitSha) .Values.serviceName) .Values.serviceDescription) .Values.ownerName) .Values.ownerIm) .Values.serviceAnnotations }}
annotations:
{{- if .Values.gitRepository }}
gimlet.io/git-repository: {{ .Values.gitRepository }}
Expand Down Expand Up @@ -44,6 +44,11 @@ metadata:
{{- if .Values.traces }}
v1alpha1.opensca.dev/traces: {{ .Values.traces | quote }}
{{- end }}
{{- if .Values.serviceAnnotations }}
{{- with .Values.serviceAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
spec:
type: {{ if .Values.nodePortEnabled }}NodePort{{ else if .Values.loadbalancerEnabled }}LoadBalancer{{ else }}ClusterIP{{ end }}
Expand Down
13 changes: 13 additions & 0 deletions charts/onechart/tests/service_annotation_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
suite: test deployment
templates:
- service.yaml
tests:
- it: Should set annotations if it is defined
set:
serviceAnnotations:
gimlet.io/test: example
asserts:
- equal:
path: metadata.annotations
value:
gimlet.io/test: example

0 comments on commit ad3adca

Please sign in to comment.