svc.yaml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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.loadBalancerIP) (eq .Values.service.type "LoadBalancer") }}
  23. loadBalancerIP: {{ .Values.service.loadBalancerIP }}
  24. {{- end }}
  25. ports:
  26. {{ if not .Values.service.disableBaseClientPort }}
  27. - name: tcp-client
  28. port: 2181
  29. targetPort: client
  30. {{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.client)) }}
  31. nodePort: {{ .Values.service.nodePorts.client }}
  32. {{- else if eq .Values.service.type "ClusterIP" }}
  33. nodePort: null
  34. {{- end }}
  35. {{ end }}
  36. {{ if .Values.tls.client.enabled }}
  37. - name: tcp-client-tls
  38. port: {{ .Values.service.tlsClientPort }}
  39. targetPort: client-tls
  40. {{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.clientTls)) }}
  41. nodePort: {{ .Values.service.nodePorts.clientTls }}
  42. {{- else if eq .Values.service.type "ClusterIP" }}
  43. nodePort: null
  44. {{- end }}
  45. {{ end }}
  46. - name: follower
  47. port: 2888
  48. targetPort: follower
  49. - name: tcp-election
  50. port: 3888
  51. targetPort: election
  52. selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
  53. app.kubernetes.io/component: zookeeper