-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #445 from kubescape/netpol
add missing network policies
- Loading branch information
Showing
24 changed files
with
1,212 additions
and
212 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
charts/kubescape-operator/assets/api-server-egress-rules.yaml
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,16 @@ | ||
- ports: | ||
- port: {{ .Values.global.networkPolicy.apiServerPort }} | ||
protocol: TCP | ||
to: | ||
{{- if .Values.global.networkPolicy.apiServerIP }} | ||
- ipBlock: | ||
cidr: {{ .Values.global.networkPolicy.apiServerIP }}/32 | ||
{{- else }} | ||
- namespaceSelector: | ||
matchLabels: | ||
kubernetes.io/metadata.name: default | ||
podSelector: | ||
matchLabels: | ||
component: apiserver | ||
provider: kubernetes | ||
{{- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
- ports: | ||
- port: 53 | ||
protocol: UDP | ||
to: | ||
- namespaceSelector: | ||
matchLabels: | ||
kubernetes.io/metadata.name: kube-system | ||
podSelector: | ||
matchLabels: | ||
k8s-app: kube-dns | ||
- ports: | ||
- port: 4317 | ||
protocol: TCP | ||
to: | ||
- podSelector: | ||
matchLabels: | ||
app: otel-collector | ||
{{- if ne .Values.global.httpsProxy "" }} | ||
- ports: | ||
- port: {{ .Values.global.networkPolicy.httpsProxyPort }} | ||
protocol: TCP | ||
to: | ||
- ipBlock: | ||
cidr: {{ .Values.global.networkPolicy.httpsProxyIP }}/32 | ||
{{- 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
22 changes: 22 additions & 0 deletions
22
charts/kubescape-operator/templates/autoupdater/networkpolicy.yaml
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,22 @@ | ||
{{- $components := fromYaml (include "components" .) }} | ||
{{- if and .Values.global.networkPolicy.enabled .Values.global.networkPolicy.createEgressRules $components.autoUpdater.enabled }} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ .Values.helmReleaseUpgrader.name }} | ||
namespace: {{ .Values.ksNamespace }} | ||
labels: | ||
app: {{ .Values.helmReleaseUpgrader.name }} | ||
tier: {{ .Values.global.namespaceTier }} | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/name: {{ .Values.helmReleaseUpgrader.name }} | ||
tier: {{ .Values.global.namespaceTier }} | ||
policyTypes: | ||
- Egress | ||
egress: | ||
{{ tpl (.Files.Get "assets/common-egress-rules.yaml") . | indent 4 }} | ||
{{- 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
3 changes: 2 additions & 1 deletion
3
charts/kubescape-operator/templates/autoupdater/serviceaccount.yaml
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
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
22 changes: 22 additions & 0 deletions
22
charts/kubescape-operator/templates/kubescape-scheduler/networkpolicy.yaml
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,22 @@ | ||
{{- $components := fromYaml (include "components" .) }} | ||
{{- if and .Values.global.networkPolicy.enabled .Values.global.networkPolicy.createEgressRules $components.kubescapeScheduler.enabled }} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ .Values.kubescapeScheduler.name }} | ||
namespace: {{ .Values.ksNamespace }} | ||
labels: | ||
app: {{ .Values.kubescapeScheduler.name }} | ||
tier: {{ .Values.global.namespaceTier }} | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/name: {{ .Values.kubescapeScheduler.name }} | ||
tier: {{ .Values.global.namespaceTier }} | ||
policyTypes: | ||
- Egress | ||
egress: | ||
{{ tpl (.Files.Get "assets/common-egress-rules.yaml") . | indent 4 }} | ||
{{- 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
22 changes: 22 additions & 0 deletions
22
charts/kubescape-operator/templates/kubevuln-scheduler/networkpolicy.yaml
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,22 @@ | ||
{{- $components := fromYaml (include "components" .) }} | ||
{{- if and .Values.global.networkPolicy.enabled .Values.global.networkPolicy.createEgressRules $components.kubevulnScheduler.enabled }} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ .Values.kubevulnScheduler.name }} | ||
namespace: {{ .Values.ksNamespace }} | ||
labels: | ||
app: {{ .Values.kubevulnScheduler.name }} | ||
tier: {{ .Values.global.namespaceTier }} | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/name: {{ .Values.kubevulnScheduler.name }} | ||
tier: {{ .Values.global.namespaceTier }} | ||
policyTypes: | ||
- Egress | ||
egress: | ||
{{ tpl (.Files.Get "assets/common-egress-rules.yaml") . | indent 4 }} | ||
{{- 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
22 changes: 22 additions & 0 deletions
22
charts/kubescape-operator/templates/node-agent/networkpolicy.yaml
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,22 @@ | ||
{{- $components := fromYaml (include "components" .) }} | ||
{{- if and .Values.global.networkPolicy.enabled .Values.global.networkPolicy.createEgressRules $components.nodeAgent.enabled }} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ .Values.nodeAgent.name }} | ||
namespace: {{ .Values.ksNamespace }} | ||
labels: | ||
app: {{ .Values.nodeAgent.name }} | ||
tier: {{ .Values.global.namespaceTier }} | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/name: {{ .Values.nodeAgent.name }} | ||
tier: {{ .Values.global.namespaceTier }} | ||
policyTypes: | ||
- Egress | ||
egress: | ||
{{ tpl (.Files.Get "assets/common-egress-rules.yaml") . | indent 4 }} | ||
{{- 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
Oops, something went wrong.