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

Log info for service not found error when reconciling associations #5533

Conversation

thbkrkr
Copy link
Contributor

@thbkrkr thbkrkr commented Mar 29, 2022

When two associated Elastic resources are created, we log a few Service not found error from the association controller because the main controller of the resource haven't had time to create the service yet.

This commit makes error logging smarter by waiting an arbitrary 5 seconds delay after the resource is created to consider it worth logging the Service not found error. This commit logs the error at the info level instead of the error level.

Example of a Service not found error that is repeatedly logged during creation:

2022-03-29T16:39:12.572+0200    ERROR   manager.eck-operator.controller.kb-es-association-controller    Reconciler error
{
    "service.version": "2.2.0-SNAPSHOT+c6de2cfd",
    "name": "self-mon-x",
    "namespace": "default",
    "error": "while fetching referenced service: Service \"self-mon-x-es-http\" not found",
    "errorCauses": [
        {
            "error": "while fetching referenced service: Service \"self-mon-x-es-http\" not found"
        }
    ]
}
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
        /home/thb/dev/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.1/pkg/internal/controller/controller.go:266
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
        /home/thb/dev/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.1/pkg/internal/controller/controller.go:227

@thbkrkr thbkrkr added the >enhancement Enhancement of existing functionality label Mar 29, 2022
@thbkrkr thbkrkr added the v2.2.0 label Mar 29, 2022
@thbkrkr thbkrkr force-pushed the be-smarter-to-log-service-not-found-err-in-assoc-controller branch from 9ff8ba1 to ff53779 Compare March 29, 2022 18:26
@thbkrkr thbkrkr removed the v2.2.0 label Apr 6, 2022
Copy link
Contributor

@barkbay barkbay left a comment

Choose a reason for hiding this comment

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

LGTM

@thbkrkr thbkrkr changed the title Smarter logging for service not found error when reconciling associations Log info for service not found error when reconciling associations Apr 13, 2022
@thbkrkr thbkrkr merged commit e15d93f into elastic:main Apr 13, 2022
@thbkrkr thbkrkr added the v2.3.0 label Apr 13, 2022
@thbkrkr thbkrkr deleted the be-smarter-to-log-service-not-found-err-in-assoc-controller branch May 17, 2022 09:50
fantapsody pushed a commit to fantapsody/cloud-on-k8s that referenced this pull request Feb 7, 2023
…lastic#5533)

Logs at info level `Service not found` error raised from the association controller that occurs when the resource controller has not yet had time to create the service.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality v2.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants