Remove metrics service monitor
This commit is contained in:
parent
f60c605f5c
commit
e1bdf35bac
|
@ -198,11 +198,6 @@ The following table lists the configurable parameters of the MinIO chart and the
|
|||
| `updatePrometheusJob.securityContext.runAsGroup` | Group id of the user for the container | `1000` |
|
||||
| `updatePrometheusJob.securityContext.fsGroup` | Group id of the persistent volume mount for the container | `1000` |
|
||||
| `environment` | Set MinIO server relevant environment variables in `values.yaml` file. MinIO containers will be passed these variables when they start. | `MINIO_STORAGE_CLASS_STANDARD: EC:4"` |
|
||||
| `metrics.serviceMonitor.enabled` | Set this to `true` to create ServiceMonitor for Prometheus operator | `false` |
|
||||
| `metrics.serviceMonitor.additionalLabels` | Additional labels that can be used so ServiceMonitor will be discovered by Prometheus | `{}` |
|
||||
| `metrics.serviceMonitor.namespace` | Optional namespace in which to create ServiceMonitor | `nil` |
|
||||
| `metrics.serviceMonitor.interval` | Scrape interval. If not set, the Prometheus default scrape interval is used | `nil` |
|
||||
| `metrics.serviceMonitor.scrapeTimeout` | Scrape timeout. If not set, the Prometheus default scrape timeout is used | `nil` |
|
||||
| `etcd.endpoints` | Enpoints of etcd | `[]` |
|
||||
| `etcd.pathPrefix` | Prefix for all etcd keys | `""` |
|
||||
| `etcd.corednsPathPrefix` | Prefix for all CoreDNS etcd keys | `""` |
|
||||
|
|
|
@ -1,135 +0,0 @@
|
|||
{{- if .Values.metrics.serviceMonitor.enabled }}
|
||||
{{- $fullName := include "minio.fullname" . -}}
|
||||
{{ $scheme := "http" }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
{{ $scheme = "https" }}
|
||||
{{ end }}
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ $fullName }}-update-prometheus-secret
|
||||
labels:
|
||||
app: {{ template "minio.name" . }}-update-prometheus-secret
|
||||
chart: {{ template "minio.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
annotations:
|
||||
"helm.sh/hook": post-install,post-upgrade
|
||||
"helm.sh/hook-weight": "-5"
|
||||
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
|
||||
{{ toYaml .Values.updatePrometheusJob.annotations | indent 4 }}
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "minio.name" . }}-update-prometheus-secret
|
||||
release: {{ .Release.Name }}
|
||||
{{- if .Values.podLabels }}
|
||||
{{ toYaml .Values.podLabels | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.updatePrometheusJob.podAnnotations }}
|
||||
annotations:
|
||||
{{ toYaml .Values.updatePrometheusJob.podAnnotations | indent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
serviceAccountName: {{ $fullName }}-update-prometheus-secret
|
||||
{{- end }}
|
||||
restartPolicy: OnFailure
|
||||
{{- include "minio.imagePullSecrets" . | indent 6 }}
|
||||
{{- if .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml .Values.nodeSelector | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.updatePrometheusJob.securityContext.enabled }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.updatePrometheusJob.securityContext.runAsUser }}
|
||||
runAsGroup: {{ .Values.updatePrometheusJob.securityContext.runAsGroup }}
|
||||
fsGroup: {{ .Values.updatePrometheusJob.securityContext.fsGroup }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: workdir
|
||||
emptyDir: {}
|
||||
initContainers:
|
||||
- name: minio-mc
|
||||
image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}"
|
||||
imagePullPolicy: {{ .Values.mcImage.pullPolicy }}
|
||||
command:
|
||||
- /bin/sh
|
||||
- "-c"
|
||||
- mc --config-dir {{ .Values.configPathmc }} admin prometheus generate target --json --no-color -q > /workdir/mc.json
|
||||
env:
|
||||
- name: MINIO_ACCESS_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "minio.secretName" . }}
|
||||
key: accesskey
|
||||
- name: MINIO_SECRET_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "minio.secretName" . }}
|
||||
key: secretkey
|
||||
# mc admin prometheus generate don't really connect to remote server, TLS cert isn't required
|
||||
- name: MC_HOST_target
|
||||
value: {{ $scheme }}://$(MINIO_ACCESS_KEY):$(MINIO_SECRET_KEY)@{{ $fullName }}:{{ .Values.service.port }}
|
||||
volumeMounts:
|
||||
- name: workdir
|
||||
mountPath: /workdir
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
||||
# extract bearerToken from mc admin output
|
||||
- name: jq
|
||||
image: "{{ .Values.helmKubectlJqImage.repository }}:{{ .Values.helmKubectlJqImage.tag }}"
|
||||
imagePullPolicy: {{ .Values.helmKubectlJqImage.pullPolicy }}
|
||||
command:
|
||||
- /bin/sh
|
||||
- "-c"
|
||||
- jq -e -c -j -r .bearerToken < /workdir/mc.json > /workdir/token
|
||||
volumeMounts:
|
||||
- name: workdir
|
||||
mountPath: /workdir
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
||||
- name: kubectl-create
|
||||
image: "{{ .Values.helmKubectlJqImage.repository }}:{{ .Values.helmKubectlJqImage.tag }}"
|
||||
imagePullPolicy: {{ .Values.helmKubectlJqImage.pullPolicy }}
|
||||
command:
|
||||
- /bin/sh
|
||||
- "-c"
|
||||
# The following script does:
|
||||
# - get the servicemonitor that need this secret and copy some metadata and create the ownerreference for the secret file
|
||||
# - create the secret
|
||||
# - merge both json
|
||||
- >
|
||||
kubectl -n {{ .Release.Namespace }} get servicemonitor {{ $fullName }} -o json |
|
||||
jq -c '{metadata: {name: "{{ $fullName }}-prometheus", namespace: .metadata.namespace, labels: {app: .metadata.labels.app, release: .metadata.labels.release}, ownerReferences: [{apiVersion: .apiVersion, kind: .kind, blockOwnerDeletion: true, controller: true, uid: .metadata.uid, name: .metadata.name}]}}' > /workdir/metadata.json &&
|
||||
kubectl create secret generic {{ $fullName }}-prometheus --from-file=token=/workdir/token --dry-run -o json > /workdir/secret.json &&
|
||||
cat /workdir/secret.json /workdir/metadata.json | jq -s add > /workdir/object.json
|
||||
volumeMounts:
|
||||
- name: workdir
|
||||
mountPath: /workdir
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
||||
containers:
|
||||
- name: kubectl-apply
|
||||
image: "{{ .Values.helmKubectlJqImage.repository }}:{{ .Values.helmKubectlJqImage.tag }}"
|
||||
imagePullPolicy: {{ .Values.helmKubectlJqImage.pullPolicy }}
|
||||
command:
|
||||
- kubectl
|
||||
- apply
|
||||
- "-f"
|
||||
- /workdir/object.json
|
||||
volumeMounts:
|
||||
- name: workdir
|
||||
mountPath: /workdir
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
||||
{{- end }}
|
|
@ -1,41 +0,0 @@
|
|||
{{- if .Values.metrics.serviceMonitor.enabled }}
|
||||
{{ $scheme := "http" }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
{{ $scheme = "https" }}
|
||||
{{ end }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ template "minio.fullname" . }}
|
||||
{{- if .Values.metrics.serviceMonitor.namespace }}
|
||||
namespace: {{ .Values.metrics.serviceMonitor.namespace }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app: {{ template "minio.name" . }}
|
||||
chart: {{ template "minio.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
{{- if .Values.metrics.serviceMonitor.additionalLabels }}
|
||||
{{ toYaml .Values.metrics.serviceMonitor.additionalLabels | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
endpoints:
|
||||
- port: {{ $scheme }}
|
||||
path: /minio/prometheus/metrics
|
||||
{{- if .Values.metrics.serviceMonitor.interval }}
|
||||
interval: {{ .Values.metrics.serviceMonitor.interval }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
|
||||
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
|
||||
{{- end }}
|
||||
bearerTokenSecret:
|
||||
name: {{ template "minio.fullname" . }}-prometheus
|
||||
key: token
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace | quote }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ include "minio.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- end }}
|
|
@ -261,15 +261,6 @@ serviceAccount:
|
|||
## will be created. Otherwise, a name will be auto-generated.
|
||||
name:
|
||||
|
||||
metrics:
|
||||
# Metrics can not be disabled yet: https://github.com/minio/minio/issues/7493
|
||||
serviceMonitor:
|
||||
enabled: false
|
||||
additionalLabels: {}
|
||||
# namespace: monitoring
|
||||
# interval: 30s
|
||||
# scrapeTimeout: 10s
|
||||
|
||||
## ETCD settings: https://github.com/minio/minio/blob/master/docs/sts/etcd.md
|
||||
## Define endpoints to enable this section.
|
||||
etcd:
|
||||
|
|
Loading…
Reference in New Issue