@@ -195,13 +195,15 @@ func spokeCluster(in *Cluster, c randfill.Continue) {
195
195
196
196
dropEmptyStringsCluster (in )
197
197
198
- if in .Spec .Topology != nil && in .Spec .Topology .Workers != nil {
199
- for _ , md := range in .Spec .Topology .Workers .MachineDeployments {
200
- if md .Strategy != nil && md .Strategy .RollingUpdate != nil &&
201
- md .Strategy .RollingUpdate .DeletePolicy != nil && * md .Strategy .RollingUpdate .DeletePolicy == "" {
202
- // &"" Is not a valid value for DeletePolicy as the enum validation enforces an enum value if DeletePolicy is set.
203
- md .Strategy .RollingUpdate .DeletePolicy = nil
204
- }
198
+ if in .Spec .ClusterNetwork != nil {
199
+ if in .Spec .ClusterNetwork .Services != nil && reflect .DeepEqual (in .Spec .ClusterNetwork .Services , & NetworkRanges {}) {
200
+ in .Spec .ClusterNetwork .Services = nil
201
+ }
202
+ if in .Spec .ClusterNetwork .Pods != nil && reflect .DeepEqual (in .Spec .ClusterNetwork .Pods , & NetworkRanges {}) {
203
+ in .Spec .ClusterNetwork .Pods = nil
204
+ }
205
+ if reflect .DeepEqual (in .Spec .ClusterNetwork , & ClusterNetwork {}) {
206
+ in .Spec .ClusterNetwork = nil
205
207
}
206
208
}
207
209
}
@@ -211,6 +213,10 @@ func spokeClusterTopology(in *Topology, c randfill.Continue) {
211
213
212
214
// RolloutAfter was unused and has been removed in v1beta2.
213
215
in .RolloutAfter = nil
216
+
217
+ if in .Workers != nil && reflect .DeepEqual (in .Workers , & WorkersTopology {}) {
218
+ in .Workers = nil
219
+ }
214
220
}
215
221
216
222
func spokeClusterStatus (in * ClusterStatus , c randfill.Continue ) {
@@ -326,14 +332,6 @@ func spokeClusterClass(in *ClusterClass, c randfill.Continue) {
326
332
in .Namespace = "foo"
327
333
328
334
dropEmptyStringsClusterClass (in )
329
-
330
- for _ , md := range in .Spec .Workers .MachineDeployments {
331
- if md .Strategy != nil && md .Strategy .RollingUpdate != nil &&
332
- md .Strategy .RollingUpdate .DeletePolicy != nil && * md .Strategy .RollingUpdate .DeletePolicy == "" {
333
- // &"" Is not a valid value for DeletePolicy as the enum validation enforces an enum value if DeletePolicy is set.
334
- md .Strategy .RollingUpdate .DeletePolicy = nil
335
- }
336
- }
337
335
}
338
336
339
337
func spokeClusterClassStatus (in * ClusterClassStatus , c randfill.Continue ) {
@@ -589,12 +587,6 @@ func spokeMachineDeployment(in *MachineDeployment, c randfill.Continue) {
589
587
fillMachineSpec (& in .Spec .Template .Spec , c , in .Namespace )
590
588
591
589
dropEmptyStringsMachineSpec (& in .Spec .Template .Spec )
592
-
593
- if in .Spec .Strategy != nil && in .Spec .Strategy .RollingUpdate != nil &&
594
- in .Spec .Strategy .RollingUpdate .DeletePolicy != nil && * in .Spec .Strategy .RollingUpdate .DeletePolicy == "" {
595
- // &"" Is not a valid value for DeletePolicy as the enum validation enforces an enum value if DeletePolicy is set.
596
- in .Spec .Strategy .RollingUpdate .DeletePolicy = nil
597
- }
598
590
}
599
591
600
592
func spokeMachineDeploymentSpec (in * MachineDeploymentSpec , c randfill.Continue ) {
@@ -605,6 +597,24 @@ func spokeMachineDeploymentSpec(in *MachineDeploymentSpec, c randfill.Continue)
605
597
606
598
// Drop RevisionHistoryLimit as we intentionally don't preserve it.
607
599
in .RevisionHistoryLimit = nil
600
+
601
+ if in .Strategy != nil {
602
+ if in .Strategy .RollingUpdate != nil {
603
+ if in .Strategy .RollingUpdate .DeletePolicy != nil && * in .Strategy .RollingUpdate .DeletePolicy == "" {
604
+ // &"" Is not a valid value for DeletePolicy as the enum validation enforces an enum value if DeletePolicy is set.
605
+ in .Strategy .RollingUpdate .DeletePolicy = nil
606
+ }
607
+ if reflect .DeepEqual (in .Strategy .RollingUpdate , & MachineRollingUpdateDeployment {}) {
608
+ in .Strategy .RollingUpdate = nil
609
+ }
610
+ }
611
+ if in .Strategy .Remediation != nil && reflect .DeepEqual (in .Strategy .Remediation , & RemediationStrategy {}) {
612
+ in .Strategy .Remediation = nil
613
+ }
614
+ if reflect .DeepEqual (in .Strategy , & MachineDeploymentStrategy {}) {
615
+ in .Strategy = nil
616
+ }
617
+ }
608
618
}
609
619
610
620
func spokeMachineDeploymentStatus (in * MachineDeploymentStatus , c randfill.Continue ) {
@@ -726,6 +736,10 @@ func spokeControlPlaneTopology(in *ControlPlaneTopology, c randfill.Continue) {
726
736
if in .NodeDeletionTimeout != nil {
727
737
in .NodeDeletionTimeout = ptr.To [metav1.Duration ](metav1.Duration {Duration : time .Duration (c .Int31 ()) * time .Second })
728
738
}
739
+
740
+ if in .Variables != nil && reflect .DeepEqual (in .Variables , & ControlPlaneVariables {}) {
741
+ in .Variables = nil
742
+ }
729
743
}
730
744
731
745
func spokeMachineDeploymentTopology (in * MachineDeploymentTopology , c randfill.Continue ) {
@@ -740,6 +754,26 @@ func spokeMachineDeploymentTopology(in *MachineDeploymentTopology, c randfill.Co
740
754
if in .NodeDeletionTimeout != nil {
741
755
in .NodeDeletionTimeout = ptr.To [metav1.Duration ](metav1.Duration {Duration : time .Duration (c .Int31 ()) * time .Second })
742
756
}
757
+ if in .Variables != nil && reflect .DeepEqual (in .Variables , & MachineDeploymentVariables {}) {
758
+ in .Variables = nil
759
+ }
760
+ if in .Strategy != nil {
761
+ if in .Strategy .RollingUpdate != nil {
762
+ if in .Strategy .RollingUpdate .DeletePolicy != nil && * in .Strategy .RollingUpdate .DeletePolicy == "" {
763
+ // &"" Is not a valid value for DeletePolicy as the enum validation enforces an enum value if DeletePolicy is set.
764
+ in .Strategy .RollingUpdate .DeletePolicy = nil
765
+ }
766
+ if reflect .DeepEqual (in .Strategy .RollingUpdate , & MachineRollingUpdateDeployment {}) {
767
+ in .Strategy .RollingUpdate = nil
768
+ }
769
+ }
770
+ if in .Strategy .Remediation != nil && reflect .DeepEqual (in .Strategy .Remediation , & RemediationStrategy {}) {
771
+ in .Strategy .Remediation = nil
772
+ }
773
+ if reflect .DeepEqual (in .Strategy , & MachineDeploymentStrategy {}) {
774
+ in .Strategy = nil
775
+ }
776
+ }
743
777
}
744
778
745
779
func spokeMachinePoolTopology (in * MachinePoolTopology , c randfill.Continue ) {
@@ -754,6 +788,9 @@ func spokeMachinePoolTopology(in *MachinePoolTopology, c randfill.Continue) {
754
788
if in .NodeDeletionTimeout != nil {
755
789
in .NodeDeletionTimeout = ptr.To [metav1.Duration ](metav1.Duration {Duration : time .Duration (c .Int31 ()) * time .Second })
756
790
}
791
+ if in .Variables != nil && reflect .DeepEqual (in .Variables , & MachinePoolVariables {}) {
792
+ in .Variables = nil
793
+ }
757
794
}
758
795
759
796
func spokeMachineHealthCheckClass (in * MachineHealthCheckClass , c randfill.Continue ) {
@@ -790,6 +827,23 @@ func spokeMachineDeploymentClass(in *MachineDeploymentClass, c randfill.Continue
790
827
if in .NodeDeletionTimeout != nil {
791
828
in .NodeDeletionTimeout = ptr.To [metav1.Duration ](metav1.Duration {Duration : time .Duration (c .Int31 ()) * time .Second })
792
829
}
830
+ if in .Strategy != nil {
831
+ if in .Strategy .RollingUpdate != nil {
832
+ if in .Strategy .RollingUpdate .DeletePolicy != nil && * in .Strategy .RollingUpdate .DeletePolicy == "" {
833
+ // &"" Is not a valid value for DeletePolicy as the enum validation enforces an enum value if DeletePolicy is set.
834
+ in .Strategy .RollingUpdate .DeletePolicy = nil
835
+ }
836
+ if reflect .DeepEqual (in .Strategy .RollingUpdate , & MachineRollingUpdateDeployment {}) {
837
+ in .Strategy .RollingUpdate = nil
838
+ }
839
+ }
840
+ if in .Strategy .Remediation != nil && reflect .DeepEqual (in .Strategy .Remediation , & RemediationStrategy {}) {
841
+ in .Strategy .Remediation = nil
842
+ }
843
+ if reflect .DeepEqual (in .Strategy , & MachineDeploymentStrategy {}) {
844
+ in .Strategy = nil
845
+ }
846
+ }
793
847
}
794
848
795
849
func spokeMachinePoolClass (in * MachinePoolClass , c randfill.Continue ) {
0 commit comments