-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
azure: allow installer to consume AZURE_AUTH_LOCATION
env for credentials file
#1785
azure: allow installer to consume AZURE_AUTH_LOCATION
env for credentials file
#1785
Conversation
/test e2e-openstack |
1 similar comment
/test e2e-openstack |
Need this PR to get CI rolling, level=fatal msg="failed to fetch Terraform Variables: failed to fetch dependency of \"Terraform Variables\": failed to fetch dependency of \"Bootstrap Ignition Config\": failed to fetch dependency of \"Master Machines\": failed to generate asset \"Platform Credentials Check\": creating Azure session: failed to retrieve credentials from user: EOF"
�[0G�[2K�[1;92m? �[1;99mazure subscription id [? for help] �[?25l�7�[999;999f�[6n�[6n |
/retest |
@@ -16,15 +16,15 @@ import ( | |||
|
|||
const azureAuthEnv = "AZURE_AUTH_LOCATION" | |||
|
|||
var authFilePath = os.Getenv("HOME") + "/.azure/osServicePrincipal.json" | |||
var defaultAuthFilePath = os.Getenv("HOME") + "/.azure/osServicePrincipal.json" |
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 prefer filePath.Join
so we aren't so far off when we get around to compiling for Windows. But whatever, the +
concat approach is what we had before this PR.
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.
fixed with 4bff9ab...0e9453e
os.Setenv(azureAuthEnv, authFilePath) | ||
return newSessionFromFile() | ||
authFile := defaultAuthFilePath | ||
if f, ok := os.LookupEnv(azureAuthEnv); ok && len(f) > 0 { |
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.
If you're going to gate on length anyway, you might as well just use os.Getenv
.
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.
fixed with 4bff9ab...0e9453e
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.
Two minor nits, I'm ok landing this with either or none of them addressed, but wanted to give you time before a /lgtm
in case you want to address them. If you're fine as things stand, just pull the hold:
/lgtm
/hold
…ntials file Installer uses `NewAuthorizerFromFileWithResource` [1], which uses `GetSettingsFromFile` [2] to locate and load the file with auth credentials. `GetSettingsFromFile` [2] uses the `AZURE_AUTH_LOCATION` env [3] to locate the file with no way to override or specify explicitly. Currently the installer uses the hard-coded location `~/.azure/osServicePrincipal.json` to load the credentials. But for CI, it would be important to override this location to another location like we do for AWS [4]. So this change allows users to set `AZURE_AUTH_LOCATION` env to provider installer custom location to auth file. [1]: https://github.com/Azure/go-autorest/blob/v12.0.0/autorest/azure/auth/auth.go#L243 [2]: https://github.com/Azure/go-autorest/blob/v12.0.0/autorest/azure/auth/auth.go#L287 [3]: https://github.com/Azure/go-autorest/blob/v12.0.0/autorest/azure/auth/auth.go#L289 [4]: https://github.com/openshift/release/blob/6c0b409639d6dcd074238e5396cddcc5c4da1510/ci-operator/templates/openshift/installer/cluster-launch-installer-e2e.yaml#L373-L374
4bff9ab
to
0e9453e
Compare
/hold cancel |
/lgtm |
[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
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@abhinavdahiya: 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. Instructions 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. |
Installer uses
NewAuthorizerFromFileWithResource
here, which usesGetSettingsFromFile
here to locate and load the file with auth credentials.GetSettingsFromFile
here uses theAZURE_AUTH_LOCATION
env here to locate the file with no way to override or specify explicitly.Currently the installer uses the hard-coded location
~/.azure/osServicePrincipal.json
to load the credentials. But for CI, it would be important to override thislocation to another location like we do for AWS here. So this change allows users to set
AZURE_AUTH_LOCATION
env to provider installer custom location to auth file./cc @openshift/installer