From c8abac6087affe21dc64a975a7d6ae35afe63d70 Mon Sep 17 00:00:00 2001
From: Micah Nagel <micah.nagel@parsons.com>
Date: Thu, 16 Dec 2021 14:09:16 +0000
Subject: [PATCH] Add Istio Version to Twistlock

---
 chart/templates/_helpers.tpl          | 13 +++++++++++++
 chart/templates/twistlock/values.yaml |  5 +++++
 chart/values.yaml                     |  2 +-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl
index 454428a932..69873201a3 100644
--- a/chart/templates/_helpers.tpl
+++ b/chart/templates/_helpers.tpl
@@ -145,3 +145,16 @@ bigbang.addValueIfSet can be used to nil check parameters before adding them to
     {{- end }}
   {{- end }}
 {{- end -}}
+
+{{/*
+Annotation for Istio version
+*/}}
+{{- define "istioAnnotation" -}}
+{{- if .Values.istio.git.semver -}}
+bigbang.dev/istioVersion: {{ .Values.istio.git.semver | trimSuffix (regexFind "-bb.*" .Values.istio.git.semver) }}
+{{- else if .Values.istio.git.tag -}}
+bigbang.dev/istioVersion: {{ .Values.istio.git.tag | trimSuffix (regexFind "-bb.*" .Values.istio.git.tag) }}
+{{- else if .Values.istio.git.branch -}}
+bigbang.dev/istioVersion: {{ .Values.istio.git.branch }}
+{{- end -}}
+{{- end -}}
diff --git a/chart/templates/twistlock/values.yaml b/chart/templates/twistlock/values.yaml
index 74d7e543f9..d4c2310eb1 100644
--- a/chart/templates/twistlock/values.yaml
+++ b/chart/templates/twistlock/values.yaml
@@ -31,6 +31,11 @@ istio:
     gateways:
     - istio-system/{{ default "public" .Values.twistlock.ingress.gateway }}
 
+{{- if .Values.istio.enabled }}
+annotations:
+  {{ include "istioAnnotation" . }}
+{{- end }}
+
 console:
   image:
     imagePullPolicy: {{ .Values.imagePullPolicy }}
diff --git a/chart/values.yaml b/chart/values.yaml
index 4e2c529bbb..aa02c04904 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -532,7 +532,7 @@ twistlock:
   git:
     repo: https://repo1.dso.mil/platform-one/big-bang/apps/security-tools/twistlock.git
     path: "./chart"
-    tag: "0.0.12-bb.0"
+    tag: "0.1.0-bb.0"
 
   # -- Flux reconciliation overrides specifically for the Twistlock Package
   flux: {}
-- 
GitLab