-
Notifications
You must be signed in to change notification settings - Fork 49
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
clean up ssh keys when cleaning up e2e test resources #380
clean up ssh keys when cleaning up e2e test resources #380
Conversation
thanks @MorrisLaw there is a few issues
|
Build issues are fixed. Any recommendations/advice on how I can test this? @cpanato |
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.
thanks for working on this
…ight string comparison
hack/do-janitor/do-janitor.go
Outdated
capdoStr := "capdo" // using this for repeated comparisons in the loop below | ||
for _, key := range keys { | ||
// we only care to cleanup keys that start with "capdo" | ||
if len(key.Name) >= len(capdoStr) && key.Name[0:len(capdoStr)] == capdoStr { |
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.
the ssh keys we generate start with capdo-
how about we do a simple check with strings.HasPrefix(key.Name, "capdo-")
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.
Even better! Will update shortly
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.
looks cool
thank you
/approve
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cpanato, MorrisLaw 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 |
What this PR does / why we need it:
Cleans up ssh keys from our DO test account whenever do-janitor is called.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #238
Special notes for your reviewer:
Not 100% sure how this will work since I'm not able to compare a
createdAt
time value to thetimeToCleanInHours
value we'd typically use within do-janitor (godo.Key does not have this as an available field nor does it seem to ever set one implicitly somewhere). It seems like we only run do-janitor when we want to clean up old resources in the DO account. The only problem I can think of is if we want there to be some longstanding ssh keys to exist within the DO account (outside of these ephemeral e2e test keys). Then this code would likely delete them every time do-janitor is ran. But hard to tell for sure unless I can manually test this.Any recommendations for how I can test this change (safely)? @timoreimann @cpanato
Also, is this issue still an issue? Or is it stale at this point. I don't see any left over keys in the account aside from some created by other co-maintainers.
Documentation:
Release note: