-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(woodpecker): add network-polices (#252)
Co-authored-by: WrenIX <[email protected]>
- Loading branch information
Showing
9 changed files
with
247 additions
and
0 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
50 changes: 50 additions & 0 deletions
50
charts/woodpecker/charts/agent/templates/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,50 @@ | ||
{{- with .Values.networkPolicy }} | ||
{{- if .enabled }} | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ include "woodpecker-agent.fullname" $ }} | ||
labels: | ||
{{- include "woodpecker-agent.labels" $ | nindent 4 }} | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
{{- include "woodpecker-agent.selectorLabels" $ | nindent 6 }} | ||
policyTypes: | ||
- Ingress | ||
{{- if .egress.enabled }} | ||
- Egress | ||
{{- end }} | ||
ingress: | ||
{{- with .ingress.http }} | ||
- ports: | ||
- port: 3000 | ||
protocol: TCP | ||
from: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }}{{/* end-with .ingress.http */}} | ||
|
||
{{- with .egress }} | ||
{{- if .enabled }} | ||
egress: | ||
{{- with .dns }} | ||
- ports: | ||
- port: 53 | ||
protocol: UDP | ||
to: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .server }} | ||
- {{- toYaml . | nindent 6 }} | ||
{{- end }} | ||
{{- with .apiserver }} | ||
- {{- toYaml . | nindent 6 }} | ||
{{- end }} | ||
{{- with .extra }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }}{{/* end-if egress.enabled */}} | ||
{{- end }}{{/* end-with .egress */}} | ||
{{- 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
61 changes: 61 additions & 0 deletions
61
charts/woodpecker/charts/server/templates/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,61 @@ | ||
{{- with .Values.networkPolicy }} | ||
{{- if .enabled }} | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ include "woodpecker-server.fullname" $ }} | ||
labels: | ||
{{- include "woodpecker-server.labels" $ | nindent 4 }} | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
{{- include "woodpecker-server.selectorLabels" $ | nindent 6 }} | ||
policyTypes: | ||
- Ingress | ||
{{- if .egress.enabled }} | ||
- Egress | ||
{{- end }} | ||
ingress: | ||
{{- with .ingress.http }} | ||
- ports: | ||
- port: 8000 | ||
protocol: TCP | ||
from: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }}{{/* end-with .ingress.http */}} | ||
{{- with .ingress.grpc }} | ||
- ports: | ||
- port: 9000 | ||
protocol: TCP | ||
from: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }}{{/* end-with .ingress.grpc */}} | ||
{{- with .ingress.metrics }} | ||
- ports: | ||
- port: {{ $.Values.metrics.port }} | ||
protocol: TCP | ||
from: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }}{{/* end-with .ingress.metrics */}} | ||
|
||
{{- with .egress }} | ||
{{- if .enabled }} | ||
egress: | ||
{{- with .dns }} | ||
- ports: | ||
- port: 53 | ||
protocol: UDP | ||
to: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .database }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- with .extra }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }}{{/* end-if egress.enabled */}} | ||
{{- end }}{{/* end-with .egress */}} | ||
{{- 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
Empty file.
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,11 @@ | ||
agent: | ||
networkPolicy: | ||
enabled: true | ||
egress: | ||
enabled: true | ||
|
||
server: | ||
networkPolicy: | ||
enabled: true | ||
egress: | ||
enabled: true |
Binary file not shown.