controller-service-internal.yaml 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {{- if and .Values.controller.service.enabled .Values.controller.service.internal.enabled .Values.controller.service.internal.annotations}}
  2. apiVersion: v1
  3. kind: Service
  4. metadata:
  5. annotations:
  6. {{- range $key, $value := .Values.controller.service.internal.annotations }}
  7. {{ $key }}: {{ $value | quote }}
  8. {{- end }}
  9. labels:
  10. {{- include "ingress-nginx.labels" . | nindent 4 }}
  11. app.kubernetes.io/component: controller
  12. {{- if .Values.controller.service.labels }}
  13. {{- toYaml .Values.controller.service.labels | nindent 4 }}
  14. {{- end }}
  15. name: {{ include "ingress-nginx.controller.fullname" . }}-internal
  16. namespace: {{ .Release.Namespace }}
  17. spec:
  18. type: "{{ .Values.controller.service.type }}"
  19. {{- if .Values.controller.service.internal.loadBalancerIP }}
  20. loadBalancerIP: {{ .Values.controller.service.internal.loadBalancerIP }}
  21. {{- end }}
  22. {{- if .Values.controller.service.internal.loadBalancerSourceRanges }}
  23. loadBalancerSourceRanges: {{ toYaml .Values.controller.service.internal.loadBalancerSourceRanges | nindent 4 }}
  24. {{- end }}
  25. {{- if .Values.controller.service.internal.externalTrafficPolicy }}
  26. externalTrafficPolicy: {{ .Values.controller.service.internal.externalTrafficPolicy }}
  27. {{- end }}
  28. ports:
  29. {{- $setNodePorts := (or (eq .Values.controller.service.type "NodePort") (eq .Values.controller.service.type "LoadBalancer")) }}
  30. {{- if .Values.controller.service.enableHttp }}
  31. - name: http
  32. port: {{ .Values.controller.service.ports.http }}
  33. protocol: TCP
  34. targetPort: {{ .Values.controller.service.targetPorts.http }}
  35. {{- if semverCompare ">=1.20" .Capabilities.KubeVersion.Version }}
  36. appProtocol: http
  37. {{- end }}
  38. {{- if (and $setNodePorts (not (empty .Values.controller.service.nodePorts.http))) }}
  39. nodePort: {{ .Values.controller.service.nodePorts.http }}
  40. {{- end }}
  41. {{- end }}
  42. {{- if .Values.controller.service.enableHttps }}
  43. - name: https
  44. port: {{ .Values.controller.service.ports.https }}
  45. protocol: TCP
  46. targetPort: {{ .Values.controller.service.targetPorts.https }}
  47. {{- if semverCompare ">=1.20" .Capabilities.KubeVersion.Version }}
  48. appProtocol: https
  49. {{- end }}
  50. {{- if (and $setNodePorts (not (empty .Values.controller.service.nodePorts.https))) }}
  51. nodePort: {{ .Values.controller.service.nodePorts.https }}
  52. {{- end }}
  53. {{- end }}
  54. {{- range $key, $value := .Values.tcp }}
  55. - name: {{ if $.Values.portNamePrefix }}{{ $.Values.portNamePrefix }}-{{ end }}{{ $key }}-tcp
  56. port: {{ $key }}
  57. protocol: TCP
  58. targetPort: {{ if $.Values.portNamePrefix }}{{ $.Values.portNamePrefix }}-{{ end }}{{ $key }}-tcp
  59. {{- if $.Values.controller.service.nodePorts.tcp }}
  60. {{- if index $.Values.controller.service.nodePorts.tcp $key }}
  61. nodePort: {{ index $.Values.controller.service.nodePorts.tcp $key }}
  62. {{- end }}
  63. {{- end }}
  64. {{- end }}
  65. {{- range $key, $value := .Values.udp }}
  66. - name: {{ if $.Values.portNamePrefix }}{{ $.Values.portNamePrefix }}-{{ end }}{{ $key }}-udp
  67. port: {{ $key }}
  68. protocol: UDP
  69. targetPort: {{ if $.Values.portNamePrefix }}{{ $.Values.portNamePrefix }}-{{ end }}{{ $key }}-udp
  70. {{- if $.Values.controller.service.nodePorts.udp }}
  71. {{- if index $.Values.controller.service.nodePorts.udp $key }}
  72. nodePort: {{ index $.Values.controller.service.nodePorts.udp $key }}
  73. {{- end }}
  74. {{- end }}
  75. {{- end }}
  76. selector:
  77. {{- include "ingress-nginx.selectorLabels" . | nindent 4 }}
  78. app.kubernetes.io/component: controller
  79. {{- end }}