jsonnet: add networkpolicies for components accessed by prometheus
This commit is contained in:
committed by
Paweł Krupa (paulfantom)
parent
f7c9de918c
commit
f8c00b9963
@@ -238,6 +238,30 @@ function(params) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
networkPolicy: {
|
||||||
|
apiVersion: 'networking.k8s.io/v1',
|
||||||
|
kind: 'NetworkPolicy',
|
||||||
|
metadata: bb.service.metadata,
|
||||||
|
spec: {
|
||||||
|
podSelector: {
|
||||||
|
matchLabels: bb._config.selectorLabels,
|
||||||
|
},
|
||||||
|
ingress: [{
|
||||||
|
from: [{
|
||||||
|
podSelector: {
|
||||||
|
matchLabels: {
|
||||||
|
'app.kubernetes.io/name': 'prometheus',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
ports: std.map(function(o) {
|
||||||
|
port: o.port,
|
||||||
|
protocol: 'TCP',
|
||||||
|
}, bb.service.spec.ports),
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
service: {
|
service: {
|
||||||
apiVersion: 'v1',
|
apiVersion: 'v1',
|
||||||
kind: 'Service',
|
kind: 'Service',
|
||||||
|
|||||||
@@ -118,6 +118,30 @@ function(params) (import 'github.com/kubernetes/kube-state-metrics/jsonnet/kube-
|
|||||||
image: ksm._config.kubeRbacProxyImage,
|
image: ksm._config.kubeRbacProxyImage,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
networkPolicy: {
|
||||||
|
apiVersion: 'networking.k8s.io/v1',
|
||||||
|
kind: 'NetworkPolicy',
|
||||||
|
metadata: ksm.service.metadata,
|
||||||
|
spec: {
|
||||||
|
podSelector: {
|
||||||
|
matchLabels: ksm._config.selectorLabels,
|
||||||
|
},
|
||||||
|
ingress: [{
|
||||||
|
from: [{
|
||||||
|
podSelector: {
|
||||||
|
matchLabels: {
|
||||||
|
'app.kubernetes.io/name': 'prometheus',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
ports: std.map(function(o) {
|
||||||
|
port: o.port,
|
||||||
|
protocol: 'TCP',
|
||||||
|
}, ksm.service.spec.ports),
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
deployment+: {
|
deployment+: {
|
||||||
spec+: {
|
spec+: {
|
||||||
template+: {
|
template+: {
|
||||||
|
|||||||
@@ -159,6 +159,30 @@ function(params) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
networkPolicy: {
|
||||||
|
apiVersion: 'networking.k8s.io/v1',
|
||||||
|
kind: 'NetworkPolicy',
|
||||||
|
metadata: ne.service.metadata,
|
||||||
|
spec: {
|
||||||
|
podSelector: {
|
||||||
|
matchLabels: ne._config.selectorLabels,
|
||||||
|
},
|
||||||
|
ingress: [{
|
||||||
|
from: [{
|
||||||
|
podSelector: {
|
||||||
|
matchLabels: {
|
||||||
|
'app.kubernetes.io/name': 'prometheus',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
ports: std.map(function(o) {
|
||||||
|
port: o.port,
|
||||||
|
protocol: 'TCP',
|
||||||
|
}, ne.service.spec.ports),
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
daemonset:
|
daemonset:
|
||||||
local nodeExporter = {
|
local nodeExporter = {
|
||||||
name: ne._config.name,
|
name: ne._config.name,
|
||||||
|
|||||||
@@ -206,6 +206,30 @@ function(params) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
networkPolicy: {
|
||||||
|
apiVersion: 'networking.k8s.io/v1',
|
||||||
|
kind: 'NetworkPolicy',
|
||||||
|
metadata: pa.service.metadata,
|
||||||
|
spec: {
|
||||||
|
podSelector: {
|
||||||
|
matchLabels: pa._config.selectorLabels,
|
||||||
|
},
|
||||||
|
ingress: [{
|
||||||
|
from: [{
|
||||||
|
podSelector: {
|
||||||
|
matchLabels: {
|
||||||
|
'app.kubernetes.io/name': 'prometheus',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
ports: std.map(function(o) {
|
||||||
|
port: o.port,
|
||||||
|
protocol: 'TCP',
|
||||||
|
}, pa.service.spec.ports),
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
deployment:
|
deployment:
|
||||||
local c = {
|
local c = {
|
||||||
name: pa._config.name,
|
name: pa._config.name,
|
||||||
|
|||||||
Reference in New Issue
Block a user