diff --git a/templates/NetworkPolicy.yaml b/templates/NetworkPolicy.yaml new file mode 100644 index 0000000..10bd3d6 --- /dev/null +++ b/templates/NetworkPolicy.yaml @@ -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 }} diff --git a/values.yaml b/values.yaml index c968f92..7321423 100644 --- a/values.yaml +++ b/values.yaml @@ -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