Skip to content

Commit

Permalink
Merge pull request kubernetes#1107 from shiftstack/openstack-secret-r…
Browse files Browse the repository at this point in the history
…ace-49

Bug 2039373: UPSTREAM: 89885: SQUASH: Retry fetching clouds.conf
  • Loading branch information
openshift-merge-robot authored Feb 2, 2022
2 parents 885dd09 + 8ecc876 commit fc61f05
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion staging/src/k8s.io/legacy-cloud-providers/openstack/openstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ import (
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
netutil "k8s.io/apimachinery/pkg/util/net"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/informers"
corelistersv1 "k8s.io/client-go/listers/core/v1"
certutil "k8s.io/client-go/util/cert"
"k8s.io/client-go/util/retry"
cloudprovider "k8s.io/cloud-provider"
nodehelpers "k8s.io/cloud-provider/node/helpers"
"k8s.io/klog/v2"
Expand Down Expand Up @@ -279,7 +281,22 @@ func (os *OpenStack) setConfigFromSecret() error {
return fmt.Errorf("secret lister is not initialized")
}

secret, err := os.secretLister.Secrets(os.secretNamespace).Get(os.secretName)
var secret *v1.Secret
err := retry.OnError(
wait.Backoff{
Duration: time.Second,
Factor: 1.5,
Jitter: 1,
Steps: 10,
},
func(_ error) bool {
return true
},
func() (err error) {
secret, err = os.secretLister.Secrets(os.secretNamespace).Get(os.secretName)
return err
},
)
if err != nil {
klog.Errorf("cannot get secret %s in namespace %s. error: %q", os.secretName, os.secretNamespace, err)
return err
Expand Down

0 comments on commit fc61f05

Please sign in to comment.