{{- if .Values.networkPolicy.enabled }} apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: {{ .Release.Name }}-worlds spec: podSelector: matchLabels: { app.kubernetes.io/name: aeternalis, app.kubernetes.io/instance: {{ .Release.Name | quote }} } policyTypes: [Ingress, Egress] ingress: - from: - namespaceSelector: matchLabels: { kubernetes.io/metadata.name: {{ .Values.networkPolicy.ingressNamespace | quote }} } {{- range .Values.networkPolicy.ingressCIDRs }} - ipBlock: { cidr: {{ . | quote }} } {{- end }} ports: [{ protocol: TCP, port: 8080 }] egress: - to: - namespaceSelector: matchLabels: { kubernetes.io/metadata.name: {{ .Values.networkPolicy.dnsNamespace | quote }} } ports: [{ protocol: UDP, port: 53 }, { protocol: TCP, port: 53 }] {{- range .Values.networkPolicy.databaseCIDRs }} - to: [{ ipBlock: { cidr: {{ . | quote }} } }] ports: [{ protocol: TCP, port: 5432 }] {{- end }} {{- range .Values.networkPolicy.identityCIDRs }} - to: [{ ipBlock: { cidr: {{ . | quote }} } }] ports: [{ protocol: TCP, port: 443 }] {{- end }} {{- end }}