Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #99 from thedadams/standard-handlers
Browse files Browse the repository at this point in the history
Add a few standard handlers
  • Loading branch information
thedadams committed Aug 31, 2023
2 parents 50fb849 + c62a464 commit 0573b10
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pkg/handlers/handlers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package handlers

import (
"github.com/acorn-io/baaah/pkg/apply"
"github.com/acorn-io/baaah/pkg/router"
)

// GCOrphans will delete an object whose owner has been deleted.
func GCOrphans(req router.Request, _ router.Response) error {
return apply.New(req.Client).PurgeOrphan(req.Ctx, req.Object)
}

// DoNothing is a handler that does nothing. It is useful because resp.Objects will only work if a GVK is being watched.
// This ensures that resp.Objects does what it is supposed to for objects that are no longer passed to resp.Objects, and
// are not watched anywhere else.
func DoNothing(router.Request, router.Response) error {
return nil
}

0 comments on commit 0573b10

Please sign in to comment.