No Description

frontend-network-policy.yaml 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. {{- if .Values.frontend.networkPolicy.enabled }}
  2. kind: NetworkPolicy
  3. apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }}
  4. metadata:
  5. name: {{ template "shuffle.frontend.name" . }}
  6. namespace: {{ include "common.names.namespace" . | quote }}
  7. labels: {{- include "shuffle.frontend.labels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
  8. {{- if .Values.commonAnnotations }}
  9. annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  10. {{- end }}
  11. spec:
  12. {{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.frontend.podLabels .Values.commonLabels ) "context" . ) }}
  13. podSelector:
  14. matchLabels: {{- include "shuffle.frontend.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
  15. policyTypes:
  16. - Ingress
  17. - Egress
  18. egress:
  19. {{- if .Values.frontend.networkPolicy.allowExternalEgress }}
  20. - {}
  21. {{- else }}
  22. # Allow DNS resolution with an in-cluster DNS server
  23. - ports:
  24. - port: 53
  25. protocol: UDP
  26. - port: 53
  27. protocol: TCP
  28. to:
  29. - namespaceSelector:
  30. matchLabels:
  31. kubernetes.io/metadata.name: kube-system
  32. {{- if .Values.frontend.networkPolicy.extraEgress }}
  33. {{- include "common.tplvalues.render" ( dict "value" .Values.frontend.networkPolicy.extraEgress "context" $ ) | nindent 4 }}
  34. {{- end }}
  35. {{- end }}
  36. ingress:
  37. {{ if .Values.frontend.networkPolicy.allowExternal }}
  38. - ports:
  39. - port: {{ .Values.frontend.containerPorts.http }}
  40. {{- if .Values.frontend.containerPorts.https }}
  41. - port: {{ .Values.frontend.containerPorts.https }}
  42. {{- end }}
  43. {{- end }}
  44. {{- if .Values.frontend.networkPolicy.extraIngress }}
  45. {{- include "common.tplvalues.render" ( dict "value" .Values.frontend.networkPolicy.extraIngress "context" $ ) | nindent 4 }}
  46. {{- end }}
  47. {{- end }}