From 45a4e0480753123f45cf47d14aad5038505a9bdd Mon Sep 17 00:00:00 2001
From: "Christiel.podieu" <cpodieu@karthikconsulting.com>
Date: Mon, 24 Mar 2025 18:49:17 -0400
Subject: [PATCH] dynamic Network policy

---
 CHANGELOG.md                                                | 6 ++++++
 README.md                                                   | 2 +-
 chart/Chart.yaml                                            | 2 +-
 .../bigbang/networkpolicies/allow-istio-egress.yaml         | 6 +++++-
 .../bigbang/networkpolicies/allow-istio-ingress.yaml        | 6 +++++-
 5 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2365e64e..7b2490a6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,12 @@
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
 ---
+
+## [10.6.1-bb.1] (2025-03-24)
+### Changed
+
+- Added dynamic Network policy
+
 ## [10.6.1-bb.0] (2025-03-18)
 ### Changed
 
diff --git a/README.md b/README.md
index 1db246cd..fc83e648 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
 <!-- Warning: Do not manually edit this file. See notes on gluon + helm-docs at the end of this file for more information. -->
 # mattermost
 
-![Version: 10.6.1-bb.0](https://img.shields.io/badge/Version-10.6.1--bb.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 10.6.1](https://img.shields.io/badge/AppVersion-10.6.1-informational?style=flat-square) ![Maintenance Track: bb_integrated](https://img.shields.io/badge/Maintenance_Track-bb_integrated-green?style=flat-square)
+![Version: 10.6.1-bb.1](https://img.shields.io/badge/Version-10.6.1--bb.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 10.6.1](https://img.shields.io/badge/AppVersion-10.6.1-informational?style=flat-square) ![Maintenance Track: bb_integrated](https://img.shields.io/badge/Maintenance_Track-bb_integrated-green?style=flat-square)
 
 Deployment of mattermost
 
diff --git a/chart/Chart.yaml b/chart/Chart.yaml
index 0b74d431..10515282 100644
--- a/chart/Chart.yaml
+++ b/chart/Chart.yaml
@@ -2,7 +2,7 @@
 apiVersion: v2
 name: mattermost
 type: application
-version: 10.6.1-bb.0
+version: 10.6.1-bb.1
 appVersion: 10.6.1
 description: "Deployment of mattermost"
 keywords:
diff --git a/chart/templates/bigbang/networkpolicies/allow-istio-egress.yaml b/chart/templates/bigbang/networkpolicies/allow-istio-egress.yaml
index 9e428471..095c2cd3 100644
--- a/chart/templates/bigbang/networkpolicies/allow-istio-egress.yaml
+++ b/chart/templates/bigbang/networkpolicies/allow-istio-egress.yaml
@@ -12,7 +12,11 @@ spec:
     - to:
       - namespaceSelector:
           matchLabels:
-            app.kubernetes.io/name: istio-controlplane
+            {{- if .Values.networkPolicies.istioNamespaceSelector }}
+            app.kubernetes.io/name: {{ .Values.networkPolicies.istioNamespaceSelector.egress }}
+            {{- else }}
+            app.kubernetes.io/name: "istio-controlplane"
+            {{- end }}
         podSelector:
           matchLabels:
             istio: pilot
diff --git a/chart/templates/bigbang/networkpolicies/allow-istio-ingress.yaml b/chart/templates/bigbang/networkpolicies/allow-istio-ingress.yaml
index c7d19875..eeb358e8 100644
--- a/chart/templates/bigbang/networkpolicies/allow-istio-ingress.yaml
+++ b/chart/templates/bigbang/networkpolicies/allow-istio-ingress.yaml
@@ -14,7 +14,11 @@ spec:
     - from:
       - namespaceSelector:
           matchLabels:
-            app.kubernetes.io/name: istio-controlplane
+            {{- if .Values.networkPolicies.istioNamespaceSelector }}
+            app.kubernetes.io/name: {{ .Values.networkPolicies.istioNamespaceSelector.ingress }}
+            {{- else }}
+            app.kubernetes.io/name: "istio-controlplane"
+            {{- end }}
         podSelector:
           matchLabels:
             {{- toYaml .Values.networkPolicies.ingressLabels | nindent 12 }}
-- 
GitLab