mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-10-21 20:49:24 +08:00
initial implementation of watchworkflow
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/onepanelio/core/util"
|
||||
"github.com/spf13/viper"
|
||||
"google.golang.org/grpc/codes"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
)
|
||||
|
||||
func (r *ResourceManager) CreateWorkflow(namespace string, workflow *model.Workflow) (*model.Workflow, error) {
|
||||
@@ -82,6 +83,15 @@ func (r *ResourceManager) GetWorkflow(namespace, name string) (workflow *model.W
|
||||
return
|
||||
}
|
||||
|
||||
func (r *ResourceManager) WatchWorkflow(namespace, name string) (watcher watch.Interface, err error) {
|
||||
watcher, err = r.argClient.WatchWorkflow(name, &argo.Options{Namespace: namespace})
|
||||
if err != nil {
|
||||
return nil, util.NewUserError(codes.NotFound, "Workflow not found.")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (r *ResourceManager) ListWorkflows(namespace, workflowTemplateUID string) (workflows []*model.Workflow, err error) {
|
||||
opts := &argo.Options{
|
||||
Namespace: namespace,
|
||||
|
Reference in New Issue
Block a user