feat(NetworkPolicy): configure from values.yaml

!4
This commit is contained in:
2023-09-29 19:09:50 +09:30
parent 03affbee80
commit 5c62055d2f
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,21 @@
{{ range .Values.nfc_monitoring.network_policy.policies }}
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
labels:
{{ toYaml (get $.Values.nfc_monitoring .name ).labels | nindent 4 }}
app.kubernetes.io/managed-by: {{ $.Release.Service }}
app.kubernetes.io/part-of: {{ $.Chart.Name }}
app.kubernetes.io/version: {{ $.Chart.Version }}
name: {{ .name | replace "_" "-" }}
namespace: {{ (get $.Values.nfc_monitoring .name ).namespace }}
spec:
{{ toYaml .policy | nindent 2 }}
podSelector:
matchLabels:
{{ toYaml (get $.Values.nfc_monitoring .name ).labels | nindent 6 }}
{{ end }}

View File

@ -357,6 +357,23 @@ nfc_monitoring:
label_value: "1"
network_policy:
enabled: true
# Network Policies to apply. These policies are automagically build using the values below.
#
# Do:
# - Define 'Ingress'
# - Define 'Egress'
# - Ensure that the name matches the item name from values.yaml. i.e. nfc_monitoring.{item_name}
# for prometheus the item name is 'prometheus'. This value is used to select items pertaining to
# that item from values.yaml. for example the labels and namespace.
# Dont:
# - Define 'podSelector' as this is alreaady included using the selector labels
policies:
loki_instance:
image:
name: grafana/loki