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

[stable/prometheus-operator] namespace override #22288

Merged
merged 6 commits into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stable/prometheus-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sources:
- /~https://github.com/coreos/kube-prometheus
- /~https://github.com/coreos/prometheus-operator
- https://coreos.com/operators/prometheus
version: 8.15.0
version: 8.15.1
appVersion: 0.38.1
tillerVersion: ">=2.12.0"
home: /~https://github.com/coreos/prometheus-operator
Expand Down
4 changes: 4 additions & 0 deletions stable/prometheus-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ The following tables list the configurable parameters of the prometheus-operator
| `global.rbac.pspAnnotations` | Add annotations to the PSP configurations | `{}` |
| `kubeTargetVersionOverride` | Provide a target gitVersion of K8S, in case .Capabilites.KubeVersion is not available (e.g. `helm template`) |`""`|
| `nameOverride` | Provide a name in place of `prometheus-operator` |`""`|
| `namespaceOverride` | Override the deployment namespace | `""` (`Release.Namespace`) |
| `kubeTargetVersionOverride` | Provide a k8s version |`""`|

### Prometheus Operator
Expand Down Expand Up @@ -456,6 +457,7 @@ For a full list of configurable values please refer to the [Grafana chart](https
| `grafana.ingress.hosts` | Ingress accepted hostnames for Grafana| `[]` |
| `grafana.ingress.labels` | Custom labels for Grafana Ingress | `{}` |
| `grafana.ingress.tls` | Ingress TLS configuration for Grafana | `[]` |
| `grafana.namespaceOverride` | Override the deployment namespace of grafana | `""` (`Release.Namespace`) |
| `grafana.rbac.pspUseAppArmor` | Enforce AppArmor in created PodSecurityPolicy (requires rbac.pspEnabled) | `true` |
| `grafana.service.portName` | Allow to customize Grafana service portname. Will be used by servicemonitor as well | `service` |
| `grafana.serviceMonitor.metricRelabelings` | The `metric_relabel_configs` for scraping the grafana instance. | `` |
Expand All @@ -479,6 +481,7 @@ For a full list of configurable values please refer to the [Grafana chart](https
| `coreDns.serviceMonitor.interval` | Scrape interval. If not set, the Prometheus default scrape interval is used | `nil` |
| `coreDns.serviceMonitor.metricRelabelings` | The `metric_relabel_configs` for scraping CoreDns. | `` |
| `coreDns.serviceMonitor.relabelings` | The `relabel_configs` for scraping CoreDNS. | `` |
| `kube-state-metrics.namespaceOverride` | Override the deployment namespace of kube-state-metrics | `""` (`Release.Namespace`) |
| `kube-state-metrics.podSecurityPolicy.enabled` | Create pod security policy resource for kube-state-metrics. | `true` |
| `kube-state-metrics.rbac.create` | Create RBAC components in kube-state-metrics. See `global.rbac.create` | `true` |
| `kubeApiServer.enabled` | Deploy `serviceMonitor` to scrape the Kubernetes API server | `true` |
Expand Down Expand Up @@ -569,6 +572,7 @@ For a full list of configurable values please refer to the [Grafana chart](https
| `nodeExporter.serviceMonitor.metricRelabelings` | Metric relablings for the `prometheus-node-exporter` ServiceMonitor | `[]` |
| `nodeExporter.serviceMonitor.relabelings` | The `relabel_configs` for scraping the `prometheus-node-exporter`. | `` |
| `prometheus-node-exporter.extraArgs` | Additional arguments for the node exporter container | `["--collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+)($|/)", "--collector.filesystem.ignored-fs-types=^(autofs|binfmt_misc|cgroup|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|mqueue|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|sysfs|tracefs)$"]` |
| `prometheus-node-exporter.namespaceOverride` | Override the deployment namespace of node exporter | `""` (`Release.Namespace`) |
| `prometheus-node-exporter.podLabels` | Additional labels for pods in the DaemonSet | `{"jobLabel":"node-exporter"}` |


Expand Down
2 changes: 1 addition & 1 deletion stable/prometheus-operator/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
The Prometheus Operator has been installed. Check its status by running:
kubectl --namespace {{ $.Release.Namespace }} get pods -l "release={{ $.Release.Name }}"
kubectl --namespace {{ template "prometheus-operator.namespace" . }} get pods -l "release={{ $.Release.Name }}"

Visit /~https://github.com/coreos/prometheus-operator for instructions on how
to create & configure Alertmanager and Prometheus instances using the Operator.
11 changes: 11 additions & 0 deletions stable/prometheus-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,14 @@ heritage: {{ $.Release.Service | quote }}
{{ default "default" .Values.alertmanager.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
*/}}
{{- define "prometheus-operator.namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: Alertmanager
metadata:
name: {{ template "prometheus-operator.fullname" . }}-alertmanager
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
labels:
app: {{ template "prometheus-operator.name" . }}-alertmanager
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand All @@ -20,7 +20,7 @@ spec:
{{- else if and .Values.alertmanager.ingress.enabled .Values.alertmanager.ingress.hosts }}
externalUrl: "http://{{ index .Values.alertmanager.ingress.hosts 0 }}{{ .Values.alertmanager.alertmanagerSpec.routePrefix }}"
{{- else }}
externalUrl: http://{{ template "prometheus-operator.fullname" . }}-alertmanager.{{ $.Release.Namespace }}:{{ .Values.alertmanager.service.port }}
externalUrl: http://{{ template "prometheus-operator.fullname" . }}-alertmanager.{{ template "prometheus-operator.namespace" . }}:{{ .Values.alertmanager.service.port }}
{{- end }}
{{- if .Values.alertmanager.alertmanagerSpec.nodeSelector }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $serviceName }}
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.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 @@ -6,7 +6,7 @@ apiVersion: v1
kind: List
metadata:
name: {{ include "prometheus-operator.fullname" $ }}-alertmanager-ingressperreplica
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
items:
{{ range $i, $e := until $count }}
- kind: Ingress
Expand All @@ -17,7 +17,7 @@ items:
{{ end -}}
metadata:
name: {{ include "prometheus-operator.fullname" $ }}-alertmanager-{{ $i }}
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
labels:
app: {{ include "prometheus-operator.name" $ }}-alertmanager
{{ include "prometheus-operator.labels" $ | indent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: {{ template "prometheus-operator.fullname" . }}-alertmanager
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.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,7 +3,7 @@ kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ template "prometheus-operator.fullname" . }}-alertmanager
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.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,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ template "prometheus-operator.fullname" . }}-alertmanager
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
labels:
app: {{ template "prometheus-operator.name" . }}-alertmanager
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand All @@ -14,5 +14,5 @@ roleRef:
subjects:
- kind: ServiceAccount
name: {{ template "prometheus-operator.alertmanager.serviceAccountName" . }}
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
{{- end }}
2 changes: 1 addition & 1 deletion stable/prometheus-operator/templates/alertmanager/psp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: {{ template "prometheus-operator.fullname" . }}-alertmanager
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
labels:
app: {{ template "prometheus-operator.name" . }}-alertmanager
{{- if .Values.global.rbac.pspAnnotations }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: alertmanager-{{ template "prometheus-operator.fullname" . }}-alertmanager
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
{{- if .Values.alertmanager.secret.annotations }}
annotations:
{{ toYaml .Values.alertmanager.secret.annotations | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "prometheus-operator.fullname" . }}-alertmanager
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
labels:
app: {{ template "prometheus-operator.name" . }}-alertmanager
self-monitor: {{ .Values.alertmanager.serviceMonitor.selfMonitor | quote }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "prometheus-operator.alertmanager.serviceAccountName" . }}
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.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,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-alertmanager
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
labels:
app: {{ template "prometheus-operator.name" . }}-alertmanager
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand All @@ -15,7 +15,7 @@ spec:
self-monitor: "true"
namespaceSelector:
matchNames:
- {{ $.Release.Namespace | quote }}
- {{ printf "%s" (include "prometheus-operator.namespace" .) | quote }}
endpoints:
- port: {{ .Values.alertmanager.alertmanagerSpec.portName }}
{{- if .Values.alertmanager.serviceMonitor.interval }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ apiVersion: v1
kind: List
metadata:
name: {{ include "prometheus-operator.fullname" $ }}-alertmanager-serviceperreplica
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
items:
{{- range $i, $e := until $count }}
- apiVersion: v1
kind: Service
metadata:
name: {{ include "prometheus-operator.fullname" $ }}-alertmanager-{{ $i }}
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
labels:
app: {{ include "prometheus-operator.name" $ }}-alertmanager
{{ include "prometheus-operator.labels" $ | indent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-coredns
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.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,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-apiserver
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.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,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-kube-controller-manager
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
labels:
app: {{ template "prometheus-operator.name" . }}-kube-controller-manager
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-kube-dns
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.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,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-kube-etcd
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.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,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-kube-proxy
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
labels:
app: {{ template "prometheus-operator.name" . }}-kube-proxy
{{ include "prometheus-operator.labels" . | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-kube-scheduler
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.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,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-kube-state-metrics
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.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,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-kubelet
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.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,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-operator.fullname" . }}-node-exporter
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.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,7 +10,7 @@ items:
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) $dashboardName | trunc 63 | trimSuffix "-" }}
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.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,7 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "prometheus-operator.fullname" . }}-grafana-datasource
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
{{- if .Values.grafana.sidecar.datasources.annotations }}
annotations:
{{ toYaml .Values.grafana.sidecar.datasources.annotations | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ /~https://github.com/helm/charts/tree/master/stable/prometheus-operator/hack
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "apiserver" | trunc 63 | trimSuffix "-" }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ /~https://github.com/helm/charts/tree/master/stable/prometheus-operator/hack
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "cluster-total" | trunc 63 | trimSuffix "-" }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ /~https://github.com/helm/charts/tree/master/stable/prometheus-operator/hack
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "controller-manager" | trunc 63 | trimSuffix "-" }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ /~https://github.com/helm/charts/tree/master/stable/prometheus-operator/hack
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "etcd" | trunc 63 | trimSuffix "-" }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "k8s-coredns" | trunc 63 | trimSuffix "-" }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ /~https://github.com/helm/charts/tree/master/stable/prometheus-operator/hack
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "k8s-resources-cluster" | trunc 63 | trimSuffix "-" }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ /~https://github.com/helm/charts/tree/master/stable/prometheus-operator/hack
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "k8s-resources-namespace" | trunc 63 | trimSuffix "-" }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ /~https://github.com/helm/charts/tree/master/stable/prometheus-operator/hack
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "k8s-resources-node" | trunc 63 | trimSuffix "-" }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
Expand Down
Loading