@@ -164,6 +164,94 @@ func TestOpenStackCluster_ValidateUpdate(t *testing.T) {
164164 },
165165 wantErr : false ,
166166 },
167+ {
168+ name : "Changing security group rules on the OpenStackCluster.Spec.ManagedSecurityGroups.ControlPlaneNodesSecurityGroupRules is allowed" ,
169+ oldTemplate : & infrav1.OpenStackCluster {
170+ Spec : infrav1.OpenStackClusterSpec {
171+ IdentityRef : infrav1.OpenStackIdentityReference {
172+ Name : "foobar" ,
173+ CloudName : "foobar" ,
174+ },
175+ ManagedSecurityGroups : & infrav1.ManagedSecurityGroups {
176+ ControlPlaneNodesSecurityGroupRules : []infrav1.SecurityGroupRuleSpec {
177+ {
178+ Name : "foobar" ,
179+ Description : ptr .To ("foobar" ),
180+ PortRangeMin : ptr .To (80 ),
181+ PortRangeMax : ptr .To (80 ),
182+ Protocol : ptr .To ("tcp" ),
183+ RemoteManagedGroups : []infrav1.ManagedSecurityGroupName {"controlplane" },
184+ },
185+ },
186+ },
187+ },
188+ },
189+ newTemplate : & infrav1.OpenStackCluster {
190+ Spec : infrav1.OpenStackClusterSpec {
191+ IdentityRef : infrav1.OpenStackIdentityReference {
192+ Name : "foobar" ,
193+ CloudName : "foobar" ,
194+ },
195+ ManagedSecurityGroups : & infrav1.ManagedSecurityGroups {
196+ ControlPlaneNodesSecurityGroupRules : []infrav1.SecurityGroupRuleSpec {
197+ {
198+ Name : "foobar" ,
199+ Description : ptr .To ("foobar" ),
200+ PortRangeMin : ptr .To (80 ),
201+ PortRangeMax : ptr .To (80 ),
202+ Protocol : ptr .To ("tcp" ),
203+ RemoteManagedGroups : []infrav1.ManagedSecurityGroupName {"controlplane" , "worker" },
204+ },
205+ },
206+ },
207+ },
208+ },
209+ wantErr : false ,
210+ },
211+ {
212+ name : "Changing security group rules on the OpenStackCluster.Spec.ManagedSecurityGroups.WorkerNodesSecurityGroupRules is allowed" ,
213+ oldTemplate : & infrav1.OpenStackCluster {
214+ Spec : infrav1.OpenStackClusterSpec {
215+ IdentityRef : infrav1.OpenStackIdentityReference {
216+ Name : "foobar" ,
217+ CloudName : "foobar" ,
218+ },
219+ ManagedSecurityGroups : & infrav1.ManagedSecurityGroups {
220+ WorkerNodesSecurityGroupRules : []infrav1.SecurityGroupRuleSpec {
221+ {
222+ Name : "foobar" ,
223+ Description : ptr .To ("foobar" ),
224+ PortRangeMin : ptr .To (80 ),
225+ PortRangeMax : ptr .To (80 ),
226+ Protocol : ptr .To ("tcp" ),
227+ RemoteManagedGroups : []infrav1.ManagedSecurityGroupName {"worker" },
228+ },
229+ },
230+ },
231+ },
232+ },
233+ newTemplate : & infrav1.OpenStackCluster {
234+ Spec : infrav1.OpenStackClusterSpec {
235+ IdentityRef : infrav1.OpenStackIdentityReference {
236+ Name : "foobar" ,
237+ CloudName : "foobar" ,
238+ },
239+ ManagedSecurityGroups : & infrav1.ManagedSecurityGroups {
240+ WorkerNodesSecurityGroupRules : []infrav1.SecurityGroupRuleSpec {
241+ {
242+ Name : "foobar" ,
243+ Description : ptr .To ("foobar" ),
244+ PortRangeMin : ptr .To (80 ),
245+ PortRangeMax : ptr .To (80 ),
246+ Protocol : ptr .To ("tcp" ),
247+ RemoteManagedGroups : []infrav1.ManagedSecurityGroupName {"worker" , "controlplane" },
248+ },
249+ },
250+ },
251+ },
252+ },
253+ wantErr : false ,
254+ },
167255 {
168256 name : "Changing CIDRs on the OpenStackCluster.Spec.APIServerLoadBalancer.AllowedCIDRs is allowed" ,
169257 oldTemplate : & infrav1.OpenStackCluster {
0 commit comments