From c3dad8c70b389be0188cf9c2fd57fe381696173c Mon Sep 17 00:00:00 2001 From: Siyuan Wang <c.one@thrimbda.com> Date: Wed, 15 Mar 2023 19:45:51 +0800 Subject: [PATCH] fix: prometheus network policy let prometheus-adapter pass (#1982) --- .../kube-prometheus/components/prometheus.libsonnet | 12 ++++++++++++ manifests/prometheus-networkPolicy.yaml | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/jsonnet/kube-prometheus/components/prometheus.libsonnet b/jsonnet/kube-prometheus/components/prometheus.libsonnet index f72f19f9..089d7bb6 100644 --- a/jsonnet/kube-prometheus/components/prometheus.libsonnet +++ b/jsonnet/kube-prometheus/components/prometheus.libsonnet @@ -116,6 +116,18 @@ function(params) { port: o.port, protocol: 'TCP', }, p.service.spec.ports), + }, { + from: [{ + podSelector: { + matchLabels: { + 'app.kubernetes.io/name': 'prometheus-adapter', + }, + }, + }], + ports: [{ + port: 9090, + protocol: 'TCP', + }], }, { from: [{ podSelector: { diff --git a/manifests/prometheus-networkPolicy.yaml b/manifests/prometheus-networkPolicy.yaml index f0f6c90b..c25a4457 100644 --- a/manifests/prometheus-networkPolicy.yaml +++ b/manifests/prometheus-networkPolicy.yaml @@ -22,6 +22,13 @@ spec: protocol: TCP - port: 8080 protocol: TCP + - from: + - podSelector: + matchLabels: + app.kubernetes.io/name: prometheus-adapter + ports: + - port: 9090 + protocol: TCP - from: - podSelector: matchLabels: -- GitLab