Skip to content

Commit

Permalink
Merge pull request #2008 from facchettos/network-fix-backport
Browse files Browse the repository at this point in the history
[BACKPORT v0.20] [fix] add exception for the platform in network policy
  • Loading branch information
FabianKramm authored Aug 5, 2024
2 parents 7a0dac2 + 5b3275a commit 201026d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
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 @@ -1946,6 +1946,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 @@ -738,6 +738,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 @@ -1399,6 +1399,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 @@ -447,6 +447,7 @@ policies:
annotations: {}
fallbackDns: 8.8.8.8
outgoingConnections:
platform: true
ipBlock:
cidr: 0.0.0.0/0
except:
Expand Down

0 comments on commit 201026d

Please sign in to comment.