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: {
|
||||
apiVersion: 'v1',
|
||||
kind: 'Service',
|
||||
|
||||
@@ -118,6 +118,30 @@ function(params) (import 'github.com/kubernetes/kube-state-metrics/jsonnet/kube-
|
||||
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+: {
|
||||
spec+: {
|
||||
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:
|
||||
local nodeExporter = {
|
||||
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:
|
||||
local c = {
|
||||
name: pa._config.name,
|
||||
|
||||
Reference in New Issue
Block a user