-
Notifications
You must be signed in to change notification settings - Fork 30
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
Throw fatal error and ask user to run cleanup when a k8s resource already exists in the cluster #135
Conversation
pkg/service/init.go
Outdated
if err != nil { | ||
if errors.IsAlreadyExists(err) { | ||
log.Printf("namespace already exist %s", common.PodName) | ||
log.Printf("namespace already exist %s", conformanceNS.ObjectMeta.Name) |
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.
also, we were using wrong resource name in the log
This looks good, but how does it account for the state of an object? For example after cleanup is run then the namespace will still exist in a terminating state. |
Thats true, we are not checking status of the resource here |
Can we also rework the logs here? The logs are somewhat misleading if a resource already exists:
|
So, here's the thing, if the conformance namespace is already there then that means something that ran earlier will not be cleaned up. So we have to explicitly tell the user to clean the namespace by hand AND THEN re-run hydrophone. If they don't and we try to reuse whatever exists, they will run into problems (tests may fail randomly etc) So +1 to cleanup logs and be explicit about. BUT please don't let them continue when there is a namespace already that |
/hold |
Thanks @dims for the context. in that case we can just throw error if a resource already exists. |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dims, reetasingh 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 |
/hold remove |
/hold cancel |
When k8s resource like Namespace, clusterrole, clusterrole, binding, service account already exists in the cluster the RunE2E() test fails because the Create() operation returns error. But the error in the logs are not clear. Throw Fatal error when resource already exists and ask to run cleanup
Eg: when namespace already exists in the cluster I am getting below error
To recreate this failure run
make run
twiceWith this fix in place, it works fine