Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use patch when updating the statuses of resources. #544

Closed
HoustonPutman opened this issue Apr 5, 2023 · 0 comments · Fixed by #545
Closed

Use patch when updating the statuses of resources. #544

HoustonPutman opened this issue Apr 5, 2023 · 0 comments · Fixed by #545
Labels
controller operations Dealing with the reconcile-loop and other internal aspects of the various Solr operator controllers
Milestone

Comments

@HoustonPutman
Copy link
Contributor

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/controller-runtime@v0.14.2/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/controller-runtime@v0.14.2/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/controller-runtime@v0.14.2/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.

@HoustonPutman HoustonPutman added the controller operations Dealing with the reconcile-loop and other internal aspects of the various Solr operator controllers label Apr 5, 2023
@HoustonPutman HoustonPutman added this to the main (v0.7.0) milestone Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
controller operations Dealing with the reconcile-loop and other internal aspects of the various Solr operator controllers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant