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

OCPBUGS-1765: Apply noAllowedAddressPairs on intended subnets only #242

Merged
merged 1 commit into from
Sep 30, 2022
Merged
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
10 changes: 5 additions & 5 deletions pkg/cloud/openstack/clients/machineservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ func (is *InstanceService) InstanceCreate(clusterName string, name string, clust
}
// Get all network UUIDs
var nets []openstackconfigv1.PortOpts
netsWithoutAllowedAddressPairs := map[string]struct{}{}
subnetsWithoutAllowedAddressPairs := map[string]struct{}{}
for _, net := range config.Networks {
opts := networks.ListOpts(net.Filter)
opts.ID = net.UUID
Expand All @@ -578,9 +578,6 @@ func (is *InstanceService) InstanceCreate(clusterName string, name string, clust
return nil, err
}
for _, netID := range ids {
if net.NoAllowedAddressPairs {
netsWithoutAllowedAddressPairs[netID] = struct{}{}
}
if net.Subnets == nil {
nets = append(nets, openstackconfigv1.PortOpts{
NetworkID: netID,
Expand Down Expand Up @@ -613,6 +610,9 @@ func (is *InstanceService) InstanceCreate(clusterName string, name string, clust
if snet.NetworkID != netID {
continue
}
if net.NoAllowedAddressPairs {
subnetsWithoutAllowedAddressPairs[snet.ID] = struct{}{}
}
nets = append(nets, openstackconfigv1.PortOpts{
NetworkID: snet.NetworkID,
NameSuffix: snet.ID,
Expand Down Expand Up @@ -655,7 +655,7 @@ func (is *InstanceService) InstanceCreate(clusterName string, name string, clust
}
portOpt.SecurityGroups = &securityGroups
portOpt.AllowedAddressPairs = allowedAddressPairs
if _, ok := netsWithoutAllowedAddressPairs[portOpt.NetworkID]; ok {
if _, ok := subnetsWithoutAllowedAddressPairs[portOpt.NameSuffix]; ok {
portOpt.AllowedAddressPairs = []openstackconfigv1.AddressPair{}
}

Expand Down