@@ -22,6 +22,7 @@ import (
2222 pkgconstant "github.com/spidernet-io/spiderpool/pkg/constant"
2323 spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1"
2424 "github.com/spidernet-io/spiderpool/pkg/types"
25+ "github.com/spidernet-io/spiderpool/pkg/utils/retry"
2526 "github.com/spidernet-io/spiderpool/test/e2e/common"
2627 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2728)
@@ -432,7 +433,10 @@ var _ = Describe("test annotation", Label("annotation"), func() {
432433 GinkgoWriter .Printf ("Generate namespace objects: %v with namespace annotations \n " , namespaceObject )
433434
434435 // Update the namespace with the generated namespace object with annotation
435- Expect (frame .UpdateResource (namespaceObject )).NotTo (HaveOccurred ())
436+ err = retry .RetryOnConflictWithContext (context .Background (), retry .DefaultBackoff , func (ctx context.Context ) error {
437+ return frame .UpdateResource (namespaceObject )
438+ })
439+ Expect (err ).NotTo (HaveOccurred ())
436440 GinkgoWriter .Printf ("Succeeded to update namespace: %v object \n " , nsName )
437441 })
438442
@@ -1036,7 +1040,11 @@ var _ = Describe("test annotation", Label("annotation"), func() {
10361040 if frame .Info .IpV6Enabled {
10371041 newSpiderMultusConfig .Spec .MacvlanConfig .SpiderpoolConfigPools .IPv6IPPool = []string {v6PoolName1 }
10381042 }
1039- Expect (frame .UpdateResource (newSpiderMultusConfig )).NotTo (HaveOccurred ())
1043+
1044+ err = retry .RetryOnConflictWithContext (context .Background (), retry .DefaultBackoff , func (ctx context.Context ) error {
1045+ return frame .UpdateResource (newSpiderMultusConfig )
1046+ })
1047+ Expect (err ).NotTo (HaveOccurred ())
10401048 Eventually (func () bool {
10411049 _ , err := frame .GetSpiderMultusInstance (nsName , spiderMultusNadName )
10421050 return ! errors .IsNotFound (err )
@@ -1157,7 +1165,11 @@ var _ = Describe("test annotation", Label("annotation"), func() {
11571165 common .MultusDefaultNetwork : fmt .Sprintf ("%s/%s" , common .MultusNs , common .MacvlanUnderlayVlan0 ),
11581166 common .MultusNetworks : fmt .Sprintf ("%s/%s" , common .MultusNs , common .MacvlanVlan100 ),
11591167 }
1160- Expect (frame .UpdateResource (stsObj )).NotTo (HaveOccurred ())
1168+
1169+ err = retry .RetryOnConflictWithContext (context .Background (), retry .DefaultBackoff , func (ctx context.Context ) error {
1170+ return frame .UpdateResource (stsObj )
1171+ })
1172+ Expect (err ).NotTo (HaveOccurred ())
11611173
11621174 // 5.After the corresponding NIC's IP pool is changed, the IP of the stateful application can also be updated.
11631175 newPodList := & corev1.PodList {}
0 commit comments