From 0a57ece2146abcfac9d36478183a7fa88a968c89 Mon Sep 17 00:00:00 2001 From: Jan Fuhrer Date: Thu, 2 Mar 2023 10:14:29 +0100 Subject: [PATCH] fix(common): networkPolicy template for linting (#72) Signed-off-by: Jan Fuhrer --- charts/common/.helmignore | 1 + charts/common/Chart.yaml | 4 ++-- charts/common/README.md | 2 +- charts/common/ci/values.test.yaml | 10 ++++++++++ charts/common/templates/_networkpolicy.yaml | 2 +- charts/common/values.schema.json | 5 ++++- 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/charts/common/.helmignore b/charts/common/.helmignore index 2270d728..5c4f379a 100644 --- a/charts/common/.helmignore +++ b/charts/common/.helmignore @@ -25,3 +25,4 @@ # gitlab files .gitlab-ci.yml README.md.gotmpl +ci diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml index 67152744..513a83a0 100644 --- a/charts/common/Chart.yaml +++ b/charts/common/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: common description: "Bedag's common Helm chart to use for creating other Helm charts" -version: 9.0.0 +version: 9.0.1 # A chart can be either an 'application' or a 'library' chart. # # Application charts are a collection of templates that can be packaged into versioned archives @@ -27,4 +27,4 @@ annotations: artifacthub.io/prerelease: "false" artifacthub.io/license: Apache-2.0 artifacthub.io/changes: | - - "[added]: Service Type LoadBalancer" + - "[Fixed]: Linting for NetworkPolicy" diff --git a/charts/common/README.md b/charts/common/README.md index 884a5628..5995fdaa 100644 --- a/charts/common/README.md +++ b/charts/common/README.md @@ -1,6 +1,6 @@ # common -![Version: 9.0.0](https://img.shields.io/badge/Version-9.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) +![Version: 9.0.1](https://img.shields.io/badge/Version-9.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) Bedag's common Helm chart to use for creating other Helm charts diff --git a/charts/common/ci/values.test.yaml b/charts/common/ci/values.test.yaml index 4496f637..5f264553 100644 --- a/charts/common/ci/values.test.yaml +++ b/charts/common/ci/values.test.yaml @@ -45,6 +45,9 @@ components: # start common.networkpolicy networkpolicy: deploy: true + podSelector: + - matchLabels: + app.kubernetes.io/component: component-2 # end common.networkpolicy controller: deploy: true @@ -124,6 +127,8 @@ components: # start common.networkpolicy networkpolicy: deploy: true + ipBlock: + cidr: 0.0.0.0/0 # end common.networkpolicy controller: deploy: true @@ -195,6 +200,11 @@ components: # start common.networkpolicy networkpolicy: deploy: true + ingressPorts: + - protocol: TCP + port: "8080" + - protocol: TCP + port: "8081" # end common.networkpolicy controller: deploy: true diff --git a/charts/common/templates/_networkpolicy.yaml b/charts/common/templates/_networkpolicy.yaml index 281e9367..f9e69e89 100644 --- a/charts/common/templates/_networkpolicy.yaml +++ b/charts/common/templates/_networkpolicy.yaml @@ -37,7 +37,7 @@ spec: - Ingress ingress: - from: - {{- if $networkpolicy.ipBlock.cidr }} + {{- if $networkpolicy.ipBlock }} - ipBlock: cidr: {{ $networkpolicy.ipBlock.cidr }} {{- end }} diff --git a/charts/common/values.schema.json b/charts/common/values.schema.json index 32271f12..0c8cd3d0 100644 --- a/charts/common/values.schema.json +++ b/charts/common/values.schema.json @@ -636,7 +636,10 @@ ], "properties": { "cidr": { - "type": "string" + "type": [ + "number", + "string" + ] } } },