default-backend-service.yaml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. {{- if .Values.defaultBackend.enabled -}}
  2. apiVersion: v1
  3. kind: Service
  4. metadata:
  5. {{- if .Values.defaultBackend.service.annotations }}
  6. annotations: {{ toYaml .Values.defaultBackend.service.annotations | nindent 4 }}
  7. {{- end }}
  8. labels:
  9. {{- include "ingress-nginx.labels" . | nindent 4 }}
  10. app.kubernetes.io/component: default-backend
  11. {{- with .Values.defaultBackend.labels }}
  12. {{- toYaml . | nindent 4 }}
  13. {{- end }}
  14. name: {{ include "ingress-nginx.defaultBackend.fullname" . }}
  15. namespace: {{ .Release.Namespace }}
  16. spec:
  17. type: {{ .Values.defaultBackend.service.type }}
  18. {{- if .Values.defaultBackend.service.clusterIP }}
  19. clusterIP: {{ .Values.defaultBackend.service.clusterIP }}
  20. {{- end }}
  21. {{- if .Values.defaultBackend.service.externalIPs }}
  22. externalIPs: {{ toYaml .Values.defaultBackend.service.externalIPs | nindent 4 }}
  23. {{- end }}
  24. {{- if .Values.defaultBackend.service.loadBalancerIP }}
  25. loadBalancerIP: {{ .Values.defaultBackend.service.loadBalancerIP }}
  26. {{- end }}
  27. {{- if .Values.defaultBackend.service.loadBalancerSourceRanges }}
  28. loadBalancerSourceRanges: {{ toYaml .Values.defaultBackend.service.loadBalancerSourceRanges | nindent 4 }}
  29. {{- end }}
  30. ports:
  31. - name: http
  32. port: {{ .Values.defaultBackend.service.servicePort }}
  33. protocol: TCP
  34. targetPort: http
  35. {{- if semverCompare ">=1.20" .Capabilities.KubeVersion.Version }}
  36. appProtocol: http
  37. {{- end }}
  38. selector:
  39. {{- include "ingress-nginx.selectorLabels" . | nindent 4 }}
  40. app.kubernetes.io/component: default-backend
  41. {{- end }}