svc.yaml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. {{- $svcValues := .Values.broker.service }}
  2. {{- $thisFullName := include "kafka.broker.fullname" . }}
  3. {{- $componet := include "kafka.broker.componet" . }}
  4. apiVersion: v1
  5. kind: Service
  6. metadata:
  7. name: {{ $thisFullName }}
  8. labels:
  9. {{- include "kafka.labels" . | nindent 4 }}
  10. component: {{ $componet | quote }}
  11. {{- with $svcValues.labels }}
  12. {{- toYaml . | nindent 4 }}
  13. {{- end }}
  14. {{- with $svcValues.annotations }}
  15. annotations:
  16. {{- toYaml . | nindent 4 }}
  17. {{- end }}
  18. spec:
  19. type: {{ $svcValues.type | quote }}
  20. {{- if and $svcValues.clusterIP (eq $svcValues.type "ClusterIP") }}
  21. clusterIP: {{ .Values.service.clusterIP }}
  22. {{- end }}
  23. {{- if $svcValues.sessionAffinity }}
  24. sessionAffinity: {{ $svcValues.sessionAffinity | quote }}
  25. {{- end }}
  26. {{- if $svcValues.sessionAffinityConfig }}
  27. sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" $svcValues.sessionAffinityConfig "context" $) | nindent 4 }}
  28. {{- end }}
  29. ports:
  30. - name: broker
  31. port: {{ $svcValues.port | default .Values.containerPort.broker }}
  32. targetPort: broker
  33. protocol: TCP
  34. {{- if and $svcValues.nodePort (eq $svcValues.type "NodePort") }}
  35. nodePort: {{ $svcValues.nodePort }}
  36. {{- end }}
  37. selector:
  38. {{- include "kafka.selectorLabels" . | nindent 4 }}
  39. component: {{ $componet | quote }}