Skip to content

Conversation

@wking
Copy link
Member

@wking wking commented Mar 5, 2019

Avoid looping forever with:

INFO get tagged resources: NoCredentialProviders: no valid providers in chain. Deprecated.
    For verbose messaging see aws.Config.CredentialsChainVerboseErrors

and so on for all the other calls. With this commit, I'm allowing callers to provide their own session, which they can pre-check as they like.

I'm not adjusting pkg/destroy/aws to use GetSession internally, because it would drag in a bunch of mostly-unrelated dependencies that pkg/destroy/aws consumers like Hive won't want. And Hive's consumer isn't interactive anyway, so our prompting logic would not be a good fit for them. With this commit, we can use our prompting GetSession without forcing it onto Hive.

@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 5, 2019
@staebler
Copy link
Contributor

staebler commented Mar 5, 2019

I get this output when I run destroy cluster with no profile.

? AWS Access Key ID AKsomethingsomething
? AWS Secret Access Key [? for help] ****************************************
INFO Writing AWS credentials to "/home/staebler/.aws/credentials" (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) 
INFO Writing AWS credentials to "/home/staebler/.aws/credentials" (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) 
DEBUG search for and delete matching resources by tag in us-east-2 matching aws.Filter{"kubernetes.io/cluster/mstaeble-zfgzp":"owned"} 
INFO get tagged resources: MissingRegion: could not find region configuration 
DEBUG search for and delete matching resources by tag in us-east-2 matching aws.Filter{"openshiftClusterID":"04fc8b89-6895-4693-b257-a01170b65f2f"} 
INFO get tagged resources: MissingRegion: could not find region configuration 
DEBUG search for and delete matching resources by tag in us-east-1 matching aws.Filter{"kubernetes.io/cluster/mstaeble-zfgzp":"owned"} 
DEBUG search for and delete matching resources by tag in us-east-1 matching aws.Filter{"openshiftClusterID":"04fc8b89-6895-4693-b257-a01170b65f2f"} 
DEBUG no deletions from us-east-1, removing client 
DEBUG search for IAM roles                         
DEBUG search for IAM users                         
DEBUG search for and delete matching resources by tag in us-east-2 matching aws.Filter{"kubernetes.io/cluster/mstaeble-zfgzp":"owned"} 
INFO get tagged resources: MissingRegion: could not find region configuration 
DEBUG search for and delete matching resources by tag in us-east-2 matching aws.Filter{"openshiftClusterID":"04fc8b89-6895-4693-b257-a01170b65f2f"} 
INFO get tagged resources: MissingRegion: could not find region configuration 
DEBUG search for IAM roles                         
DEBUG search for IAM users                         
DEBUG search for and delete matching resources by tag in us-east-2 matching aws.Filter{"kubernetes.io/cluster/mstaeble-zfgzp":"owned"} 
INFO get tagged resources: MissingRegion: could not find region configuration 
DEBUG search for and delete matching resources by tag in us-east-2 matching aws.Filter{"openshiftClusterID":"04fc8b89-6895-4693-b257-a01170b65f2f"} 
INFO get tagged resources: MissingRegion: could not find region configuration 
DEBUG search for IAM roles                         
DEBUG search for IAM users                         
...

This has two issue that I see.

  1. It creates the AWS credentials flie when we may not want it to.
  2. It does not work, and still loops endlessly, because there is no region specified.

@wking
Copy link
Member Author

wking commented Mar 5, 2019

  1. It creates the AWS credentials flie when we may not want it to.

Why would this be different from the create case? I'm fine with "hold creds in memory" or "write creds to disk", but don't see a reason to use different approaches for create and destroy.

  1. It does not work, and still loops endlessly, because there is no region specified.

I thought clients were regioned, but the session was global? But yeah, obviously something going on there...

@wking wking force-pushed the aws-destroy-credential-prompt branch from 1c25463 to 72319c7 Compare March 7, 2019 05:34
@wking
Copy link
Member Author

wking commented Mar 7, 2019

DEBUG search for and delete matching resources by tag in us-east-2 matching aws.Filter{"kubernetes.io/cluster/mstaeble-zfgzp":"owned"} 
INFO get tagged resources: MissingRegion: could not find region configuration 

Ok, I've rebased onto master with 1c25463d2 -> 72319c7f4, which also adds a Session.Copy(...) call which I think will address this.

@wking wking force-pushed the aws-destroy-credential-prompt branch from 72319c7 to bb43966 Compare March 8, 2019 20:00
@openshift-ci-robot openshift-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 8, 2019
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 15, 2019
Avoid looping forever with [1]:

  INFO get tagged resources: NoCredentialProviders: no valid providers in chain. Deprecated.
      For verbose messaging see aws.Config.CredentialsChainVerboseErrors

and so on for all the other calls.  With this commit, I'm allowing
callers to provide their own session, which they can pre-check as they
like.

I'm not adjusting pkg/destroy/aws to use GetSession internally,
because it would drag in a bunch of mostly-unrelated dependencies that
pkg/destroy/aws consumers like Hive [2] won't want.  And Hive's
consumer isn't interactive anyway, so our prompting logic would not be
a good fit for them.  With this commit, *we* can use our prompting
GetSession without forcing it onto Hive.

[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1684951
[2]: https://github.com/openshift/hive/blob/a9ffb5af700bdc46dab2a880ec8414cd9e99242e/contrib/cmd/hiveutil/awstagdeprovision.go#L24

Issue: https://bugzilla.redhat.com/show_bug.cgi?id=1684951
@wking wking force-pushed the aws-destroy-credential-prompt branch from bb43966 to 419c5a7 Compare April 5, 2019 17:11
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 5, 2019
@wking
Copy link
Member Author

wking commented Apr 5, 2019

Rebased around #1268 with bb4396613 -> 419c5a7.

@wking
Copy link
Member Author

wking commented Apr 5, 2019

All green. @abhinavdahiya, @staebler, can you take another look?

@abhinavdahiya
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 15, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhinavdahiya, wking

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [abhinavdahiya,wking]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

4 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@abhinavdahiya
Copy link
Contributor

/retest

@openshift-merge-robot openshift-merge-robot merged commit 8c607f6 into openshift:master Apr 17, 2019
@wking wking deleted the aws-destroy-credential-prompt branch April 17, 2019 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants