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

fix: should ignore create errors when namespace terminating #133

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

erikgb
Copy link
Contributor

@erikgb erikgb commented Jun 8, 2024

This is fixing a log-spam issue in busy clusters. Accurate should just ignore namespace terminating errors on create. If not, the logs are filled with annoying errors like this (example):

{"level":"error","ts":"2024-06-04T11:22:32Z","msg":"failed to handle deleted object","controller":"rolebinding","controllerGroup":"rbac.authorization.k8s.io","controllerKind":"RoleBinding","RoleBinding":{"name":"gitops-admins","namespace":"strm-rev-r-5d7d3652a0"},"namespace":"strm-rev-r-5d7d3652a0","name":"gitops-admins","reconcileID":"f5ab2512-5558-4d2b-92e0-cba652a84eca","error":"failed to re-create strm-rev-r-5d7d3652a0/gitops-admins: rolebindings.rbac.authorization.k8s.io \"gitops-admins\" is forbidden: unable to create new content in namespace strm-rev-r-5d7d3652a0 because it is being terminated","stacktrace":"github.com/cybozu-go/accurate/controllers.(*PropagateController).Reconcile\n\t/work/controllers/propagate.go:90\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:119\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/go/pkg/mod/sigs.k8s...

I created a simple helper to make this code a bit more readable. Hope you like it! It might be possible to make further improvements with even more consistent error handling.

@susumu-sono susumu-sono requested a review from zoetrope June 10, 2024 01:08
Copy link
Member

@zoetrope zoetrope left a comment

Choose a reason for hiding this comment

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

LGTM!

@zoetrope zoetrope merged commit c0f7908 into cybozu-go:main Jun 10, 2024
7 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.

2 participants