Deny firewall for external services#958
Conversation
|
This issue is currently awaiting triage. If the repository mantainers determine this is a relevant issue, they will accept it by applying the The DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/hold /assign @mmamczur |
|
/uncc elmiko cici37 |
2f4424c to
509ce17
Compare
| return nil | ||
| } | ||
|
|
||
| func (g *Cloud) deleteFirewallWithoutAuditLogs(fwName string) error { |
There was a problem hiding this comment.
this name suggests we do something bad while I assume it's to avoid a NOT_FOUND error log
509ce17 to
b92e3c8
Compare
a055934 to
52bffa9
Compare
|
|
||
| type protocol string | ||
|
|
||
| func portsPerProtocol[T compute.FirewallAllowed | compute.FirewallDenied](a []*T) (map[protocol]sets.Set[int], error) { |
There was a problem hiding this comment.
You are expanding every interval in integer sets, could we sort/merge them instead?
There was a problem hiding this comment.
Do you mean like comparing string slices directly? I'm not sure about this, the GCE may return "10-15", and we can ask for "10", "11", "12, "13", "14", "15". They're the same firewall but differently written.
Do you know if we can have such guarantees?
There was a problem hiding this comment.
Generated example:
type portInterval struct {
Start uint16
End uint16
}
func mergeIntervals(intervals []portInterval) []portInterval {
if len(intervals) < 2 {
return intervals
}
// Sort by Start, then End.
slices.SortFunc(intervals, func(a, b portInterval) int {
if n := cmp.Compare(a.Start, b.Start); n != 0 {
return n
}
return cmp.Compare(a.End, b.End)
})
w := 0
for r := 1; r < len(intervals); r++ {
// If current interval overlaps or is adjacent to the next one.
if intervals[r].Start <= intervals[w].End+1 {
if intervals[r].End > intervals[w].End {
intervals[w].End = intervals[r].End
}
} else {
w++
intervals[w] = intervals[r]
}
}
return intervals[:w+1]
}
There was a problem hiding this comment.
It sounds to me like yours implementation would be quicker, but given that the most time is spent on the API calls I don't think the ROI is worth it.
There was a problem hiding this comment.
I don't want to rewrite this for this PR, I might revisit it later.
|
this test is super flaky https://prow.k8s.io/view/gs/kubernetes-ci-logs/pr-logs/pull/cloud-provider-gcp/958/cloud-provider-gcp-tests/2017177332799770624 /retest |
|
This wasn't introduced by this PR, it's caused by something already merged on master. Here's another PR that had the same test failing #955. 🙄 /test cloud-provider-gcp-tests |
|
/lgtm |
An adapted copy of similar changes done to ingress-gce: * two new GCE flags `enable-l4-deny-firewall` and `enable-l4-deny-firewall-rollback-cleanup`, * adds deny firewall functionality with correct order for provisioning/cleanup, the new firewall is following the previous naming scheme and adds "-deny" suffix at the end, * exports metric "number_of_l4_netlbs" including firewall deny state and general status, * vendors in `cmpopts` for easier testing.
d136671 to
164cd53
Compare
|
/unhold as said before, the commits were squashed |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mmamczur, TortillaZHawaii The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[Cherrypick #958] Add deny firewall for external service LB
An adapted copy of similar changes done to ingress-gce:
enable-l4-deny-firewallandenable-l4-deny-firewall-rollback-cleanup,cmpoptsfor easier testing.