Skip to content

Commit

Permalink
Add missing security groups for cilium etcd
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjadr committed Aug 11, 2023
1 parent edac43f commit 7679c36
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions pkg/model/openstackmodel/firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ func (b *FirewallModelBuilder) addSSHRules(c *fi.CloudupModelBuilderContext, sgM
func (b *FirewallModelBuilder) addETCDRules(c *fi.CloudupModelBuilderContext, sgMap map[string]*openstacktasks.SecurityGroup) error {
masterName := b.SecurityGroupName(kops.InstanceGroupRoleControlPlane)
masterSG := sgMap[masterName]
nodeName := b.SecurityGroupName(kops.InstanceGroupRoleNode)
nodeSG := sgMap[nodeName]

// ETCD Peer Discovery
etcdRule := &openstacktasks.SecurityGroupRule{
Expand All @@ -170,6 +172,37 @@ func (b *FirewallModelBuilder) addETCDRules(c *fi.CloudupModelBuilderContext, sg
b.addDirectionalGroupRule(c, masterSG, masterSG, etcdRule)
b.addDirectionalGroupRule(c, masterSG, masterSG, etcdPeerRule)

if b.Cluster.Spec.Networking.Cilium != nil && b.Cluster.Spec.Networking.Cilium.EtcdManaged {
etcdCiliumPeerRule := &openstacktasks.SecurityGroupRule{
Lifecycle: b.Lifecycle,
Direction: s(string(rules.DirIngress)),
Protocol: s(string(rules.ProtocolTCP)),
EtherType: s(IPV4),
PortRangeMin: i(2382),
PortRangeMax: i(2382),
}
etcdCiliumGRPCRule := &openstacktasks.SecurityGroupRule{
Lifecycle: b.Lifecycle,
Direction: s(string(rules.DirIngress)),
Protocol: s(string(rules.ProtocolTCP)),
EtherType: s(IPV4),
PortRangeMin: i(wellknownports.EtcdCiliumGRPC),
PortRangeMax: i(wellknownports.EtcdCiliumGRPC),
}
etcdCiliumClientRule := &openstacktasks.SecurityGroupRule{
Lifecycle: b.Lifecycle,
Direction: s(string(rules.DirIngress)),
Protocol: s(string(rules.ProtocolTCP)),
EtherType: s(IPV4),
PortRangeMin: i(wellknownports.EtcdCiliumClientPort),
PortRangeMax: i(wellknownports.EtcdCiliumClientPort),
}
b.addDirectionalGroupRule(c, masterSG, masterSG, etcdCiliumPeerRule)
b.addDirectionalGroupRule(c, masterSG, masterSG, etcdCiliumGRPCRule)
b.addDirectionalGroupRule(c, masterSG, masterSG, etcdCiliumClientRule)
b.addDirectionalGroupRule(c, nodeSG, masterSG, etcdCiliumClientRule)
}

for _, portRange := range wellknownports.ETCDPortRanges() {
etcdMgmrRule := &openstacktasks.SecurityGroupRule{
Lifecycle: b.Lifecycle,
Expand Down

0 comments on commit 7679c36

Please sign in to comment.