service.yaml 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. {{- /*
  2. Copyright Broadcom, Inc. All Rights Reserved.
  3. SPDX-License-Identifier: APACHE-2.0
  4. */}}
  5. {{- if .Values.rootCoord.enabled }}
  6. apiVersion: v1
  7. kind: Service
  8. metadata:
  9. name: {{ template "milvus.root-coordinator.fullname" . }}
  10. namespace: {{ include "common.names.namespace" . | quote }}
  11. labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
  12. app.kubernetes.io/part-of: milvus
  13. app.kubernetes.io/component: root-coordinator
  14. {{- if or .Values.commonAnnotations .Values.rootCoord.service.annotations (and .Values.rootCoord.metrics.enabled .Values.rootCoord.metrics.annotations) }}
  15. annotations:
  16. {{- if or .Values.rootCoord.service.annotations .Values.commonAnnotations }}
  17. {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.rootCoord.service.annotations .Values.commonAnnotations ) "context" . ) }}
  18. {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
  19. {{- end }}
  20. {{- if and .Values.rootCoord.metrics.enabled .Values.rootCoord.metrics.annotations }}
  21. {{- include "common.tplvalues.render" ( dict "value" .Values.rootCoord.metrics.annotations "context" $ ) | nindent 4 }}
  22. {{- end }}
  23. {{- end }}
  24. spec:
  25. type: {{ .Values.rootCoord.service.type }}
  26. {{- if .Values.rootCoord.service.sessionAffinity }}
  27. sessionAffinity: {{ .Values.rootCoord.service.sessionAffinity }}
  28. {{- end }}
  29. {{- if .Values.rootCoord.service.sessionAffinityConfig }}
  30. sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.rootCoord.service.sessionAffinityConfig "context" $) | nindent 4 }}
  31. {{- end }}
  32. {{- if .Values.rootCoord.service.clusterIP }}
  33. clusterIP: {{ .Values.rootCoord.service.clusterIP }}
  34. {{- end }}
  35. {{- if (or (eq .Values.rootCoord.service.type "LoadBalancer") (eq .Values.rootCoord.service.type "NodePort")) }}
  36. externalTrafficPolicy: {{ .Values.rootCoord.service.externalTrafficPolicy | quote }}
  37. {{- end }}
  38. {{ if eq .Values.rootCoord.service.type "LoadBalancer" }}
  39. loadBalancerSourceRanges: {{ .Values.rootCoord.service.loadBalancerSourceRanges }}
  40. {{ end }}
  41. {{- if (and (eq .Values.rootCoord.service.type "LoadBalancer") (not (empty .Values.rootCoord.service.loadBalancerIP))) }}
  42. loadBalancerIP: {{ .Values.rootCoord.service.loadBalancerIP }}
  43. {{- end }}
  44. ports:
  45. - name: grpc
  46. port: {{ .Values.rootCoord.service.ports.grpc }}
  47. targetPort: grpc
  48. protocol: TCP
  49. {{- if (and (or (eq .Values.rootCoord.service.type "NodePort") (eq .Values.rootCoord.service.type "LoadBalancer")) (not (empty .Values.rootCoord.service.nodePorts.grpc))) }}
  50. nodePort: {{ .Values.rootCoord.service.nodePorts.grpc }}
  51. {{- else if eq .Values.rootCoord.service.type "ClusterIP" }}
  52. nodePort: null
  53. {{- end }}
  54. {{- if .Values.rootCoord.metrics.enabled }}
  55. - name: http-metrics
  56. port: {{ .Values.rootCoord.service.ports.metrics }}
  57. targetPort: http-metrics
  58. protocol: TCP
  59. {{- if (and (or (eq .Values.rootCoord.service.type "NodePort") (eq .Values.rootCoord.service.type "LoadBalancer")) (not (empty .Values.rootCoord.service.nodePorts.metrics))) }}
  60. nodePort: {{ .Values.rootCoord.service.nodePorts.metrics }}
  61. {{- else if eq .Values.rootCoord.service.type "ClusterIP" }}
  62. nodePort: null
  63. {{- end }}
  64. {{- end }}
  65. {{- if .Values.rootCoord.service.extraPorts }}
  66. {{- include "common.tplvalues.render" (dict "value" .Values.rootCoord.service.extraPorts "context" $) | nindent 4 }}
  67. {{- end }}
  68. {{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.rootCoord.podLabels .Values.commonLabels ) "context" . ) }}
  69. selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
  70. app.kubernetes.io/part-of: milvus
  71. app.kubernetes.io/component: root-coordinator
  72. {{- end }}