service.yaml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. name: {{ template "docker-registry.fullname" . }}
  5. namespace: {{ .Values.namespace | default .Release.Namespace }}
  6. labels:
  7. app: {{ template "docker-registry.name" . }}
  8. chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
  9. release: {{ .Release.Name }}
  10. heritage: {{ .Release.Service }}
  11. {{- if .Values.service.annotations }}
  12. annotations:
  13. {{ toYaml .Values.service.annotations | indent 4 }}
  14. {{- end }}
  15. spec:
  16. type: {{ .Values.service.type }}
  17. {{- if (and (eq .Values.service.type "ClusterIP") (not (empty .Values.service.clusterIP))) }}
  18. clusterIP: {{ .Values.service.clusterIP }}
  19. {{- end }}
  20. {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }}
  21. loadBalancerIP: {{ .Values.service.loadBalancerIP }}
  22. {{- end }}
  23. {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerSourceRanges))) }}
  24. loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }}
  25. {{- end }}
  26. {{- if .Values.service.sessionAffinity }}
  27. sessionAffinity: {{ .Values.service.sessionAffinity }}
  28. {{- if .Values.service.sessionAffinityConfig }}
  29. sessionAffinityConfig:
  30. {{ toYaml .Values.service.sessionAffinityConfig | nindent 4 }}
  31. {{- end -}}
  32. {{- end }}
  33. ports:
  34. - port: {{ .Values.service.port }}
  35. protocol: TCP
  36. name: {{ if .Values.tlsSecretName }}https{{ else }}http{{ end }}-{{ .Values.service.port }}
  37. targetPort: 5000
  38. {{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }}
  39. nodePort: {{ .Values.service.nodePort }}
  40. {{- end }}
  41. {{- if .Values.metrics.enabled }}
  42. - port: {{ .Values.metrics.port }}
  43. protocol: TCP
  44. name: http-metrics
  45. targetPort: {{ (split ":" .Values.configData.http.debug.addr)._1 }}
  46. {{- end }}
  47. selector:
  48. app: {{ template "docker-registry.name" . }}
  49. release: {{ .Release.Name }}