{{- if .Values.networkPolicy.enabled }} kind: NetworkPolicy apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }} metadata: name: {{ include "common.names.fullname" . }} namespace: {{ .Release.Namespace | quote }} labels: {{- include "common.labels.standard" . | nindent 4 }} {{- if .Values.commonLabels }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} spec: podSelector: matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} ingress: # Allow inbound connections # CQL port - ports: - port: {{ .Values.service.ports.cql }} from: {{- if not .Values.networkPolicy.allowExternal }} - podSelector: matchLabels: {{ include "common.names.fullname" . }}-client: "true" {{- end }} - podSelector: matchLabels: {{- include "common.labels.matchLabels" . | nindent 14 }} # Internal ports - ports: - port: intra - port: tls - port: jmx from: - podSelector: matchLabels: {{- include "common.labels.matchLabels" . | nindent 14 }} {{- if .Values.metrics.enabled }} # Allow prometheus scrapes for metrics - ports: - port: {{ .Values.metrics.containerPorts.http | default "8080" }} {{- end }} {{- end }}