Skip to content

Commit

Permalink
Remove usage of deprecated wait.Poll function
Browse files Browse the repository at this point in the history
The function is replaced with wait.PollUntilContextTimeout

Signed-off-by: Yury Kulazhenkov <ykulazhenkov@nvidia.com>
  • Loading branch information
ykulazhenkov committed Nov 22, 2023
1 parent ca83d2e commit 819cb0f
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions pkg/state/state_ofed.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,18 +553,19 @@ func (s *stateOFED) getOrCreateTrustedCAConfigMap(
"name", cmName, "namespace", cmNamespace)

// check that CA bundle is populated by Openshift before proceed
err = wait.Poll(ocpTrustedCAConfigMapCheckInterval, ocpTrustedCAConfigMapCheckTimeout, func() (bool, error) {
err := s.client.Get(ctx, types.NamespacedName{Namespace: cmNamespace, Name: cmName}, configMap)
if err != nil {
if apiErrors.IsNotFound(err) {
return false, nil
err = wait.PollUntilContextTimeout(ctx, ocpTrustedCAConfigMapCheckInterval,
ocpTrustedCAConfigMapCheckTimeout, true, func(innerCtx context.Context) (bool, error) {
err := s.client.Get(innerCtx, types.NamespacedName{Namespace: cmNamespace, Name: cmName}, configMap)
if err != nil {
if apiErrors.IsNotFound(err) {
return false, nil
}
return false, err
}
return false, err
}
return configMap.Data[ocpTrustedCABundleFileName] != "", nil
})
return configMap.Data[ocpTrustedCABundleFileName] != "", nil
})
if err != nil {
if !errors.Is(err, wait.ErrWaitTimeout) {
if !wait.Interrupted(err) {
return nil, errors.Wrap(err, "failed to check TrustedCAConfigMap content")
}
reqLogger.V(consts.LogLevelWarning).Info("TrustedCAConfigMap was not populated by Openshift,"+
Expand Down

0 comments on commit 819cb0f

Please sign in to comment.