Skip to content

Commit

Permalink
add DeleteNamedGateway function
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdiramen committed Feb 23, 2024
1 parent 810522a commit e0d05d6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/controller/gateway/gateway_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (r *GatewayReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
case err == nil:
// all good, continue
case client.IgnoreNotFound(err) == nil:
if err := r.Driver.DeleteNamedIngress(req.NamespacedName); err != nil {
if err := r.Driver.DeleteNamedGateway(req.NamespacedName); err != nil {
log.Error(err, "Failed to delete gateway from store")
return ctrl.Result{}, err
}
Expand Down
8 changes: 8 additions & 0 deletions internal/store/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,14 @@ func (d *Driver) DeleteNamedIngress(n types.NamespacedName) error {
return d.cacheStores.Delete(ingress)
}

func (d *Driver) DeleteNamedGateway(n types.NamespacedName) error {
gtw := &gatewayv1.Gateway{}
// set NamespacedName on the gateway object
gtw.SetNamespace(n.Namespace)
gtw.SetName(n.Name)
return d.cacheStores.Delete(gtw)
}

// syncStart will:
// - let the first caller proceed, indicated by returning true
// - while the first one is running any subsequent calls will be batched to the last call
Expand Down

0 comments on commit e0d05d6

Please sign in to comment.