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

Errors can occur during CR status update #41

Closed
phlg opened this issue Feb 29, 2024 · 0 comments · Fixed by #42
Closed

Errors can occur during CR status update #41

phlg opened this issue Feb 29, 2024 · 0 comments · Fixed by #42

Comments

@phlg
Copy link
Contributor

phlg commented Feb 29, 2024

In v0.8.0 on the operator, the reconcile loop can generate some errors when trying to update the status of a resource. Due to requeuing, the operator eventually reaches green status, but the error itself is jarring. Example for a policy :

2024-02-29T14:28:04.452Z  INFO  s3Client  retrieving policy info  {"policy": "dummy-policy"}
2024-02-29T14:28:04.477Z  INFO  s3Client  the policy does not exist {"policy": "dummy-policy"}
2024-02-29T14:28:04.477Z  INFO  s3Client  create or update policy {"policy": "dummy-policy"}
2024-02-29T14:28:04.541Z  INFO  s3Client  retrieving policy info  {"policy": "dummy-policy"}
2024-02-29T14:28:04.541Z  INFO  policyEventFilter reconcile update event is filtered out  {"resource": "policy-dummy-policy"}
2024-02-29T14:28:04.550Z  INFO  s3Client  create or update policy {"policy": "dummy-policy"}
2024-02-29T14:28:04.581Z  ERROR an error occurred while updating the status of the policy resource  {"controller": "policy", "controllerGroup": "s3.onyxia.sh", "controllerKind": "Policy", "Policy": {"name":"policy-dummy-policy","namespace":"s3-resources"}, "namespace": "s3-resources", "name": "policy-dummy-policy", "reconcileID": "xxx", "error": "Operation cannot be fulfilled on policies.s3.onyxia.sh \"policy-dummy-policy\": the object has been modified; please apply your changes to the latest version and try again"}
github.com/InseeFrLab/s3-operator/controllers.(*PolicyReconciler).SetPolicyStatusConditionAndUpdate
  /workspace/controllers/policy_controller.go:274
github.com/InseeFrLab/s3-operator/controllers.(*PolicyReconciler).Reconcile
  /workspace/controllers/policy_controller.go:171
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile
  /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:119
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
  /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:316
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
  /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:266
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
  /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:227
2024-02-29T14:28:04.582Z  ERROR Reconciler error  {"controller": "policy", "controllerGroup": "s3.onyxia.sh", "controllerKind": "Policy", "Policy": {"name":"policy-dummy-policy","namespace":"s3-resources"}, "namespace": "s3-resources", "name": "policy-dummy-policy", "reconcileID": "e0cd9979-c85f-4534-bad8-80f31926b7bc", "error": "Operation cannot be fulfilled on policies.s3.onyxia.sh \"policy-dummy-policy\": the object has been modified; please apply your changes to the latest version and try again", "errorCauses": [{"error": "Operation cannot be fulfilled on policies.s3.onyxia.sh \"policy-dummy-policy\": 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
  /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:329
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
  /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:266
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
  /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:227
2024-02-29T14:28:04.587Z  INFO  s3Client  retrieving policy info  {"policy": "dummy-policy"}
2024-02-29T14:28:04.609Z  INFO  policyEventFilter reconcile update event is filtered out  {"resource": "policy-dummy-policy"}

This is most likely due to a poorly implemented change in the EventFilter logic in #40. In which case, the fix could be either to :

  • change that EventFilter (maybe finding a way to use lastTransitionTime after all ?)
  • change the reconcile loop to avoid these failures with the new EventFilter, if it's considered sane enough (of which I am pretty much unsure)
@phlg phlg closed this as completed in #42 Mar 6, 2024
phlg added a commit that referenced this issue Mar 6, 2024
…, and path finalize (#42)

* fix(path): added error if no bucket found

* fix: various fixes

- rollback event filter changes
- reimpl. of Set*StatusConditionAndUpdate functions (w/ new utils.go)
- unify loggers in reconcile loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant