networkpolicy-backend-ingress.yaml 1.2 KB

12345678910111213141516171819202122232425262728
  1. {{- if and .Values.networkPolicy.enabled .Values.networkPolicy.ingressRules.backendOnlyAccessibleByFrontend }}
  2. apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }}
  3. kind: NetworkPolicy
  4. metadata:
  5. name: {{ printf "%s-backend" (include "common.names.fullname" .) }}
  6. namespace: {{ .Release.Namespace | quote }}
  7. labels: {{- include "common.labels.standard" . | nindent 4 }}
  8. {{- if .Values.commonLabels }}
  9. {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
  10. {{- end }}
  11. {{- if .Values.commonAnnotations }}
  12. annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  13. {{- end }}
  14. spec:
  15. podSelector:
  16. matchLabels:
  17. {{- if .Values.networkPolicy.ingressRules.customBackendSelector }}
  18. {{- include "common.tplvalues.render" (dict "value" .Values.networkPolicy.ingressRules.customBackendSelector "context" $) | nindent 6 }}
  19. {{- else }}
  20. app.kubernetes.io/name: mariadb
  21. app.kubernetes.io/instance: {{ .Release.Name }}
  22. {{- end }}
  23. ingress:
  24. - from:
  25. - podSelector:
  26. matchLabels:
  27. {{- include "common.labels.matchLabels" . | nindent 14 }}
  28. {{- end }}