Skip to content

Use patch when updating the statuses of resources. #544

@HoustonPutman

Description

@HoustonPutman

Currently the most confusing logging for users is:

2023-04-05T10:27:56-04:00	ERROR	Reconciler error	{"controller": "solrcloud", "controllerGroup": "solr.apache.org", "controllerKind": "SolrCloud", "SolrCloud": {"name":"foo","namespace":"default"}, "namespace": "default", "name": "foo", "reconcileID": "87f9ba03-d059-499b-835c-bf94117edf6e", "error": "Operation cannot be fulfilled on solrclouds.solr.apache.org \"foo\": the object has been modified; please apply your changes to the latest version and try again"}
  sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
  	/Users/houstonputman/dev/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:329
  sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
  	/Users/houstonputman/dev/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:274
  sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
  	/Users/houstonputman/dev/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:235

This occurs when we try to update the SolrCloud status at the end of the reconcile loop.
Since we already have the before state and the after state, it should be easy to change this from an "Update" to a "Patch", which will make this error go away.

We do need to ensure that all fields have the correct annotations so that patching works as expected.
These annotations can be found here: https://book.kubebuilder.io/reference/markers/crd-validation.html

Note: while eventually we want these annotations to be correct across the whole of the CRD, this ticket only requires that they be correct for the status SubResources.

Metadata

Metadata

Assignees

No one assigned

    Labels

    controller operationsDealing with the reconcile-loop and other internal aspects of the various Solr operator controllers

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions