Skip to content

Commit

Permalink
Fix: remove existing cleanup method (#1492)
Browse files Browse the repository at this point in the history
Signed-off-by: Daishan Peng <[email protected]>
  • Loading branch information
StrongMonkey authored Jan 29, 2025
1 parent 611d751 commit 27d9393
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 20 deletions.
4 changes: 4 additions & 0 deletions pkg/controller/handlers/cronjob/cronjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/obot-platform/obot/pkg/alias"
v1 "github.com/obot-platform/obot/pkg/storage/apis/obot.obot.ai/v1"
"github.com/obot-platform/obot/pkg/system"
apierror "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
kclient "sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -60,6 +61,9 @@ func (h *Handler) Run(req router.Request, resp router.Response) error {

var workflow v1.Workflow
if err := alias.Get(req.Ctx, req.Client, &workflow, cj.Namespace, cj.Spec.Workflow); err != nil {
if apierror.IsNotFound(err) {
return nil
}
return err
}

Expand Down
2 changes: 0 additions & 2 deletions pkg/controller/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,11 @@ func (c *Controller) setupRoutes() error {
root.Type(&v1.KnowledgeSet{}).HandlerFunc(knowledgeset.SetEmbeddingModel)

// Webhooks
root.Type(&v1.Webhook{}).HandlerFunc(cleanup.Cleanup)
root.Type(&v1.Webhook{}).HandlerFunc(alias.AssignAlias)
root.Type(&v1.Webhook{}).HandlerFunc(webHooks.SetSuccessRunTime)
root.Type(&v1.Webhook{}).HandlerFunc(generationed.UpdateObservedGeneration)

// Cronjobs
root.Type(&v1.CronJob{}).HandlerFunc(cleanup.Cleanup)
root.Type(&v1.CronJob{}).HandlerFunc(cronJobs.SetSuccessRunTime)
root.Type(&v1.CronJob{}).HandlerFunc(cronJobs.Run)

Expand Down
6 changes: 0 additions & 6 deletions pkg/storage/apis/obot.obot.ai/v1/cronjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

"github.com/obot-platform/nah/pkg/fields"
"github.com/obot-platform/obot/apiclient/types"
"github.com/obot-platform/obot/pkg/system"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -51,11 +50,6 @@ func (*CronJob) GetColumns() [][]string {
}

func (c *CronJob) DeleteRefs() []Ref {
if system.IsWorkflowID(c.Spec.Workflow) {
return []Ref{
{ObjType: new(Workflow), Name: c.Spec.Workflow},
}
}
return nil
}

Expand Down
6 changes: 0 additions & 6 deletions pkg/storage/apis/obot.obot.ai/v1/emailaddress.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

"github.com/obot-platform/nah/pkg/fields"
"github.com/obot-platform/obot/apiclient/types"
"github.com/obot-platform/obot/pkg/system"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -74,11 +73,6 @@ func (*EmailReceiver) GetColumns() [][]string {
}

func (in *EmailReceiver) DeleteRefs() []Ref {
if system.IsWorkflowID(in.Spec.Workflow) {
return []Ref{
{ObjType: new(Workflow), Name: in.Spec.Workflow},
}
}
return nil
}

Expand Down
6 changes: 0 additions & 6 deletions pkg/storage/apis/obot.obot.ai/v1/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

"github.com/obot-platform/nah/pkg/fields"
"github.com/obot-platform/obot/apiclient/types"
"github.com/obot-platform/obot/pkg/system"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -75,11 +74,6 @@ func (*Webhook) GetColumns() [][]string {
}

func (w *Webhook) DeleteRefs() []Ref {
if system.IsWebhookID(w.Spec.Workflow) {
return []Ref{
{ObjType: new(Workflow), Name: w.Spec.Workflow},
}
}
return nil
}

Expand Down

0 comments on commit 27d9393

Please sign in to comment.