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
Bug 1813949: ignore local env variables when we create a service client #4426
Bug 1813949: ignore local env variables when we create a service client #4426
Conversation
/label platform/openstack |
We need some library code for this. We're already doing the os.Unsetenv("OS_CLOUD") dance in 4 places:
To avoid inconsistent behaviour we're going to want the new hack in all those places, too. We should really pull this out somewhere. This would also allow us to unit test it. |
Is this a fix for https://bugzilla.redhat.com/show_bug.cgi?id=1813949 ? |
Can we apply this to all the steps (install-config generation, manifest creation, ignition... etc), and remove our various calls to |
6e26d44
to
0822d42
Compare
@Fedosin: This pull request references Bugzilla bug 1813949, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
In response to this:
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. |
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.
/lgtm
/retest |
0822d42
to
fad78a3
Compare
conn, err := clientconfig.NewServiceClient("network", &clientconfig.ClientOpts{ | ||
Cloud: cloud, | ||
}) | ||
conn, err := clientconfig.NewServiceClient("network", defaultValidValuesFetcherClientOpts(cloud)) |
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.
Related, but not necessarily in this patch, I would refactor all of these functions to take a ProviderClient instead of a cloud name. The reason is you pull the code managing authentication options into a single place, and also you only hit keystone once rather than every time you create a new service client.
@@ -23,11 +22,6 @@ type Session struct { | |||
func GetSession(cloudName string) (*Session, error) { |
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 would prefer to see every case where we instantiate an openstack client call this method.
// We explicitly disable reading auth data from env variables by setting an invalid EnvPrefix. | ||
// By doing this, we make sure that the data from clouds.yaml is enough to authenticate. | ||
// For more information: https://github.com/gophercloud/utils/blob/8677e053dcf1f05d0fa0a616094aace04690eb94/openstack/clientconfig/requests.go#L508 | ||
opts.EnvPrefix = "NO_ENV_VARIABLES_" |
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.
This is duplicating what we're already doing with defaultClientOpts(). I'd prefer we just called that.
@Fedosin: The following tests failed, say
Full PR test history. Your PR dashboard. 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. |
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.
Probably need some re factorization if possible.
68b692f
to
1938a23
Compare
/approve Note for self: installer/data/data/openstack/main.tf Line 4 in 4bd58eb
and an explicit value is supposed to override the env var default: |
This commit explicitly disables reading auth data from env variables by setting an invalid EnvPrefix. By doing this, we make sure that the data from clouds.yaml is enough to authenticate. After this change we don't have to unset OS_CLOUD env variable explicitly anymore. Ref https://issues.redhat.com/browse/OSASINFRA-2152
/retest Please review the full test history for this PR and help us cut down flakes. |
25 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
@Fedosin: All pull requests linked via external trackers have merged: Bugzilla bug 1813949 has been moved to the MODIFIED state. In response to this:
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. |
…tensionAvailability External consumers of `MachineSets()`, such as [hive](https://github.com/openshift/hive/), need to be able to customize the client that queries the OpenStack cloud for trunk support. A prior commit (openshift#8187 / b99470c), eliminating what looked like tech debt, removed that enablement, which was most recently added via openshift#4638 / 3c4235c, which was *itself* a revert of a previous commit (openshift#4426 / 05453ef) that had removed it similarly. Here we reinstate the customizability, and include a docstring explanation to hopefully prevent it being removed again. OSASINFRA-3421
This commit explicitly disables reading auth data from env variables by setting an invalid EnvPrefix. By doing this, we make sure that the data from clouds.yaml is enough to authenticate.
After this change we don't have to unset OS_CLOUD env variable explicitly anymore.