Skip to content

Commit

Permalink
Merge pull request #1 from danehans/provider-refactor-fix-gw-delete
Browse files Browse the repository at this point in the history
Adds Gateway Deletion Support to Controller
  • Loading branch information
chauhanshubham authored Dec 2, 2022
2 parents 17f5447 + d7feaf2 commit b910b06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions internal/provider/kubernetes/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ func (r *gatewayAPIReconciler) Reconcile(ctx context.Context, request reconcile.
return reconcile.Result{}, err
}

// Store the resource tree to trigger a delete operation.
r.resources.GatewayAPIResources.Store(acceptedGC.Name, resourceTree)

// No further processing is required as there are no Gateways for this GatewayClass
return reconcile.Result{}, nil
}
Expand Down
6 changes: 3 additions & 3 deletions internal/provider/kubernetes/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@ func testGatewayClassAcceptedStatus(ctx context.Context, t *testing.T, provider
return false
}, defaultWait, defaultTick)

// Since there are no Gateways present for the GatewayClass, we store nothing
// in the resource map.
// Even though no gateways exist, the controller loads the empty resource map
// to support gateway deletions.
require.Eventually(t, func() bool {
_, ok := resources.GatewayAPIResources.Load(gc.Name)
return !ok
return ok
}, defaultWait, defaultTick)
}

Expand Down

0 comments on commit b910b06

Please sign in to comment.