pkg/asset/cluster: Pull metadata into the Cluster asset #454
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Terraform can die part-way through launching a cluster for many reasons, and we want it to be easy for users to clean up.
destroy-cluster
gets its teardown information frommetadata.json
, but before this commit we were only writing the file after a successful Terraform run. That left users with failed Terraform runs scrambling to delete their cluster on their own (e.g. withvirsh-cleanup.sh
or other external tools).One solution to this problem would be to move the
Metadata
asset before theCluster
asset intargetAssets
. But @abhinavdahiya wants:To provide metadata about the cluster (e.g. bootstrap and master IPs) that is only available after Terraform wraps up.
To minimize the number of assets, so no
pre-terraform-metadata.json
andpost-terraform-metadata.json
as separate assets.This commit squashes the metadata file into the
Cluster
asset, so we can fill it in as we go.I've also updated
openshift-install
to write any files from failed assets before exiting, so we can land the metadata and recovered Terraform state where the user can find them before we die. To avoid nil-dereference panics after this change, I've also updated a number ofFiles()
implementations to avoid returning a[<nil>]
slice.The
SilenceError
andSilenceUsage
additions work around spf13/cobra#340.I've also add
-input=false
to our Terraform invocations, details on that in the 2b5aee7 commit message. I can spin that off into a separate PR if it makes review easier./assign @abhinavdahiya