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

handle conflict error in instrumentation config updates #1737

Merged
merged 10 commits into from
Nov 21, 2024

Conversation

RonFed
Copy link
Contributor

@RonFed RonFed commented Nov 12, 2024

A typical error we see when trying to update the instrumentation config CR is:

2024-11-12T08:43:28Z ERROR error updating instrumentation config {"controller": "instrumentor-instrumentationconfig-instrumentedapplication", "controllerGroup": "odigos.io", "controllerKind": "InstrumentedApplication", "InstrumentedApplication": {"name":"deployment-pricing","namespace":"simple-demo19"}, "namespace": "simple-demo19", "name": "deployment-pricing", "reconcileID": "8c980fc2-ead9-47c7-b2ac-69be6e880002", "workload": "deployment-pricing", "error": "Operation cannot be fulfilled on instrumentationconfigs.odigos.io "deployment-pricing": the object has been modified; please apply your changes to the latest version and try again"}

This is due to the Get and Update pattern we use. Following #1710 , use the update error util for this case as well.
Adding to the error handling util - a check for IsNotFound error and ignoring it.

@RonFed RonFed requested a review from blumamir November 12, 2024 08:59
@@ -55,19 +56,18 @@ func (r *InstrumentedApplicationReconciler) Reconcile(ctx context.Context, req c

instrumentationRules := &odigosv1.InstrumentationRuleList{}
err = r.Client.List(ctx, instrumentationRules)
if client.IgnoreNotFound(err) != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can a list operation return not found? or is it only for safety?

If it's not found, don't we want to return and not cause any updates?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thich check is for errors which are not NotFound

k8sutils/pkg/utils/retryonconflict.go Show resolved Hide resolved
@alonkeyval alonkeyval merged commit a186faf into odigos-io:main Nov 21, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants