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
OCPBUGSM-29066 Remove cluster resources after clusterdeployment deletion #1801
OCPBUGSM-29066 Remove cluster resources after clusterdeployment deletion #1801
Conversation
You could a subsystem test that delete a cluster and check for example that the events table in the DB is empty. |
ed7afa3
to
180b716
Compare
subsystem/kubeapi_test.go
Outdated
db.Model(&cluster).UpdateColumn("updated_at", time.Now().AddDate(-1, 0, 0)) | ||
|
||
By("Wait 5 seconds to let garbage collector be triggered") | ||
time.Sleep(5 * time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of waiting you could use Eventually
if safer then a static sleep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced with Consistently
which is useful in this context.
subsystem/kubeapi_test.go
Outdated
db.Model(&cluster).UpdateColumn("deleted_at", time.Now().AddDate(-1, 0, 0)) | ||
|
||
By("Wait 10 seconds to let garbage collector be triggered and finalize permenant removal") | ||
time.Sleep(10 * time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of waiting you could use Eventually
if safer then a static sleep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
180b716
to
15e404c
Compare
/retest |
|
||
By("Verify no event for deregistering the cluster was emitted") | ||
msg := "Cluster is deregistered" | ||
Consistently(func() []*common.Event { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why check consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make sure that during that period the execution of the garbageCollector.DeregisterClusterInternal did not occur and as a result the cluster was not deregistered.
subsystem/kubeapi_test.go
Outdated
Eventually(func() error { | ||
_, err := common.GetClusterFromDBWhere(db, common.UseEagerLoading, common.IncludeDeletedRecords, "kube_key_name = ? and kube_key_namespace = ?", clusterKey.Name, clusterKey.Namespace) | ||
return err | ||
}, "30s", "10s").Should(HaveOccurred()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggesting to increase it to a minute to be on the safe side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do.
When cluster is deregistered, either by clusterdeployment or by the API, the cluster record is softly deleted, meaning the attribute 'deleted_at' in the DB is being set. It is the responsiblity of the garbage collector to run periodically and remove all of the cluster's resources. For that purpose, the garbage collection should be enabled for clearing cluster resources in operator deployment as well. Signed-off-by: Moti Asayag <masayag@redhat.com>
15e404c
to
6317358
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: filanov, masayag The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@masayag: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/retest |
When cluster is deregistered, either by clusterdeployment or by the API,
the cluster record is softly deleted, meaning the attribute
deleted_at
in the DB is being set.
It is the responsiblity of the garbage collector to run periodically and
remove all of the cluster's resources.
For that purpose, the garbage collection should be enabled for clearing
cluster resources in operator deployment as well.
Signed-off-by: Moti Asayag masayag@redhat.com