service.yaml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. {{- if or (eq (include "opentelemetry-collector.serviceEnabled" .) "true") (.Values.ingress.enabled) -}}
  2. apiVersion: v1
  3. kind: Service
  4. metadata:
  5. name: {{ include "opentelemetry-collector.fullname" . }}
  6. namespace: {{ template "opentelemetry-collector.namespace" . }}
  7. labels:
  8. {{- include "opentelemetry-collector.labels" . | nindent 4 }}
  9. {{- include "opentelemetry-collector.component" . | nindent 4 }}
  10. {{- if .Values.service.annotations }}
  11. annotations:
  12. {{- range $key, $value := .Values.service.annotations }}
  13. {{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 4 }}
  14. {{- end }}
  15. {{- end }}
  16. spec:
  17. type: {{ .Values.service.type }}
  18. {{- if .Values.service.clusterIP }}
  19. clusterIP: {{ .Values.service.clusterIP }}
  20. {{- end }}
  21. {{- if and .Values.service.loadBalancerIP (eq .Values.service.type "LoadBalancer") }}
  22. loadBalancerIP: {{ .Values.service.loadBalancerIP }}
  23. {{- end }}
  24. {{- if and .Values.service.loadBalancerSourceRanges (eq .Values.service.type "LoadBalancer") }}
  25. loadBalancerSourceRanges:
  26. {{- range .Values.service.loadBalancerSourceRanges }}
  27. - {{ . }}
  28. {{- end }}
  29. {{- end }}
  30. {{- $ports := include "opentelemetry-collector.servicePortsConfig" . }}
  31. {{- if $ports }}
  32. ports:
  33. {{- $ports | nindent 4}}
  34. {{- end }}
  35. selector:
  36. {{- include "opentelemetry-collector.selectorLabels" . | nindent 4 }}
  37. {{- include "opentelemetry-collector.component" . | nindent 4 }}
  38. internalTrafficPolicy: {{ include "opentelemetry-collector.serviceInternalTrafficPolicy" . }}
  39. {{- if and (eq .Values.service.type "LoadBalancer") (.Values.service.externalTrafficPolicy) }}
  40. externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
  41. {{- end }}
  42. {{- end }}