File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import (
20
20
"context"
21
21
"net"
22
22
"strings"
23
+ "time"
23
24
24
25
"github.com/container-storage-interface/spec/lib/go/csi"
25
26
"google.golang.org/grpc"
@@ -129,10 +130,7 @@ func (d *Driver) Run() error {
129
130
130
131
// Remove taint from node to indicate driver startup success
131
132
// This is done at the last possible moment to prevent race conditions or false positive removals
132
- err = removeNotReadyTaint (cloud .DefaultKubernetesAPIClient )
133
- if err != nil {
134
- klog .ErrorS (err , "Unexpected failure when attempting to remove node taint(s)" )
135
- }
133
+ go tryRemoveNotReadyTaintUntilSucceed (cloud .DefaultKubernetesAPIClient , time .Second )
136
134
137
135
klog .Infof ("Listening for connections on address: %#v" , listener .Addr ())
138
136
return d .srv .Serve (listener )
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import (
25
25
"path/filepath"
26
26
"strconv"
27
27
"strings"
28
+ "time"
28
29
29
30
"github.com/container-storage-interface/spec/lib/go/csi"
30
31
"github.com/kubernetes-sigs/aws-efs-csi-driver/pkg/cloud"
@@ -452,7 +453,7 @@ type JSONPatch struct {
452
453
Value interface {} `json:"value"`
453
454
}
454
455
455
- // removeNotReadyTaint removes the taint ebs .csi.aws.com/agent-not-ready from the local node
456
+ // removeNotReadyTaint removes the taint efs .csi.aws.com/agent-not-ready from the local node
456
457
// This taint can be optionally applied by users to prevent startup race conditions such as
457
458
// https://github.com/kubernetes/kubernetes/issues/95911
458
459
func removeNotReadyTaint (k8sClient cloud.KubernetesAPIClient ) error {
@@ -512,3 +513,16 @@ func removeNotReadyTaint(k8sClient cloud.KubernetesAPIClient) error {
512
513
klog .InfoS ("Removed taint(s) from local node" , "node" , nodeName )
513
514
return nil
514
515
}
516
+
517
+ // remove taint may failed, this keep retring until succeed, make sure the taint will eventually being removed
518
+ func tryRemoveNotReadyTaintUntilSucceed (k8sClient cloud.KubernetesAPIClient , interval time.Duration ) {
519
+ for {
520
+ err := removeNotReadyTaint (k8sClient )
521
+ if err == nil {
522
+ return
523
+ }
524
+
525
+ klog .ErrorS (err , "Unexpected failure when attempting to remove node taint(s)" )
526
+ time .Sleep (interval )
527
+ }
528
+ }
You can’t perform that action at this time.
0 commit comments