-
Notifications
You must be signed in to change notification settings - Fork 1.5k
OpenStack Destroy Cluster Support #391
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
OpenStack Destroy Cluster Support #391
Conversation
d263585 to
7af4bfc
Compare
7af4bfc to
ba2569c
Compare
|
Ok I added the vendored dependencies, and rebased on the latest logger changes - this is now working well for me to delete the servers. Do we want to land this and incrementally add the remaining resources (network/subnet/port/router), or should I keep pushing to this one PR? |
|
Also I removed WIP as this now works, albeit only for the server resources. |
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.
nit: This is missing trailing period.
Some of your other godocs comments are as well. Obviously not the end of the world, but should be easy to fix ;).
And we probably have a number of godocs in master with the same issue; PRs welcome :).
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.
Ah thanks, I'll go through and check - is there a way to build the godocs locally so I can check the format before pushing?
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.
Ah thanks, I'll go through and check - is there a way to build the godocs locally so I can check the format before pushing?
$ godoc ./pkg/destroy
PACKAGE DOCUMENTATION
package destroy
import "./pkg/destroy"
Package destroy contains tools for destroying clusters based on their
metadata.
VARIABLES
var Registry = make(map[string]NewFunc)
Registry maps ClusterMetadata.Platform() to per-platform Destroyer
creators.
TYPES
type Destroyer interface {
Run() error
}
Destroyer allows multiple implementations of destroy for different
platforms.
func New(logger logrus.FieldLogger, rootDir string) (Destroyer, error)
New returns a Destroyer based on `metadata.json` in `rootDir`.
func NewAWS(logger logrus.FieldLogger, metadata *types.ClusterMetadata) (Destroyer, error)
NewAWS returns an AWS destroyer from ClusterMetadata.
type NewFunc func(logger logrus.FieldLogger, metadata *types.ClusterMetadata) (Destroyer, error)
NewFunc is an interface for creating platform-specific destroyers.
SUBDIRECTORIES
libvirt
|
Note I spent some time today looking at adding tags support for the network resources - unfortunately neither gophercloud or terraform-provider-openstack yet support tags for neutron resources, so looks like I'll have to add those before I can make progress, unless anyone has other suggestions on how we might identify the resources for removal? |
|
Can we abuse the resource names as a way to tag them for removal? |
Yeah I guess so, and the libvirt destroy code does that (looks for a prefix), the names would end up pretty ugly though (particularly since the installer isn't idempotent so it could easily reuse a cluster name on each run creating duplicate resources, sigh). I did look at gophercloud today and writing the tags looks fairly simple ref gophercloud/gophercloud#1259 (WIP) |
ba2569c to
86ae539
Compare
|
(it won't succeed but FYI) /test e2e-openstack |
86ae539 to
237edcc
Compare
|
Ok I'll mark this WIP although the top server commit could potentially land now - the network patches will all depend on terraform-provider-openstack changes that are under review ref https://github.com/terraform-providers/terraform-provider-openstack/issues/453 If anyone wants to help test you can pull the staged tree with all commits at https://github.com/hardys/terraform-provider-openstack/commits/neutron_tags_wip |
|
Note this was blocked on gophercloud patches (all now landed and included in the vendored files in the commits I just pushed), and terraform-provider-openstack patches (under review as mentioned). I've rebased this and the server/port patches work for me, so I'll go ahead and push support for the other resources so hopefully this will be in good shape when the terraform-provider-openstack patches merge (hopefully next week but we'll see how it goes). |
237edcc to
91173b6
Compare
18abe06 to
35a9e15
Compare
|
@flaper87 @tomassedovic as discussed I rebased this on the latest #588 and squashed to two commits, the vendor additions for gophercloud and the destroy support itself. You can test it by deploying as normal, then doing something like: ./bin/openshift-install --log-level=debug --dir rhcos destroy cluster |
1 similar comment
|
@flaper87 @tomassedovic as discussed I rebased this on the latest #588 and squashed to two commits, the vendor additions for gophercloud and the destroy support itself. You can test it by deploying as normal, then doing something like: ./bin/openshift-install --log-level=debug --dir rhcos destroy cluster |
cmd/openshift-install/destroy.go
Outdated
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.
I don't see this package anywhere (and my build fails because of that). Is it possible you've left it out in the squash/rebase?
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.
@tomassedovic oops, yes you're right, the new package got lost due to the most recent rebase, I'll re-add it and rebase again now #588 landed, thanks for spotting it!
|
Marking WIP again since I need to address the rebase issue and we're still blocked on a new release of terraform-provider-openstack, hopefully that will happen this week |
This adds compute and networking gophercloud APIs, required for OpenStack destroy support.
35a9e15 to
f1e46d6
Compare
|
@hardys: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions 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. |
f1e46d6 to
ab97e00
Compare
|
https://github.com/terraform-providers/terraform-provider-openstack/releases/tag/v1.12.0 has been released so I'll adjust the commit message and remove the WIP |
This adds initial support for destroy for OpenStack Note that because gophercloud doesn't currently support nova tags[1] I've used Metadata for servers (which is already populated with the tectonicClusterId via the server properties). Also note this requires changes to the terraform-provider-openstack which are in the latest 1.12 release: https://github.com/terraform-providers/terraform-provider-openstack/releases/tag/v1.12.0 https://github.com/terraform-providers/terraform-provider-openstack/issues/453
ab97e00 to
0b6d686
Compare
|
/lgtm |
|
/hold cancel |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: flaper87, hardys The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/ok-to-test |
This was missed in openshift#391 so this adds support for cleaning up the created container/object (used for the bootstrap ignition config)
Now that openshift/installer#391 landed we can replace the bash script with the cluster destroy command. Note you will need to pull the latest openshift/installer then re-run 05_build_ocp_installer.sh for this to work.
Adds initial destroy support for OpenStack, currently this only considers Server resources, network resources will be considered either via an update to this PR or follow-up PR's, whichever is preferable.