github.com/verrazzano/verrazzano@v1.7.0/platform-operator/thirdparty/charts/prometheus-community/kube-state-metrics/templates/networkpolicy.yaml (about)

     1  {{- if and .Values.networkPolicy.enabled (eq .Values.networkPolicy.flavor "kubernetes") }}
     2  kind: NetworkPolicy
     3  apiVersion: networking.k8s.io/v1
     4  metadata:
     5    {{- if .Values.annotations }}
     6    annotations:
     7      {{ toYaml .Values.annotations | nindent 4 }}
     8    {{- end }}
     9    labels:
    10      {{- include "kube-state-metrics.labels" . | indent 4 }}
    11    name: {{ template "kube-state-metrics.fullname" . }}
    12    namespace: {{ template "kube-state-metrics.namespace" . }}
    13  spec:
    14    {{- if .Values.networkPolicy.egress }}
    15    ## Deny all egress by default
    16    egress:
    17      {{- toYaml .Values.networkPolicy.egress | nindent 4 }}
    18    {{- end }}
    19    ingress:
    20    {{- if .Values.networkPolicy.ingress }}
    21      {{- toYaml .Values.networkPolicy.ingress | nindent 4 }}
    22    {{- else }}
    23      ## Allow ingress on default ports by default
    24    - ports:
    25      - port: {{ .Values.service.port | default 8080 }}
    26        protocol: TCP
    27      {{- if .Values.selfMonitor.enabled }}
    28      {{- $telemetryPort := ternary 9091 (.Values.selfMonitor.telemetryPort | default 8081) .Values.kubeRBACProxy.enabled}}
    29      - port: {{ $telemetryPort }}
    30        protocol: TCP
    31      {{- end }}
    32    {{- end }}
    33    podSelector:
    34      {{- if .Values.networkPolicy.podSelector }}
    35      {{- toYaml .Values.networkPolicy.podSelector | nindent 4 }}
    36      {{- else }}
    37      matchLabels:
    38        {{- include "kube-state-metrics.selectorLabels" . | indent 6 }}
    39      {{- end }}
    40    policyTypes:
    41      - Ingress
    42      - Egress
    43  {{- end }}