Skip to content

Commit

Permalink
fix dns controller get raven dns configmap (#1759)
Browse files Browse the repository at this point in the history
Co-authored-by: 珩轩 <[email protected]>
  • Loading branch information
River-sh and 珩轩 authored Oct 28, 2023
1 parent 962eefc commit 5d14338
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkg/yurtmanager/controller/raven/dns/dns_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,23 +160,24 @@ func (r *ReconcileDns) Reconcile(ctx context.Context, req reconcile.Request) (re

func (r ReconcileDns) getProxyDNS(ctx context.Context, objKey client.ObjectKey) (*corev1.ConfigMap, error) {
var cm corev1.ConfigMap
err := wait.PollImmediate(5*time.Second, time.Minute, func() (done bool, err error) {
waitErr := wait.PollImmediate(5*time.Second, time.Minute, func() (done bool, err error) {
err = r.Client.Get(ctx, objKey, &cm)
if err != nil {
if apierrors.IsNotFound(err) {
err = r.buildRavenDNSConfigMap()
if err != nil {
klog.Errorf(Format("failed to generate dns record , error %s", err.Error()))
return false, nil
klog.Errorf(Format(err.Error()))
}
} else {
klog.Errorf(Format("failed to get configmap %s, error %s", objKey.String(), err.Error()))
}
klog.Error(Format("failed to get ConfigMap %s, error %s", objKey.String(), err.Error()))
return false, nil
}
return true, nil
})
if err != nil {
return cm.DeepCopy(), fmt.Errorf("failed to get ConfigMap %s, error %s", objKey.String(), err.Error())

if waitErr != nil {
return nil, fmt.Errorf("failed to get ConfigMap %s, error %s", objKey.String(), waitErr.Error())
}
return cm.DeepCopy(), nil
}
Expand Down

0 comments on commit 5d14338

Please sign in to comment.