Skip to content

Commit dc0e245

Browse files
(chore): adds network-policy
Signed-off-by: abhijith-darshan <abhijith.darshan@hotmail.com> (chore): adds network-policy default values Signed-off-by: abhijith-darshan <abhijith.darshan@hotmail.com> (chore): bump chart version Signed-off-by: abhijith-darshan <abhijith.darshan@hotmail.com> (chore): set ingress rules to empty Signed-off-by: abhijith-darshan <abhijith.darshan@hotmail.com>
1 parent 3a73b6c commit dc0e245

File tree

3 files changed

+60
-2
lines changed

3 files changed

+60
-2
lines changed

system/secrets-injector/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: secrets-injector
33
description: Secrets Injector
44

55
type: application
6-
version: 1.1.17
6+
version: 1.1.18
77
appVersion: "0.1.0"
88

99
dependencies:
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{{- if .Values.networkPolicy.create }}
2+
apiVersion: networking.k8s.io/v1
3+
kind: NetworkPolicy
4+
metadata:
5+
name: secrets-injector-allow
6+
namespace: {{ .Release.Namespace }}
7+
spec:
8+
podSelector:
9+
matchLabels:
10+
app: secrets-injector
11+
policyTypes:
12+
- Ingress
13+
{{- if .Values.networkPolicy.ingress }}
14+
ingress:
15+
{{- range $rule := .Values.networkPolicy.ingress }}
16+
- from:
17+
{{- range $src := $rule.from }}
18+
- {{- if $src.namespaceSelector }}
19+
namespaceSelector:
20+
matchLabels:
21+
{{- range $k, $v := $src.namespaceSelector.matchLabels }}
22+
{{ $k }}: {{ $v | quote }}
23+
{{- end }}
24+
{{- end }}
25+
{{- if $src.podSelector }}
26+
podSelector:
27+
matchLabels:
28+
{{- range $k, $v := $src.podSelector.matchLabels }}
29+
{{ $k }}: {{ $v | quote }}
30+
{{- end }}
31+
{{- end }}
32+
{{- end }}
33+
{{- end }}
34+
{{- end }}
35+
---
36+
apiVersion: networking.k8s.io/v1
37+
kind: NetworkPolicy
38+
metadata:
39+
name: secrets-injector-deny
40+
namespace: {{ .Release.Namespace }}
41+
spec:
42+
podSelector:
43+
matchLabels:
44+
app: secrets-injector
45+
policyTypes:
46+
- Ingress
47+
# no ingress rules => deny all
48+
{{- end }}

system/secrets-injector/values.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,14 @@ alerts:
3030
enabled: true
3131
ruleSelector:
3232
prometheus: kubernetes
33-
33+
networkPolicy:
34+
create: false
35+
ingress: []
36+
# Example allowing only from kube-system/vpn-shoot pod:
37+
# - from:
38+
# - namespaceSelector:
39+
# matchLabels:
40+
# kubernetes.io/metadata.name: kube-system
41+
# podSelector:
42+
# matchLabels:
43+
# app: vpn-shoot

0 commit comments

Comments
 (0)