Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] add exception for the platform in network policy #2007

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions chart/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ spec:
podSelector:
matchLabels:
k8s-app: kube-dns
{{- if .Values.policies.networkPolicy.outgoingConnections.platform }}
- podSelector:
matchLabels:
app: loft
namespaceSelector: {}
{{- end }}
policyTypes:
- Egress
{{- end }}
4 changes: 4 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2038,6 +2038,10 @@
"ipBlock": {
"$ref": "#/$defs/IPBlock",
"description": "IPBlock describes a particular CIDR (Ex. \"192.168.1.0/24\",\"2001:db8::/64\") that is allowed\nto the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs\nthat should not be included within this rule."
},
"platform": {
"type": "boolean",
"description": "Platform enables egress access towards loft platform"
}
},
"additionalProperties": false,
Expand Down
2 changes: 2 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,8 @@ policies:
annotations: {}
fallbackDns: 8.8.8.8
outgoingConnections:
# Platform enables egress access towards loft platform
platform: true
# IPBlock describes a particular CIDR (Ex. "192.168.1.0/24","2001:db8::/64") that is allowed
# to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs
# that should not be included within this rule.
Expand Down
3 changes: 3 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,9 @@ type OutgoingConnections struct {
// to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs
// that should not be included within this rule.
IPBlock IPBlock `json:"ipBlock,omitempty"`

// Platform enables egress access towards loft platform
Platform bool `json:"platform,omitempty"`
}

type IPBlock struct {
Expand Down
1 change: 1 addition & 0 deletions config/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ policies:
annotations: {}
fallbackDns: 8.8.8.8
outgoingConnections:
platform: true
ipBlock:
cidr: 0.0.0.0/0
except:
Expand Down
Loading