Set Gimlet service taxonomy if git data is set

This commit is contained in:
Laszlo Fogas
2021-05-28 12:25:01 +02:00
parent bc933d1668
commit 0000ad9f4b
5 changed files with 47 additions and 3 deletions
+10
View File
@@ -5,6 +5,10 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "helm-chart.labels" . | nindent 4 }}
{{- if .Values.gitSha }}
annotations:
gimlet.io/git-sha: {{ .Values.gitSha }}
{{- end }}
spec:
replicas: {{ .Values.replicas }}
selector:
@@ -17,6 +21,12 @@ spec:
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.gitSha }}
gimlet.io/git-sha: {{ .Values.gitSha }}
{{- end }}
{{- if .Values.gitRepository }}
gimlet.io/git-repository: {{ .Values.gitRepository }}
{{- end }}
labels:
{{- include "helm-chart.selectorLabels" . | nindent 8 }}
spec:
+10 -2
View File
@@ -13,9 +13,17 @@ metadata:
namespace: {{ .root.Release.Namespace }}
labels:
{{- include "helm-chart.labels" .root | nindent 4 }}
{{- with .ingress.annotations }}
{{- if or (or .root.Values.gitSha .ingress.annotations) .root.Values.gitRepository }}
annotations:
{{- toYaml . | nindent 4 }}
{{- if .ingress.annotations }}
{{- toYaml .ingress.annotations | nindent 4 }}
{{- end }}
{{- if .root.Values.gitSha }}
gimlet.io/git-sha: {{ .root.Values.gitSha }}
{{- end }}
{{- if .root.Values.gitRepository }}
gimlet.io/git-sha: {{ .root.Values.gitRepository }}
{{- end }}
{{- end }}
spec:
{{- if default false .ingress.tlsEnabled }}
+9
View File
@@ -5,6 +5,15 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "helm-chart.labels" . | nindent 4 }}
{{- if or .Values.gitRepository .Values.gitSha }}
annotations:
{{- if .Values.gitRepository }}
gimlet.io/git-repository: {{ .Values.gitRepository }}
{{- end }}
{{- if .Values.gitSha }}
gimlet.io/git-sha: {{ .Values.gitSha }}
{{- end }}
{{- end }}
spec:
type: {{ if .Values.nodePortEnabled }}NodePort{{ else if .Values.loadbalancerEnabled }}LoadBalancer{{ else }}ClusterIP{{ end }}
{{- if .Values.stickySessions }}
@@ -0,0 +1,14 @@
suite: test service
templates:
- service.yaml
tests:
- it: Should set Gimlet taxonomy
set:
gitRepository: github.com/laszlocph/demo-app
gitSha: xyz
asserts:
- equal:
path: metadata.annotations
value:
gimlet.io/git-repository: github.com/laszlocph/demo-app
gimlet.io/git-sha: xyz
+4 -1
View File
@@ -8,4 +8,7 @@ ingresses:
kubernetes.io/ingress.class: nginx
- host: another.local
annotations:
kubernetes.io/ingress.class: nginx
kubernetes.io/ingress.class: nginx
gitRepository: github.com/laszlocph/demo-app
gitSha: xyz