svc.yaml 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. name: {{ template "common.names.fullname" . }}
  5. namespace: {{ template "zookeeper.namespace" . }}
  6. labels: {{- include "common.labels.standard" . | nindent 4 }}
  7. app.kubernetes.io/component: zookeeper
  8. {{- if .Values.commonLabels }}
  9. {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
  10. {{- end }}
  11. {{- if or .Values.commonAnnotations .Values.service.annotations }}
  12. annotations:
  13. {{- if .Values.service.annotations }}
  14. {{- include "common.tplvalues.render" ( dict "value" .Values.service.annotations "context" $ ) | nindent 4 }}
  15. {{- end }}
  16. {{- if .Values.commonAnnotations }}
  17. {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  18. {{- end }}
  19. {{- end }}
  20. spec:
  21. type: {{ .Values.service.type }}
  22. {{- if and .Values.service.clusterIP (eq .Values.service.type "ClusterIP") }}
  23. clusterIP: {{ .Values.service.clusterIP }}
  24. {{- end }}
  25. {{- if or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") }}
  26. externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }}
  27. {{- end }}
  28. {{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerSourceRanges)) }}
  29. loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }}
  30. {{- end }}
  31. {{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP)) }}
  32. loadBalancerIP: {{ .Values.service.loadBalancerIP }}
  33. {{- end }}
  34. {{- if .Values.service.sessionAffinity }}
  35. sessionAffinity: {{ .Values.service.sessionAffinity }}
  36. {{- end }}
  37. {{- if .Values.service.sessionAffinityConfig }}
  38. sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.service.sessionAffinityConfig "context" $) | nindent 4 }}
  39. {{- end }}
  40. ports:
  41. {{- if not .Values.service.disableBaseClientPort }}
  42. - name: tcp-client
  43. port: {{ .Values.service.ports.client }}
  44. targetPort: client
  45. {{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.client)) }}
  46. nodePort: {{ .Values.service.nodePorts.client }}
  47. {{- else if eq .Values.service.type "ClusterIP" }}
  48. nodePort: null
  49. {{- end }}
  50. {{- end }}
  51. {{- if .Values.tls.client.enabled }}
  52. - name: tcp-client-tls
  53. port: {{ .Values.service.ports.tls }}
  54. targetPort: client-tls
  55. {{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.tls)) }}
  56. nodePort: {{ .Values.service.nodePorts.tls }}
  57. {{- else if eq .Values.service.type "ClusterIP" }}
  58. nodePort: null
  59. {{- end }}
  60. {{- end }}
  61. - name: tcp-follower
  62. port: {{ .Values.service.ports.follower }}
  63. targetPort: follower
  64. - name: tcp-election
  65. port: {{ .Values.service.ports.election }}
  66. targetPort: election
  67. {{- if .Values.service.extraPorts }}
  68. {{- include "common.tplvalues.render" (dict "value" .Values.service.extraPorts "context" $) | nindent 4 }}
  69. {{- end }}
  70. selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
  71. app.kubernetes.io/component: zookeeper