Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
prometheus-operator: Make namespace info explicit
Browse files Browse the repository at this point in the history
For all the configs that have missing namespace information, this commit
adds following line to metadata of those namespaced objects.

```
namespace: {{ .Release.Namespace }}
```

Signed-off-by: Suraj Deshmukh <surajd.service@gmail.com>
  • Loading branch information
surajssd committed May 31, 2019
1 parent 32181cd commit a81f7fe
Show file tree
Hide file tree
Showing 70 changed files with 111 additions and 43 deletions.
2 changes: 1 addition & 1 deletion stable/prometheus-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name: prometheus-operator
sources:
- https://github.com/coreos/prometheus-operator
- https://coreos.com/operators/prometheus
version: 5.11.0
version: 5.11.1
appVersion: 0.30.0
home: https://github.com/coreos/prometheus-operator
keywords:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: {{ printf "%s/v1" (.Values.prometheusOperator.crdApiGroup | default
kind: Alertmanager
metadata:
name: {{ template "prometheus-operator.fullname" . }}-alertmanager
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-alertmanager
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $serviceName }}
namespace: {{ .Release.Namespace }}
{{- if .Values.alertmanager.ingress.annotations }}
annotations:
{{ toYaml .Values.alertmanager.ingress.annotations | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: {{ template "prometheus-operator.fullname" . }}-alertmanager
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-alertmanager
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand All @@ -17,4 +18,4 @@ spec:
matchLabels:
app: alertmanager
alertmanager: {{ template "prometheus-operator.fullname" . }}-alertmanager
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: alertmanager-{{ template "prometheus-operator.fullname" . }}-alertmanager
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-alertmanager
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand All @@ -11,4 +12,4 @@ data:
{{- range $key, $val := .Values.alertmanager.templateFiles }}
{{ $key }}: {{ $val | b64enc | quote }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "prometheus-operator.fullname" . }}-alertmanager
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-alertmanager
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "prometheus-operator.alertmanager.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-alertmanager
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: {{ printf "%s/v1" (.Values.prometheusOperator.crdApiGroup | default
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-alertmanager
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-alertmanager
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: {{ printf "%s/v1" (.Values.prometheusOperator.crdApiGroup | default
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-coredns
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-coredns
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: {{ printf "%s/v1" (.Values.prometheusOperator.crdApiGroup | default
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-apiserver
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-apiserver
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: {{ printf "%s/v1" (.Values.prometheusOperator.crdApiGroup | default
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-kube-controller-manager
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-kube-controller-manager
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down Expand Up @@ -34,4 +35,4 @@ spec:
relabelings:
{{ toYaml .Values.kubeControllerManager.serviceMonitor.relabelings | indent 4 }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: {{ printf "%s/v1" (.Values.prometheusOperator.crdApiGroup | default
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-kube-dns
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-kube-dns
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: {{ printf "%s/v1" (.Values.prometheusOperator.crdApiGroup | default
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-kube-etcd
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-kube-etcd
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: {{ printf "%s/v1" (.Values.prometheusOperator.crdApiGroup | default
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-kube-scheduler
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-kube-scheduler
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: {{ printf "%s/v1" (.Values.prometheusOperator.crdApiGroup | default
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-kube-state-metrics
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-kube-state-metrics
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: {{ printf "%s/v1" (.Values.prometheusOperator.crdApiGroup | default
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-kubelet
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-kubelet
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: {{ printf "%s/v1" (.Values.prometheusOperator.crdApiGroup | default
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-node-exporter
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-node-exporter
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ items:
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) $dashboardName | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "prometheus-operator.fullname" . }}-grafana-datasource
namespace: {{ .Release.Namespace }}
labels:
{{ $.Values.grafana.sidecar.datasources.label }}: "1"
app: {{ template "prometheus-operator.name" $ }}-grafana
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "etcd" | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down Expand Up @@ -1107,4 +1108,4 @@ data:
"title": "etcd",
"version": 215
}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "k8s-cluster-rsrc-use" | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down Expand Up @@ -950,4 +951,4 @@ data:
"uid": "a6e7d1362e1ddbb79db21d5bb40d7137",
"version": 0
}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "k8s-coredns" | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down Expand Up @@ -1320,4 +1321,4 @@ data:
"uid": "vkQ0UHxik",
"version": 1
}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "k8s-node-rsrc-use" | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down Expand Up @@ -977,4 +978,4 @@ data:
"uid": "4ac4f123aae0ff6dbaf4f4f66120033b",
"version": 0
}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "k8s-resources-cluster" | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down Expand Up @@ -1470,4 +1471,4 @@ data:
"uid": "efa86fd1d0c121a26444b636a3f509a8",
"version": 0
}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "k8s-resources-namespace" | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down Expand Up @@ -954,4 +955,4 @@ data:
"uid": "85a562078cdf77779eaa1add43ccec1e",
"version": 0
}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "k8s-resources-pod" | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down Expand Up @@ -997,4 +998,4 @@ data:
"uid": "6581e46e4e5c7ba40a07646395ef7b23",
"version": 0
}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "k8s-resources-workload" | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down Expand Up @@ -927,4 +928,4 @@ data:
"uid": "a164a7f0339f99e89cea5cb47e9be617",
"version": 0
}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "k8s-resources-workloads-namespace" | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down Expand Up @@ -963,4 +964,4 @@ data:
"uid": "a87fb0d919ec0ea5f6543124e16c42a5",
"version": 0
}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "nodes" | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down Expand Up @@ -1374,4 +1375,4 @@ data:
"uid": "fa49a4706d07a042595b664c87fb33ea",
"version": 0
}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "persistentvolumesusage" | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down Expand Up @@ -564,4 +565,4 @@ data:
"uid": "919b92a8e8041bd567af9edab12c840c",
"version": 0
}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "pods" | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down Expand Up @@ -671,4 +672,4 @@ data:
"uid": "ab4f13a9892a76a4d21ce8c2445bf4ea",
"version": 0
}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "statefulset" | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down Expand Up @@ -917,4 +918,4 @@ data:
"uid": "a31c1f46e6f727cb37c0d731a7245005",
"version": 0
}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: {{ printf "%s/v1" (.Values.prometheusOperator.crdApiGroup | default
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-grafana
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-grafana
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "prometheus-operator.fullname" . }}-operator
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-operator
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "prometheus-operator.fullname" . }}-operator
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "prometheus-operator.name" . }}-operator
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down
Loading

0 comments on commit a81f7fe

Please sign in to comment.