-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Network policy template Signed-off-by: clux <sszynrae@gmail.com> * fixup so that it can be installed by default Signed-off-by: clux <sszynrae@gmail.com> * not sure this will work, but give it a go Signed-off-by: clux <sszynrae@gmail.com> * go full crazy on this Signed-off-by: clux <sszynrae@gmail.com> * debug :( Signed-off-by: clux <sszynrae@gmail.com> * port by ref? Signed-off-by: clux <sszynrae@gmail.com> * another test Signed-off-by: clux <sszynrae@gmail.com> * double check weirdness Signed-off-by: clux <sszynrae@gmail.com> * finalizers rbac? Signed-off-by: clux <sszynrae@gmail.com> * right, update is a verb Signed-off-by: clux <sszynrae@gmail.com> * yeah, include the service account :| Signed-off-by: clux <sszynrae@gmail.com> * no one should need to deal with this Signed-off-by: clux <sszynrae@gmail.com> * final hide kubernetesPort (just do the two normal ones) Signed-off-by: clux <sszynrae@gmail.com> * more defensiveness Signed-off-by: clux <sszynrae@gmail.com> * include protocol Signed-off-by: clux <sszynrae@gmail.com> * ..leave default wide open so we can at least leave netpol on people who know how to do this can scope it Signed-off-by: clux <sszynrae@gmail.com> * undo defensive verbs Signed-off-by: clux <sszynrae@gmail.com> * gen Signed-off-by: clux <sszynrae@gmail.com> --------- Signed-off-by: clux <sszynrae@gmail.com>
- Loading branch information
Showing
7 changed files
with
160 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{{- if .Values.networkPolicy.enabled }} | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ include "controller.fullname" . }} | ||
namespace: {{ .Values.namespace }} | ||
labels: | ||
{{- include "controller.labels" . | nindent 4 }} | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
{{- include "controller.selectorLabels" . | nindent 6 }} | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
egress: | ||
{{- if .Values.tracing.enabled }} | ||
# pushing tracing spans to a collector | ||
- to: | ||
- namespaceSelector: | ||
matchLabels: | ||
name: {{.Values.tracing.namespace }} | ||
ports: | ||
- port: {{ .Values.tracing.port }} | ||
protocol: TCP | ||
{{- end }} | ||
|
||
# Kubernetes apiserver access | ||
- to: | ||
- ipBlock: | ||
{{- range .Values.networkPolicy.apiserver }} | ||
cidr: {{ . }} | ||
{{- end }} | ||
ports: | ||
- port: 443 | ||
protocol: TCP | ||
- port: 6443 | ||
protocol: TCP | ||
|
||
{{- if .Values.networkPolicy.dns }} | ||
# DNS egress | ||
- to: | ||
- podSelector: | ||
matchLabels: | ||
k8s-app: kube-dns | ||
ports: | ||
- port: 53 | ||
protocol: UDP | ||
{{- end }} | ||
|
||
ingress: | ||
{{- with .Values.networkPolicy.prometheus }} | ||
{{- if .enabled }} | ||
# prometheus metrics scraping support | ||
- from: | ||
- namespaceSelector: | ||
matchLabels: | ||
name: {{ .namespace }} | ||
podSelector: | ||
matchLabels: | ||
app: {{ .app }} | ||
ports: | ||
- port: {{ .port }} | ||
protocol: TCP | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters