Skip to content

Commit e566be3

Browse files
committed
Do not restart VPC CNI DaemonSet pods
1 parent a7d1dc8 commit e566be3

File tree

1 file changed

+1
-48
lines changed

1 file changed

+1
-48
lines changed

pkg/eks/tasks.go

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"fmt"
66
"strings"
7-
"time"
87

98
"github.com/aws/aws-sdk-go-v2/aws"
109
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs"
@@ -16,10 +15,7 @@ import (
1615

1716
"github.com/kris-nova/logger"
1817
"github.com/pkg/errors"
19-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
20-
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
21-
"k8s.io/apimachinery/pkg/runtime"
22-
"k8s.io/apimachinery/pkg/types"
18+
2319
"k8s.io/apimachinery/pkg/util/sets"
2420

2521
"github.com/weaveworks/eksctl/pkg/actions/irsa"
@@ -184,43 +180,6 @@ func newEFADevicePluginTask(
184180
return &t
185181
}
186182

187-
type restartDaemonsetTask struct {
188-
name string
189-
namespace string
190-
clusterProvider *ClusterProvider
191-
spec *api.ClusterConfig
192-
}
193-
194-
func (t *restartDaemonsetTask) Describe() string {
195-
return fmt.Sprintf(`restart daemonset "%s/%s"`, t.namespace, t.name)
196-
}
197-
198-
func (t *restartDaemonsetTask) Do(errCh chan error) error {
199-
defer close(errCh)
200-
clientSet, err := t.clusterProvider.NewStdClientSet(t.spec)
201-
if err != nil {
202-
return err
203-
}
204-
ds := clientSet.AppsV1().DaemonSets(t.namespace)
205-
dep, err := ds.Get(context.TODO(), t.name, metav1.GetOptions{})
206-
if err != nil {
207-
return err
208-
}
209-
if dep.Spec.Template.Annotations == nil {
210-
dep.Spec.Template.Annotations = make(map[string]string)
211-
}
212-
dep.Spec.Template.Annotations["eksctl.io/restartedAt"] = time.Now().Format(time.RFC3339)
213-
bytes, err := runtime.Encode(unstructured.UnstructuredJSONScheme, dep)
214-
if err != nil {
215-
return errors.Wrapf(err, "failed to marshal %q deployment", t.name)
216-
}
217-
if _, err := ds.Patch(context.TODO(), t.name, types.MergePatchType, bytes, metav1.PatchOptions{}); err != nil {
218-
return errors.Wrap(err, "failed to patch deployment")
219-
}
220-
logger.Info(`daemonset "%s/%s" restarted`, t.namespace, t.name)
221-
return nil
222-
}
223-
224183
// CreateExtraClusterConfigTasks returns all tasks for updating cluster configuration
225184
func (c *ClusterProvider) CreateExtraClusterConfigTasks(ctx context.Context, cfg *api.ClusterConfig) *tasks.TaskTree {
226185
newTasks := &tasks.TaskTree{
@@ -464,10 +423,4 @@ func (c *ClusterProvider) appendCreateTasksForIAMServiceAccounts(ctx context.Con
464423
)
465424
newTasks.IsSubTask = true
466425
tasks.Append(newTasks)
467-
tasks.Append(&restartDaemonsetTask{
468-
namespace: "kube-system",
469-
name: "aws-node",
470-
clusterProvider: c,
471-
spec: cfg,
472-
})
473426
}

0 commit comments

Comments
 (0)