Skip to content

Conflict errors during updates should not be propagated to controller-runtime: allow customizing which errors to ignore/requeue #663

@pmalek

Description

@pmalek

Problem statement

When controllers try to update resources in cluster users see errors like the one below when the object in cache is not up to date and the update causes a conflict:

{
	"level": "error",
	"ts": "2025-11-29T12:10:20.594+0100",
	"logger": "APIGateway",
	"msg": "unable to update status",
	"controller": "apigateway",
	"controllerGroup": "gateway-operator.konghq.com",
	"controllerKind": "APIGateway",
	"APIGateway": {
		"name": "apigateway-1",
		"namespace": "default"
	},
	"namespace": "default",
	"name": "apigateway-1",
	"reconcileID": "520b8d74-3196-452f-8891-4cd65fdd0166",
	"resourceType": "gateway-operator.konghq.com/v1alpha1, Kind=APIGateway",
	"error": "Operation cannot be fulfilled on apigateways.gateway-operator.konghq.com \"apigateway-1\": the object has been modified; please apply your changes to the latest version and try again",
	"stacktrace": "reconciler.io/runtime/reconcilers.(*ResourceReconciler[...]).reconcileOuter
    /Users/USER/.gvm/pkgsets/go1.25.3/global/pkg/mod/reconciler.io/runtime@v0.24.1/reconcilers/resource.go:379\nreconciler.io/runtime/reconcilers.(*ResourceReconciler[...]).Reconcile
    /Users/USER/.gvm/pkgsets/go1.25.3/global/pkg/mod/reconciler.io/runtime@v0.24.1/reconcilers/resource.go:302\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Reconcile
    /Users/USER/.gvm/pkgsets/go1.25.3/global/pkg/mod/sigs.k8s.io/controller-runtime@v0.22.4/pkg/internal/controller/controller.go:216\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).reconcileHandler
    /Users/USER/.gvm/pkgsets/go1.25.3/global/pkg/mod/sigs.k8s.io/controller-runtime@v0.22.4/pkg/internal/controller/controller.go:461\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).processNextWorkItem
    /Users/USER/.gvm/pkgsets/go1.25.3/global/pkg/mod/sigs.k8s.io/controller-runtime@v0.22.4/pkg/internal/controller/controller.go:421\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Start.func1.1
    /Users/USER/.gvm/pkgsets/go1.25.3/global/pkg/mod/sigs.k8s.io/controller-runtime@v0.22.4/pkg/internal/controller/controller.go:296"
}

These types of errors should not be user facing and controllers should be able to requeue the request and retry if there's a conflict.

Proposed solution

  • Allow customization of ignored error types/values/matching with provided predicate functions
    • k8s.io/apimachinery provides a lot of predicate functions for matching errors types like e.g. IsConflict
  • Just change the update error handling to not propagate the error on conflicts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions