From e040659b70414acdc40d72063480dc44f98a8864 Mon Sep 17 00:00:00 2001 From: Ryan Howell <86266251+ryehowell@users.noreply.github.com> Date: Mon, 29 Jan 2024 10:26:34 -0500 Subject: [PATCH] update coredns to execute a rollout when no patch is required. (#224) --- eks/coredns.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/eks/coredns.go b/eks/coredns.go index 1db23d1..7d8ae96 100644 --- a/eks/coredns.go +++ b/eks/coredns.go @@ -56,7 +56,8 @@ func ScheduleCoredns( return errors.WithStackTrace(err) } - // Only attempt to patch coredns deployment if the compute-type annotation is present. Else skip. + // Only attempt to patch coredns deployment if the compute-type annotation is present. + // Else trigger a update by executing a rollout. This is necessary for coredns to schedule. if strings.Contains(out, "compute-type") { err = kubectl.RunKubectl( kubectlOptions, @@ -66,6 +67,15 @@ func ScheduleCoredns( "--patch", `[{"op": "remove","path": "/spec/template/metadata/annotations/eks.amazonaws.com~1compute-type"}]`, ) + if err != nil { + return errors.WithStackTrace(err) + } + } else { + err = kubectl.RunKubectl( + kubectlOptions, + "rollout", "restart", "coredns", "-n", "kube-system", + ) + if err != nil { return errors.WithStackTrace(err) }