Skip to content

Commit f9c266b

Browse files
committed
fix resetting config after deletion
1 parent d746325 commit f9c266b

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

internal/controller/tunnelbinding_controller.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"fmt"
2424
"sort"
2525
"strings"
26+
"time"
2627

2728
"github.com/adyanth/cloudflare-operator/internal/clients/cf"
2829

@@ -156,7 +157,11 @@ func (r *TunnelBindingReconciler) Reconcile(ctx context.Context, req ctrl.Reques
156157
// TunnelBinding object not found, could have been deleted after reconcile request.
157158
// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.
158159
// Return and don't requeue
159-
r.log.Info("TunnelBinding deleted, nothing to do")
160+
r.log.Info("TunnelBinding deleted, updating config")
161+
if err = r.configureCloudflareDaemon(); err != nil {
162+
r.log.Error(err, "unable to update config")
163+
return ctrl.Result{}, err
164+
}
160165
return ctrl.Result{}, nil
161166
}
162167
r.log.Error(err, "unable to fetch TunnelBinding")
@@ -170,7 +175,8 @@ func (r *TunnelBindingReconciler) Reconcile(ctx context.Context, req ctrl.Reques
170175

171176
// Check if TunnelBinding is marked for deletion
172177
if r.binding.GetDeletionTimestamp() != nil {
173-
return ctrl.Result{}, r.deletionLogic()
178+
// Requeue to update configmap above
179+
return ctrl.Result{RequeueAfter: time.Second}, r.deletionLogic()
174180
}
175181

176182
if err := r.setStatus(); err != nil {

0 commit comments

Comments
 (0)