@@ -28,6 +28,7 @@ import (
28
28
"strings"
29
29
"time"
30
30
31
+ "github.com/blang/semver/v4"
31
32
. "github.com/onsi/ginkgo/v2"
32
33
. "github.com/onsi/gomega"
33
34
coordinationv1 "k8s.io/api/coordination/v1"
@@ -726,15 +727,28 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg
726
727
verifyV1Beta2ConditionsTrueV1Beta1 (ctx , managementClusterProxy .GetClient (), workloadCluster .Name , workloadCluster .Namespace ,
727
728
[]string {clusterv1 .AvailableV1Beta2Condition , clusterv1 .ReadyV1Beta2Condition })
728
729
729
- Byf ("[%d] Verify client-side SSA still works" , i )
730
- clusterUpdate := & unstructured.Unstructured {}
731
- clusterUpdate .SetGroupVersionKind (clusterv1beta1 .GroupVersion .WithKind ("Cluster" ))
732
- clusterUpdate .SetNamespace (workloadCluster .Namespace )
733
- clusterUpdate .SetName (workloadCluster .Name )
734
- clusterUpdate .SetLabels (map [string ]string {
735
- fmt .Sprintf ("test-label-upgrade-%d" , i ): "test-label-value" ,
736
- })
737
- err = managementClusterProxy .GetClient ().Patch (ctx , clusterUpdate , client .Apply , client .FieldOwner ("e2e-test-client" ))
730
+ // Note: It is a known issue on Kubernetes < v1.29 that SSA sometimes fail:
731
+ // https://github.com/kubernetes/kubernetes/issues/117356
732
+ tries := 1
733
+ initKubernetesVersionParsed , err := semver .ParseTolerant (initKubernetesVersion )
734
+ Expect (err ).ToNot (HaveOccurred ())
735
+ if initKubernetesVersionParsed .LT (semver .MustParse ("1.29.0" )) {
736
+ tries = 10
737
+ }
738
+ for range tries {
739
+ Byf ("[%d] Verify client-side SSA still works" , i )
740
+ clusterUpdate := & unstructured.Unstructured {}
741
+ clusterUpdate .SetGroupVersionKind (clusterv1beta1 .GroupVersion .WithKind ("Cluster" ))
742
+ clusterUpdate .SetNamespace (workloadCluster .Namespace )
743
+ clusterUpdate .SetName (workloadCluster .Name )
744
+ clusterUpdate .SetLabels (map [string ]string {
745
+ fmt .Sprintf ("test-label-upgrade-%d" , i ): "test-label-value" ,
746
+ })
747
+ err = managementClusterProxy .GetClient ().Patch (ctx , clusterUpdate , client .Apply , client .FieldOwner ("e2e-test-client" ))
748
+ if err == nil {
749
+ break
750
+ }
751
+ }
738
752
Expect (err ).ToNot (HaveOccurred ())
739
753
740
754
Byf ("[%d] THE UPGRADED MANAGEMENT CLUSTER WORKS!" , i )
0 commit comments