service.yaml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. {{- if .Values.service.enabled -}}
  2. apiVersion: v1
  3. kind: Service
  4. metadata:
  5. name: {{ template "podinfo.fullname" . }}
  6. namespace: {{ include "podinfo.namespace" . }}
  7. labels:
  8. {{- include "podinfo.labels" . | nindent 4 }}
  9. {{- with .Values.service.additionalLabels }}
  10. {{- toYaml . | nindent 4 }}
  11. {{- end }}
  12. {{- with .Values.service.annotations }}
  13. annotations:
  14. {{ toYaml . | indent 4 }}
  15. {{- end }}
  16. spec:
  17. type: {{ .Values.service.type }}
  18. ports:
  19. - port: {{ .Values.service.externalPort }}
  20. targetPort: http
  21. protocol: TCP
  22. name: http
  23. {{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }}
  24. nodePort: {{ .Values.service.nodePort }}
  25. {{- end }}
  26. {{- if .Values.tls.enabled }}
  27. - port: {{ .Values.tls.port | default 9899 }}
  28. targetPort: https
  29. protocol: TCP
  30. name: https
  31. {{- end }}
  32. {{- if .Values.service.grpcPort }}
  33. - port: {{ .Values.service.grpcPort }}
  34. targetPort: grpc
  35. protocol: TCP
  36. name: grpc
  37. {{- end }}
  38. selector:
  39. {{- include "podinfo.selectorLabels" . | nindent 4 }}
  40. {{- if .Values.service.trafficDistribution }}
  41. trafficDistribution: {{ .Values.service.trafficDistribution }}
  42. {{- end }}
  43. {{- if ( and (.Values.service.externalTrafficPolicy) (eq .Values.service.type "LoadBalancer") ) }}
  44. externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
  45. {{- end }}
  46. {{- end }}