Skip to content

Commit 28664ce

Browse files
authored
Don't include annotations: key when there are no annotations (#163)
1 parent 2bd118b commit 28664ce

File tree

11 files changed

+22
-19
lines changed

11 files changed

+22
-19
lines changed

charts/sourcegraph-migrator/templates/migrator/sourcegraph-migrator.Job.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ spec:
1616
template:
1717
metadata:
1818
annotations:
19+
kubectl.kubernetes.io/default-container: migrator
1920
{{- if .Values.sourcegraph.podAnnotations }}
2021
{{- toYaml .Values.sourcegraph.podAnnotations | nindent 8 }}
2122
{{- end }}
2223
{{- if .Values.migrator.podAnnotations }}
2324
{{- toYaml .Values.migrator.podAnnotations | nindent 8 }}
2425
{{- end }}
25-
kubectl.kubernetes.io/default-container: migrator
2626
labels:
2727
{{- include "sourcegraph.selectorLabels" . | nindent 8 }}
2828
{{- if .Values.sourcegraph.podLabels }}

charts/sourcegraph/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Use `**BREAKING**:` to denote a breaking change
88

99
## Unreleased
1010

11+
- (lint) Don't emit `annotations` key on k8s objects if the value is empty [#163](https://github.com/sourcegraph/deploy-sourcegraph-helm/pull/163)
1112

1213
## 3.43.0
1314

charts/sourcegraph/templates/frontend/sourcegraph-frontend-internal.Service.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
apiVersion: v1
22
kind: Service
33
metadata:
4+
{{- if .Values.frontend.serviceAnnotations }}
45
annotations:
5-
{{- if .Values.frontend.serviceAnnotations }}
66
{{- toYaml .Values.frontend.serviceAnnotations | nindent 4 }}
7-
{{- end }}
7+
{{- end }}
88
labels:
99
app: sourcegraph-frontend
1010
deploy: sourcegraph

charts/sourcegraph/templates/frontend/sourcegraph-frontend.Ingress.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
apiVersion: networking.k8s.io/v1
33
kind: Ingress
44
metadata:
5+
{{- if .Values.frontend.ingress.annotations}}
56
annotations:
6-
{{- if .Values.frontend.ingress.annotations}}
77
{{- toYaml .Values.frontend.ingress.annotations | nindent 4 }}
8-
{{- end }}
8+
{{- end }}
99
labels:
1010
app: sourcegraph-frontend
1111
deploy: sourcegraph

charts/sourcegraph/templates/grafana/grafana.Service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
apiVersion: v1
33
kind: Service
44
metadata:
5-
annotations:
65
{{- if .Values.grafana.serviceAnnotations }}
6+
annotations:
77
{{- toYaml .Values.grafana.serviceAnnotations | nindent 4 }}
88
{{- end }}
99
labels:

charts/sourcegraph/templates/indexed-search/indexed-search.StatefulSet.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ spec:
2121
serviceName: indexed-search
2222
template:
2323
metadata:
24+
{{- if or .Values.sourcegraph.podAnnotations .Values.indexedSearch.podAnnotations }}
2425
annotations:
25-
{{- if .Values.sourcegraph.podAnnotations }}
26-
{{- toYaml .Values.sourcegraph.podAnnotations | nindent 8 }}
27-
{{- end }}
28-
{{- if .Values.indexedSearch.podAnnotations }}
29-
{{- toYaml .Values.indexedSearch.podAnnotations | nindent 8 }}
26+
{{- if .Values.sourcegraph.podAnnotations }}
27+
{{- toYaml .Values.sourcegraph.podAnnotations | nindent 8 }}
28+
{{- end }}
29+
{{- if .Values.indexedSearch.podAnnotations }}
30+
{{- toYaml .Values.indexedSearch.podAnnotations | nindent 8 }}
31+
{{- end }}
3032
{{- end }}
3133
labels:
3234
{{- include "sourcegraph.selectorLabels" . | nindent 8 }}

charts/sourcegraph/templates/jaeger/jaeger-collector.Service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
apiVersion: v1
33
kind: Service
44
metadata:
5-
annotations:
65
{{- if .Values.tracing.collector.serviceAnnotations }}
6+
annotations:
77
{{- toYaml .Values.tracing.collector.serviceAnnotations | nindent 4 }}
88
{{- end }}
99
labels:

charts/sourcegraph/templates/jaeger/jaeger-query.Service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
apiVersion: v1
33
kind: Service
44
metadata:
5-
annotations:
65
{{- if .Values.tracing.query.serviceAnnotations }}
6+
annotations:
77
{{- toYaml .Values.tracing.query.serviceAnnotations | nindent 4 }}
88
{{- end }}
99
labels:

charts/sourcegraph/templates/prometheus/prometheus.Service.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
apiVersion: v1
33
kind: Service
44
metadata:
5+
{{- if .Values.prometheus.serviceAnnotations }}
56
annotations:
6-
{{- if .Values.prometheus.serviceAnnotations }}
77
{{- toYaml .Values.prometheus.serviceAnnotations | nindent 4 }}
8-
{{- end }}
8+
{{- end }}
99
labels:
1010
app: prometheus
1111
deploy: sourcegraph

charts/sourcegraph/templates/storageclass.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ metadata:
66
labels:
77
{{- include "sourcegraph.labels" . | nindent 4 }}
88
deploy: sourcegraph-storage
9+
{{- if .Values.storageClass.annotations}}
910
annotations:
10-
{{- if .Values.storageClass.annotations}}
1111
{{- toYaml .Values.storageClass.annotations | nindent 4 }}
12-
{{- end }}
12+
{{- end }}
1313
provisioner: {{ .Values.storageClass.provisioner }}
1414
parameters:
1515
{{- with .Values.storageClass.type }}

0 commit comments

Comments
 (0)