Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions pkg/runtime/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ const (
// resource if the CARM cache is not synced yet, or if the roleARN is not
// available.
roleARNNotAvailableRequeueDelay = 15 * time.Second
// adoptOrCreate is an annotation field that decides whether to create the
// resource if it doesn't exist, or adopt the resource if it exists.
// value comes from getAdoptionPolicy
// adoptOrCreate = "adopt-or-create"
)

// reconciler describes a generic reconciler within ACK.
Expand Down Expand Up @@ -880,7 +876,14 @@ func (r *resourceReconciler) patchResourceMetadataAndSpec(
rlog.Enter("kc.Patch (metadata + spec)")
lorig := latestCleaned.DeepCopy()
patch := client.MergeFrom(desiredCleaned.RuntimeObject())
err = r.kc.Patch(ctx, latestCleaned.RuntimeObject(), patch)

// NOTE (rushmash91): Always use WithoutCancel to prevent patch operations from being
// cancelled while preserving context values. The 30s SIGTERM grace period acts as
// the effective timeout - no additional timeout needed to avoid interfering with
// normal Kubernetes client timeout/retry strategy.
patchCtx := context.WithoutCancel(ctx)
err = r.kc.Patch(patchCtx, latestCleaned.RuntimeObject(), patch)

if err == nil {
if rlog.IsDebugEnabled() {
js := getPatchDocument(patch, lorig.RuntimeObject())
Expand Down Expand Up @@ -916,7 +919,14 @@ func (r *resourceReconciler) patchResourceStatus(
dobj := desired.DeepCopy().RuntimeObject()
lobj := latest.DeepCopy().RuntimeObject()
patch := client.MergeFrom(dobj)
err = r.kc.Status().Patch(ctx, lobj, patch)

// NOTE (rushmash91): Always use WithoutCancel to prevent patch operations from being
// cancelled while preserving context values. The 30s SIGTERM grace period acts as
// the effective timeout - no additional timeout needed to avoid interfering with
// normal Kubernetes client timeout/retry strategy.
patchCtx := context.WithoutCancel(ctx)
err = r.kc.Status().Patch(patchCtx, lobj, patch)

if err == nil {
if rlog.IsDebugEnabled() {
js := getPatchDocument(patch, lobj)
Expand Down