st-tech / gatling-operator

Automating distributed Gatling load testing using Kubernetes operator
MIT License
68 stars 21 forks source link

Feature request: Don't output errors when deleting Gatling resources. #14

Closed ksudate closed 2 years ago

ksudate commented 2 years ago

Manually deleting a Gatling resource will output an error.

2021-11-29T09:55:01.990Z        ERROR   controller-runtime.manager.controller.gatling.gatling.Reconcile Unable to fetch Gatling, thus no longer requeue {"reconciler group": "gatling-operator.tech.zozo.com", "reconciler kind": "Gatling", "name": "gatling-sample01", "namespace": "default", "error": "Gatling.gatling-operator.tech.zozo.com \"gatling-sample01\" not found"}
github.com/go-logr/zapr.(*zapLogger).Error
        /go/pkg/mod/github.com/go-logr/zapr@v0.2.0/zapr.go:132
github.com/st-tech/gatling-operator/controllers.(*GatlingReconciler).Reconcile
        /workspace/controllers/gatling_controller.go:71
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
        /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.8.3/pkg/internal/controller/controller.go:298
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
        /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.8.3/pkg/internal/controller/controller.go:253
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1.2
        /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.8.3/pkg/internal/controller/controller.go:216
k8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext.func1
        /go/pkg/mod/k8s.io/apimachinery@v0.20.2/pkg/util/wait/wait.go:185
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1
        /go/pkg/mod/k8s.io/apimachinery@v0.20.2/pkg/util/wait/wait.go:155
k8s.io/apimachinery/pkg/util/wait.BackoffUntil
        /go/pkg/mod/k8s.io/apimachinery@v0.20.2/pkg/util/wait/wait.go:156
k8s.io/apimachinery/pkg/util/wait.JitterUntil
        /go/pkg/mod/k8s.io/apimachinery@v0.20.2/pkg/util/wait/wait.go:133
k8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext
        /go/pkg/mod/k8s.io/apimachinery@v0.20.2/pkg/util/wait/wait.go:185
k8s.io/apimachinery/pkg/util/wait.UntilWithContext
        /go/pkg/mod/k8s.io/apimachinery@v0.20.2/pkg/util/wait/wait.go:99

This error occurs when a gatling resource is deleted and Reconcile detects the event and executes it, but the gatling resource does not already exist, resulting in an error at L70. https://github.com/st-tech/gatling-operator/blob/194ad16069b18396ec9a735d8e7eb7af8ba1e09e/controllers/gatling_controller.go#L70

yokawasa commented 2 years ago

@tmrekk121 it looks to me an expected behavior. Do you think it better not to print error message??

From the issue title, I understand that you want it not to print error message 😄 To understand more, you don't want to output error message only when the operator can't not find the resource? (in other words, it's ok to output error message when the operator can't fetch the resource for the other reason) Correct?

yokawasa commented 2 years ago

@tmrekk121 Again, to me, this is an expected behavior. Can you clarify the issue, and what's an expected behavior?

yokawasa commented 2 years ago

I guess Not to have error messages from the Gatling operator is a goal on this issue. So my approach is to suppress delete events as we don't take any action in the reconciliation loop when invoked after the gatlingv1alpha1.Gatling is actually deleted