controller-service-metrics.yaml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. {{- if .Values.controller.metrics.enabled -}}
  2. apiVersion: v1
  3. kind: Service
  4. metadata:
  5. {{- if .Values.controller.metrics.service.annotations }}
  6. annotations: {{ toYaml .Values.controller.metrics.service.annotations | nindent 4 }}
  7. {{- end }}
  8. labels:
  9. {{- include "ingress-nginx.labels" . | nindent 4 }}
  10. app.kubernetes.io/component: controller
  11. {{- if .Values.controller.metrics.service.labels }}
  12. {{- toYaml .Values.controller.metrics.service.labels | nindent 4 }}
  13. {{- end }}
  14. name: {{ include "ingress-nginx.controller.fullname" . }}-metrics
  15. namespace: {{ .Release.Namespace }}
  16. spec:
  17. type: {{ .Values.controller.metrics.service.type }}
  18. {{- if .Values.controller.metrics.service.clusterIP }}
  19. clusterIP: {{ .Values.controller.metrics.service.clusterIP }}
  20. {{- end }}
  21. {{- if .Values.controller.metrics.service.externalIPs }}
  22. externalIPs: {{ toYaml .Values.controller.metrics.service.externalIPs | nindent 4 }}
  23. {{- end }}
  24. {{- if .Values.controller.metrics.service.loadBalancerIP }}
  25. loadBalancerIP: {{ .Values.controller.metrics.service.loadBalancerIP }}
  26. {{- end }}
  27. {{- if .Values.controller.metrics.service.loadBalancerSourceRanges }}
  28. loadBalancerSourceRanges: {{ toYaml .Values.controller.metrics.service.loadBalancerSourceRanges | nindent 4 }}
  29. {{- end }}
  30. {{- if .Values.controller.metrics.service.externalTrafficPolicy }}
  31. externalTrafficPolicy: {{ .Values.controller.metrics.service.externalTrafficPolicy }}
  32. {{- end }}
  33. ports:
  34. - name: {{ .Values.controller.metrics.portName }}
  35. port: {{ .Values.controller.metrics.service.servicePort }}
  36. protocol: TCP
  37. targetPort: {{ .Values.controller.metrics.portName }}
  38. {{- $setNodePorts := (or (eq .Values.controller.metrics.service.type "NodePort") (eq .Values.controller.metrics.service.type "LoadBalancer")) }}
  39. {{- if (and $setNodePorts (not (empty .Values.controller.metrics.service.nodePort))) }}
  40. nodePort: {{ .Values.controller.metrics.service.nodePort }}
  41. {{- end }}
  42. selector:
  43. {{- include "ingress-nginx.selectorLabels" . | nindent 4 }}
  44. app.kubernetes.io/component: controller
  45. {{- end }}