service.yaml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. {{- /*
  2. Copyright VMware, Inc.
  3. SPDX-License-Identifier: APACHE-2.0
  4. */}}
  5. apiVersion: v1
  6. kind: Service
  7. metadata:
  8. name: {{ include "common.names.fullname" . }}
  9. namespace: {{ include "common.names.namespace" . | quote }}
  10. labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
  11. {{- if or .Values.service.annotations .Values.commonAnnotations }}
  12. {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.service.annotations .Values.commonAnnotations ) "context" . ) }}
  13. annotations: {{- include "common.tplvalues.render" (dict "value" $annotations "context" $) | nindent 4 }}
  14. {{- end }}
  15. spec:
  16. type: {{ .Values.service.type }}
  17. {{- if and (eq .Values.service.type "ClusterIP") .Values.service.clusterIP }}
  18. clusterIP: {{ .Values.service.clusterIP }}
  19. {{- end }}
  20. {{- if or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") }}
  21. externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }}
  22. {{- end }}
  23. {{- if and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerSourceRanges }}
  24. loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }}
  25. {{ end }}
  26. {{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP)) }}
  27. loadBalancerIP: {{ .Values.service.loadBalancerIP }}
  28. {{- end }}
  29. ports:
  30. - name: minio-api
  31. port: {{ .Values.service.ports.api }}
  32. targetPort: minio-api
  33. {{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.api)) }}
  34. nodePort: {{ .Values.service.nodePorts.api }}
  35. {{- else if eq .Values.service.type "ClusterIP" }}
  36. nodePort: null
  37. {{- end }}
  38. - name: minio-console
  39. port: {{ .Values.service.ports.console }}
  40. targetPort: minio-console
  41. {{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.console)) }}
  42. nodePort: {{ .Values.service.nodePorts.console }}
  43. {{- else if eq .Values.service.type "ClusterIP" }}
  44. nodePort: null
  45. {{- end }}
  46. {{- if .Values.service.extraPorts }}
  47. {{- include "common.tplvalues.render" (dict "value" .Values.service.extraPorts "context" $) | nindent 4 }}
  48. {{- end }}
  49. {{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.podLabels .Values.commonLabels ) "context" . ) }}
  50. selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}