{{- if .Values.service.admin.enabled -}} --- apiVersion: v1 kind: Service metadata: name: {{ include "hydra.fullname" . }}-admin {{- if .Release.Namespace }} namespace: {{ .Release.Namespace }} {{- end }} labels: {{- include "hydra.labels" . | nindent 4 }} {{- with .Values.service.admin.labels }} {{- toYaml . | nindent 4 }} {{- end }} app.kubernetes.io/component: admin annotations: {{- with .Values.service.admin.annotations }} {{- toYaml . | nindent 4 }} {{- end }} spec: type: {{ .Values.service.admin.type }} {{- if eq .Values.service.admin.type "LoadBalancer" }} {{- with .Values.service.admin.loadBalancerIP }} loadBalancerIP: {{ . }} {{- end }} {{- end }} ports: - port: {{ .Values.service.admin.port }} targetPort: http-admin protocol: TCP name: {{ .Values.service.admin.name }} selector: app.kubernetes.io/name: {{ include "hydra.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- if .Values.serviceMonitor.enabled }} --- apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ include "hydra.fullname" . }}-admin {{- if .Release.Namespace }} namespace: {{ .Release.Namespace }} {{- end }} labels: app.kubernetes.io/component: admin {{- include "hydra.labels" . | nindent 4 }} {{- with .Values.serviceMonitor.labels }} {{- toYaml . | nindent 4 }} {{- end }} {{- with .Values.service.admin.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} spec: endpoints: - path: {{ .Values.service.admin.metricsPath }} port: {{ .Values.service.admin.name }} scheme: {{ .Values.serviceMonitor.scheme }} interval: {{ .Values.serviceMonitor.scrapeInterval }} scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} {{- with .Values.serviceMonitor.tlsConfig }} tlsConfig: {{- toYaml . | nindent 6 }} {{- end }} selector: matchLabels: app.kubernetes.io/name: {{ include "hydra.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: admin {{- end -}} {{- end }}