Skip to content

Commit

Permalink
update coredns to execute a rollout when no patch is required. (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryehowell committed Jan 29, 2024
1 parent 4479166 commit e040659
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion eks/coredns.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
}
Expand Down

0 comments on commit e040659

Please sign in to comment.