Skip to content

Controller fails to resolve conflicts on owned resources as it does not force patch them #140

@f4z3r

Description

@f4z3r

When updating the resources owned by the controller that are downstream of the WasmCloudHostConfig, the operator fails to reconcile them due to fields not being owned by the controller. This results in a reconcile hot-loop in the operator due to 409 responses from Kubernetes:

2025-09-15T08:18:33.596730Z  INFO reconciling object{object.ref=WasmCloudHostConfig.v1alpha1.k8s.wasmcloud.dev/my-wasmcloud-cluster.default object.reason=error policy requested retry}: controller::controller: Reconciling WasmCloudHostConfig "my-wasmcloud-cluster" in default
2025-09-15T08:18:33.608768Z  WARN reconciling object{object.ref=WasmCloudHostConfig.v1alpha1.k8s.wasmcloud.dev/my-wasmcloud-cluster.default object.reason=error policy requested retry}: controller::controller: Failed to configure deployment: Kube Error: ApiError: Apply failed with 1 conflict: conflict with "kubectl-edit" using apps/v1: .spec.replicas: Conflict (ErrorResponse { status: "Failure", message: "Apply failed with 1 conflict: conflict with \"kubectl-edit\" using apps/v1: .spec.replicas", reason: "Conflict", code: 409 })
2025-09-15T08:18:33.608849Z  WARN controller::controller: reconcile failed: reconciler for object WasmCloudHostConfig.v1alpha1.k8s.wasmcloud.dev/my-wasmcloud-cluster.default failed

According to official documentation from Kubernetes, controllers using a server-side apply should always force patch updates to downstream resources unless they are explicitly able to resolve conflicts (which is rarely the case): https://kubernetes.io/docs/reference/using-api/server-side-apply/#using-server-side-apply-in-a-controller

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