initial implementation of watchworkflow

This commit is contained in:
rushtehrani
2019-12-16 17:17:53 -08:00
parent 07f8e0281e
commit 66d10fac40
2 changed files with 51 additions and 0 deletions

View File

@@ -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,