You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then controller will assume that any ServiceMonitor resource which has a matching name to the Thanos resource is owned by the controller. This causes a ServiceMonitor with the name foo-compactor to be deleted if there is a Thanos resource in the same namespace with the name foo.
Steps to reproduce the issue:
Create a Thanos resource with the name foo whit a compactor configuration. The important thing is that it does not have any monitor configuration for the compactor. Create a ServiceMonitor in the same namespace with the name foo-compactor. Wait until the controller reconciles the Thanos resource and deletes the ServiceMonitor.
Expected behavior
The service monitor created outside of the controller should never be modified or deleted by the controller as it is not the owner of the resource.
Screenshots
N/A
Additional context
I think the reason this is occurring is because of this logic. It basically assumes that if there is no service monitor configuration it should delete any service monitor with a given name, even if the operator has not created the service monitor.
I have seen this behavior as well. It happens with any object you create on your own that matches a name the operator thinks it manages. IMO the operator should look at a managed-by label as well as the name.
Describe the bug
Then controller will assume that any
ServiceMonitor
resource which has a matching name to theThanos
resource is owned by the controller. This causes aServiceMonitor
with the namefoo-compactor
to be deleted if there is aThanos
resource in the same namespace with the namefoo
.Steps to reproduce the issue:
Create a
Thanos
resource with the namefoo
whit a compactor configuration. The important thing is that it does not have any monitor configuration for the compactor. Create aServiceMonitor
in the same namespace with the namefoo-compactor
. Wait until the controller reconciles theThanos
resource and deletes theServiceMonitor
.Expected behavior
The service monitor created outside of the controller should never be modified or deleted by the controller as it is not the owner of the resource.
Screenshots
N/A
Additional context
I think the reason this is occurring is because of this logic. It basically assumes that if there is no service monitor configuration it should delete any service monitor with a given name, even if the operator has not created the service monitor.
thanos-operator/pkg/resources/compactor/servicemonitor.go
Lines 53 to 56 in 1bd4c3c
The text was updated successfully, but these errors were encountered: