Skip to content

Commit 23e30c7

Browse files
committed
provider: Ignore environment variables
Users should configure things via a secret, not via environment variables. Signed-off-by: Stephen Finucane <[email protected]>
1 parent 88dcecf commit 23e30c7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/scope/provider.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,12 @@ func (s *providerScope) ExtractToken() (*tokens.Token, error) {
224224

225225
func NewProviderClient(cloud clientconfig.Cloud, caCert []byte, logger logr.Logger) (*gophercloud.ProviderClient, *clientconfig.ClientOpts, string, error) {
226226
clientOpts := new(clientconfig.ClientOpts)
227+
228+
// We explicitly disable reading auth data from env variables by setting an invalid EnvPrefix.
229+
// By doing this, we make sure that the data from clouds.yaml is enough to authenticate.
230+
// For more information: https://github.com/gophercloud/utils/blob/8677e053dcf1f05d0fa0a616094aace04690eb94/openstack/clientconfig/requests.go#L508
231+
clientOpts.EnvPrefix = "NO_ENV_VARIABLES_"
232+
227233
if cloud.AuthInfo != nil {
228234
clientOpts.AuthInfo = cloud.AuthInfo
229235
clientOpts.AuthType = cloud.AuthType

0 commit comments

Comments
 (0)