From 698ddf5c90435de80fc46f4758ff4cb124882825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98ystein=20Thuen?= <44778126+OysteinThuen@users.noreply.github.com> Date: Mon, 20 Jan 2025 12:52:29 +0100 Subject: [PATCH 1/2] Fix a bug in networkpolicy where the label for app was wrong --- elvia-deployment/templates/networkpolicy.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elvia-deployment/templates/networkpolicy.yaml b/elvia-deployment/templates/networkpolicy.yaml index 16af701..eb37b45 100644 --- a/elvia-deployment/templates/networkpolicy.yaml +++ b/elvia-deployment/templates/networkpolicy.yaml @@ -22,7 +22,7 @@ spec: {{- if $value.application }} podSelector: matchLabels: - app.kubernetes.io/name: {{ $value.application }} + app: {{ $value.application }} {{- end }} {{- end }} {{- end }} @@ -66,7 +66,7 @@ spec: {{- if $value.application }} podSelector: matchLabels: - app.kubernetes.io/name: {{ $value.application }} + app: {{ $value.application }} {{- end }} {{- end }} {{- end }} From 1d90172254e00279b9c2c68829b7d4e432811550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98ystein=20Thuen?= <44778126+OysteinThuen@users.noreply.github.com> Date: Mon, 20 Jan 2025 12:59:02 +0100 Subject: [PATCH 2/2] Update unit test --- .../tests/__snapshot__/networkpolicy_test.yaml.snap | 5 ++++- elvia-deployment/tests/networkpolicy_test.yaml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/elvia-deployment/tests/__snapshot__/networkpolicy_test.yaml.snap b/elvia-deployment/tests/__snapshot__/networkpolicy_test.yaml.snap index e1e0c8b..1a4466f 100644 --- a/elvia-deployment/tests/__snapshot__/networkpolicy_test.yaml.snap +++ b/elvia-deployment/tests/__snapshot__/networkpolicy_test.yaml.snap @@ -11,6 +11,9 @@ network policy snapshot should match: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: core + podSelector: + matchLabels: + app: demo-app - to: - ipBlock: cidr: 0.0.0.0/0 @@ -46,7 +49,7 @@ network policy snapshot should match: kubernetes.io/metadata.name: core podSelector: matchLabels: - app.kubernetes.io/name: demo-app + app: demo-app - namespaceSelector: matchLabels: kubernetes.io/metadata.name: dns diff --git a/elvia-deployment/tests/networkpolicy_test.yaml b/elvia-deployment/tests/networkpolicy_test.yaml index 8ae8c27..2fa3d10 100644 --- a/elvia-deployment/tests/networkpolicy_test.yaml +++ b/elvia-deployment/tests/networkpolicy_test.yaml @@ -25,6 +25,7 @@ tests: outbound: rules: - namespace: "core" + application: "demo-app" ingress: subdomain: core path: "/demo-api"