fix: check config patch creation time as well as updated on orphan check
Some checks failed
default / default (push) Has been cancelled
default / e2e-backups (push) Has been cancelled
default / e2e-forced-removal (push) Has been cancelled
default / e2e-scaling (push) Has been cancelled
default / e2e-short (push) Has been cancelled
default / e2e-short-secureboot (push) Has been cancelled
default / e2e-templates (push) Has been cancelled
default / e2e-upgrades (push) Has been cancelled
default / e2e-workload-proxy (push) Has been cancelled

In the config patch cleanup controller, we falsely assumed that the resource update time was set to be the same as the creation time.

This in very rare cases caused the cleanup controller started by the runtime in the tests to prune the config patch created by the test itself, failing it sporadically.

This should fix the rare test flake we have:

```text
#66 4.431     grpc_test.go:266:
#66 4.431         	Error Trace:	/src/internal/backend/grpc/grpc_test.go:266
#66 4.431         	Error:      	Received unexpected error:
#66 4.431         	            	rpc error: code = NotFound desc = resource ConfigPatches.omni.sidero.dev(default/1@undefined) doesn't exist
#66 4.431         	Test:       	TestGrpcSuite/TestCrud
```

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
This commit is contained in:
Utku Ozdemir 2025-06-05 19:28:13 +02:00
parent f3783edcb0
commit 05aad4d86f
No known key found for this signature in database
GPG Key ID: DBD13117B0A14E93

View File

@ -179,7 +179,7 @@ func (ctrl *ConfigPatchCleanupController) isOrphan(ctx context.Context, r contro
return false, nil
}
if time.Since(configPatch.Metadata().Updated()) < ctrl.DeleteOlderThan {
if time.Since(configPatch.Metadata().Updated()) < ctrl.DeleteOlderThan || time.Since(configPatch.Metadata().Created()) < ctrl.DeleteOlderThan {
return false, nil
}