From 0e9231e32672ed003be706c20eee7dd46a91f8ca Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Thu, 23 Jan 2020 16:50:28 -0800 Subject: [PATCH 01/34] refactor(cli): Introduce v1.Interface for CLI --- cmd/argo/commands/archive/delete.go | 18 ++-- cmd/argo/commands/archive/get.go | 18 ++-- cmd/argo/commands/archive/list.go | 18 ++-- cmd/argo/commands/client/conn.go | 11 ++- .../commands/client/v1/argo-api-client.go | 69 +++++++++++++++ cmd/argo/commands/client/v1/interface.go | 27 ++++++ cmd/argo/commands/client/v1/kube-client.go | 84 ++++++++++++++++++ cmd/argo/commands/common.go | 23 +++-- cmd/argo/commands/get.go | 68 +++++---------- cmd/argo/commands/list.go | 61 +++---------- cmd/argo/commands/submit.go | 85 +++---------------- cmd/argo/commands/token.go | 9 +- test/e2e/cli_test.go | 51 ++--------- test/e2e/cli_with_server_test.go | 76 +++++++++++++++++ test/e2e/fixtures/e2e_suite.go | 7 -- test/e2e/fixtures/env.go | 15 ---- 16 files changed, 361 insertions(+), 279 deletions(-) create mode 100644 cmd/argo/commands/client/v1/argo-api-client.go create mode 100644 cmd/argo/commands/client/v1/interface.go create mode 100644 cmd/argo/commands/client/v1/kube-client.go create mode 100644 test/e2e/cli_with_server_test.go delete mode 100644 test/e2e/fixtures/env.go diff --git a/cmd/argo/commands/archive/delete.go b/cmd/argo/commands/archive/delete.go index 5cb67b8858b5..89ce6c7dcc5e 100644 --- a/cmd/argo/commands/archive/delete.go +++ b/cmd/argo/commands/archive/delete.go @@ -2,12 +2,11 @@ package archive import ( "fmt" - "log" + "github.com/argoproj/pkg/errors" "github.com/spf13/cobra" - "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflowarchive" + v1 "github.com/argoproj/argo/cmd/argo/commands/client/v1" ) func NewDeleteCommand() *cobra.Command { @@ -15,15 +14,10 @@ func NewDeleteCommand() *cobra.Command { Use: "delete UID...", Run: func(cmd *cobra.Command, args []string) { for _, uid := range args { - conn := client.GetClientConn() - ctx := client.GetContext() - client := workflowarchive.NewArchivedWorkflowServiceClient(conn) - _, err := client.DeleteArchivedWorkflow(ctx, &workflowarchive.DeleteArchivedWorkflowRequest{ - Uid: uid, - }) - if err != nil { - log.Fatal(err) - } + client, err := v1.GetClient() + errors.CheckError(err) + err = client.DeleteArchivedWorkflow(uid) + errors.CheckError(err) fmt.Printf("Archived workflow '%s' deleted\n", uid) } }, diff --git a/cmd/argo/commands/archive/get.go b/cmd/argo/commands/archive/get.go index b8978433e7e6..66260dfa5d29 100644 --- a/cmd/argo/commands/archive/get.go +++ b/cmd/argo/commands/archive/get.go @@ -6,12 +6,12 @@ import ( "log" "os" + "github.com/argoproj/pkg/errors" "github.com/argoproj/pkg/humanize" "github.com/spf13/cobra" "sigs.k8s.io/yaml" - "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflowarchive" + v1 "github.com/argoproj/argo/cmd/argo/commands/client/v1" ) func NewGetCommand() *cobra.Command { @@ -26,15 +26,11 @@ func NewGetCommand() *cobra.Command { os.Exit(1) } uid := args[0] - conn := client.GetClientConn() - ctx := client.GetContext() - client := workflowarchive.NewArchivedWorkflowServiceClient(conn) - wf, err := client.GetArchivedWorkflow(ctx, &workflowarchive.GetArchivedWorkflowRequest{ - Uid: uid, - }) - if err != nil { - log.Fatal(err) - } + + client, err := v1.GetClient() + errors.CheckError(err) + wf, err := client.GetArchivedWorkflow(uid) + errors.CheckError(err) switch output { case "json": output, err := json.Marshal(wf) diff --git a/cmd/argo/commands/archive/list.go b/cmd/argo/commands/archive/list.go index 28b6f7729c53..c42df4f1b475 100644 --- a/cmd/argo/commands/archive/list.go +++ b/cmd/argo/commands/archive/list.go @@ -7,12 +7,11 @@ import ( "os" "text/tabwriter" + "github.com/argoproj/pkg/errors" "github.com/spf13/cobra" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/yaml" - "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflowarchive" + v1 "github.com/argoproj/argo/cmd/argo/commands/client/v1" ) func NewListCommand() *cobra.Command { @@ -23,15 +22,10 @@ func NewListCommand() *cobra.Command { var command = &cobra.Command{ Use: "list", Run: func(cmd *cobra.Command, args []string) { - conn := client.GetClientConn() - ctx := client.GetContext() - client := workflowarchive.NewArchivedWorkflowServiceClient(conn) - resp, err := client.ListArchivedWorkflows(ctx, &workflowarchive.ListArchivedWorkflowsRequest{ - ListOptions: &metav1.ListOptions{FieldSelector: "metadata.namespace=" + namespace}, - }) - if err != nil { - log.Fatal(err) - } + argoClient, err := v1.GetClient() + errors.CheckError(err) + resp, err := argoClient.ListArchivedWorkflows(namespace) + errors.CheckError(err) switch output { case "json": output, err := json.Marshal(resp.Items) diff --git a/cmd/argo/commands/client/conn.go b/cmd/argo/commands/client/conn.go index 42550e10fad6..fd49f013ba45 100644 --- a/cmd/argo/commands/client/conn.go +++ b/cmd/argo/commands/client/conn.go @@ -13,7 +13,10 @@ import ( "github.com/argoproj/argo/util/kubeconfig" ) +// DEPRECATED should only be used by client/v1 package var ArgoServer string + +// DEPRECATED should only be used by client/v1 package var Config clientcmd.ClientConfig func AddKubectlFlagsToCmd(cmd *cobra.Command) { @@ -31,6 +34,7 @@ func AddArgoServerFlagsToCmd(cmd *cobra.Command) { cmd.PersistentFlags().StringVar(&ArgoServer, "argo-server", os.Getenv("ARGO_SERVER"), "API server `host:port`. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.") } +// DEPRECATED should only be used by client/v1 package func GetClientConn() *grpc.ClientConn { conn, err := grpc.Dial(ArgoServer, grpc.WithInsecure()) if err != nil { @@ -39,15 +43,16 @@ func GetClientConn() *grpc.ClientConn { return conn } +// DEPRECATED should only be used by client/v1 package func GetContext() context.Context { - token := GetBearerToken() + token := GetToken() if token == "" { return context.Background() } - return metadata.NewOutgoingContext(context.Background(), metadata.Pairs("grpcgateway-authorization", "Bearer "+GetBearerToken())) + return metadata.NewOutgoingContext(context.Background(), metadata.Pairs("grpcgateway-authorization", "Bearer "+token)) } -func GetBearerToken() string { +func GetToken() string { restConfig, err := Config.ClientConfig() if err != nil { log.Fatal(err) diff --git a/cmd/argo/commands/client/v1/argo-api-client.go b/cmd/argo/commands/client/v1/argo-api-client.go new file mode 100644 index 000000000000..8aa7ee2085ae --- /dev/null +++ b/cmd/argo/commands/client/v1/argo-api-client.go @@ -0,0 +1,69 @@ +package v1 + +import ( + "google.golang.org/grpc" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/argoproj/argo/cmd/argo/commands/client" + "github.com/argoproj/argo/cmd/server/workflow" + "github.com/argoproj/argo/cmd/server/workflowarchive" + wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" +) + +type argoAPIClient struct { + *grpc.ClientConn +} + +func (a *argoAPIClient) Namespace() (string, error) { + namespace, _, err := client.Config.Namespace() + return namespace, err +} + +func (a *argoAPIClient) ListArchivedWorkflows(namespace string) (*wfv1.WorkflowList, error) { + return workflowarchive.NewArchivedWorkflowServiceClient(a.ClientConn).ListArchivedWorkflows(client.GetContext(), &workflowarchive.ListArchivedWorkflowsRequest{ + ListOptions: &metav1.ListOptions{FieldSelector: "metadata.namespace=" + namespace}, + }) +} + +func (a *argoAPIClient) GetArchivedWorkflow(uid string) (*wfv1.Workflow, error) { + return workflowarchive.NewArchivedWorkflowServiceClient(a.ClientConn).GetArchivedWorkflow(client.GetContext(), &workflowarchive.GetArchivedWorkflowRequest{ + Uid: uid, + }) +} + +func (a *argoAPIClient) DeleteArchivedWorkflow(uid string) error { + _, err := workflowarchive.NewArchivedWorkflowServiceClient(a.ClientConn).DeleteArchivedWorkflow(client.GetContext(), &workflowarchive.DeleteArchivedWorkflowRequest{ + Uid: uid, + }) + return err +} + +func newArgoAPIClient() Interface { + return &argoAPIClient{client.GetClientConn()} +} + +func (a *argoAPIClient) Get(namespace, name string) (*wfv1.Workflow, error) { + return workflow.NewWorkflowServiceClient(a.ClientConn).GetWorkflow(client.GetContext(), &workflow.WorkflowGetRequest{ + Name: name, + Namespace: namespace, + }) +} + +func (a *argoAPIClient) List(namespace string, opts metav1.ListOptions) (*wfv1.WorkflowList, error) { + return workflow.NewWorkflowServiceClient(a.ClientConn).ListWorkflows(client.GetContext(), &workflow.WorkflowListRequest{ + Namespace: namespace, + ListOptions: &opts, + }) +} + +func (a *argoAPIClient) Submit(namespace string, wf *wfv1.Workflow, dryRun bool) (*wfv1.Workflow, error) { + return workflow.NewWorkflowServiceClient(a.ClientConn).CreateWorkflow(client.GetContext(), &workflow.WorkflowCreateRequest{ + Namespace: namespace, + Workflow: wf, + ServerDryRun: dryRun, + }) +} + +func (a *argoAPIClient) GetToken() (string, error) { + return client.GetToken(), nil +} diff --git a/cmd/argo/commands/client/v1/interface.go b/cmd/argo/commands/client/v1/interface.go new file mode 100644 index 000000000000..083c9436ed0b --- /dev/null +++ b/cmd/argo/commands/client/v1/interface.go @@ -0,0 +1,27 @@ +package v1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/argoproj/argo/cmd/argo/commands/client" + wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" +) + +type Interface interface { + Submit(namespace string, wf *wfv1.Workflow, dryRun bool) (*wfv1.Workflow, error) + List(namespace string, opts v1.ListOptions) (*wfv1.WorkflowList, error) + Get(namespace, name string) (*wfv1.Workflow, error) + GetToken() (string, error) + DeleteArchivedWorkflow(uid string) error + GetArchivedWorkflow(uid string) (*wfv1.Workflow, error) + ListArchivedWorkflows(namespace string) (*wfv1.WorkflowList, error) + Namespace() (string, error) +} + +func GetClient() (Interface, error) { + if client.ArgoServer != "" { + return newArgoAPIClient(), nil + } else { + return newKubeImpl() + } +} diff --git a/cmd/argo/commands/client/v1/kube-client.go b/cmd/argo/commands/client/v1/kube-client.go new file mode 100644 index 000000000000..e308d7c13ca1 --- /dev/null +++ b/cmd/argo/commands/client/v1/kube-client.go @@ -0,0 +1,84 @@ +package v1 + +import ( + "fmt" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/argoproj/argo/cmd/argo/commands/client" + wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" + "github.com/argoproj/argo/pkg/client/clientset/versioned" + "github.com/argoproj/argo/workflow/packer" +) + +var misuseError = fmt.Errorf("this doesn't make sense unless you are using argo server") + +type kubeClient struct { + versioned.Interface +} + +func (k *kubeClient) Namespace() (string, error) { + namespace, _, err := client.Config.Namespace() + return namespace, err +} + +func (k *kubeClient) ListArchivedWorkflows(_ string) (*wfv1.WorkflowList, error) { + return nil, misuseError +} + +func (k *kubeClient) GetArchivedWorkflow(_ string) (*wfv1.Workflow, error) { + return nil, misuseError +} + +func (k *kubeClient) DeleteArchivedWorkflow(_ string) error { + return misuseError +} + +func newKubeImpl() (Interface, error) { + restConfig, err := client.Config.ClientConfig() + if err != nil { + return nil, err + } + wfClient, err := versioned.NewForConfig(restConfig) + if err != nil { + return nil, err + } + return &kubeClient{wfClient}, nil +} + +func (k *kubeClient) Get(namespace, name string) (*wfv1.Workflow, error) { + wf, err := k.ArgoprojV1alpha1().Workflows(namespace).Get(name, metav1.GetOptions{}) + if err != nil { + return nil, err + } + err = packer.DecompressWorkflow(wf) + if err != nil { + return nil, err + } + return wf, nil +} + +func (k *kubeClient) List(namespace string, opts metav1.ListOptions) (*wfv1.WorkflowList, error) { + list, err := k.ArgoprojV1alpha1().Workflows(namespace).List(opts) + if err != nil { + return nil, err + } + for _, wf := range list.Items { + err = packer.DecompressWorkflow(&wf) + if err != nil { + return nil, err + } + } + return list, nil +} + +func (k *kubeClient) Submit(namespace string, wf *wfv1.Workflow, dryRun bool) (*wfv1.Workflow, error) { + if dryRun { + return nil, fmt.Errorf("dryRun not implemented") + } + return k.ArgoprojV1alpha1().Workflows(namespace).Create(wf) +} + +func (k *kubeClient) GetToken() (string, error) { + return "", misuseError +} diff --git a/cmd/argo/commands/common.go b/cmd/argo/commands/common.go index d19f6554f798..1d376f208da5 100644 --- a/cmd/argo/commands/common.go +++ b/cmd/argo/commands/common.go @@ -23,18 +23,22 @@ import ( // Global variables var ( - restConfig *rest.Config - clientset *kubernetes.Clientset - wfClientset *versioned.Clientset - wfClient v1alpha1.WorkflowInterface + // DEPRECATED + restConfig *rest.Config + // DEPRECATED + clientset *kubernetes.Clientset + // DEPRECATED + wfClientset *versioned.Clientset + // DEPRECATED + wfClient v1alpha1.WorkflowInterface + // DEPRECATED wftmplClient v1alpha1.WorkflowTemplateInterface jobStatusIconMap map[wfv1.NodePhase]string noColor bool - namespace string + // DEPRECATED + namespace string ) -const ARGO_SERVER_ENV = "ARGO_SERVER" - func init() { cobra.OnInitialize(initializeSession) } @@ -69,6 +73,7 @@ func initializeSession() { } } +// DEPRECATED func InitKubeClient() *kubernetes.Clientset { if clientset != nil { return clientset @@ -88,6 +93,7 @@ func InitKubeClient() *kubernetes.Clientset { } // InitWorkflowClient creates a new client for the Kubernetes Workflow CRD. +// DEPRECATED func InitWorkflowClient(ns ...string) v1alpha1.WorkflowInterface { if wfClient != nil && (len(ns) == 0 || ns[0] == namespace) { return wfClient @@ -129,9 +135,11 @@ func ansiFormat(s string, codes ...int) string { // LazyWorkflowTemplateGetter is a wrapper of v1alpha1.WorkflowTemplateInterface which // supports lazy initialization. +// DEPRECATED type LazyWorkflowTemplateGetter struct{} // Get initializes it just before it's actually used and returns a retrieved workflow template. +// DEPRECATED func (c LazyWorkflowTemplateGetter) Get(name string) (*wfv1.WorkflowTemplate, error) { if wftmplClient == nil { _ = InitWorkflowClient() @@ -141,6 +149,7 @@ func (c LazyWorkflowTemplateGetter) Get(name string) (*wfv1.WorkflowTemplate, er var _ templateresolution.WorkflowTemplateNamespacedGetter = &LazyWorkflowTemplateGetter{} +// DEPRECATED func GetWFApiServerGRPCClient(conn *grpc.ClientConn) (wfApiServer.WorkflowServiceClient, context.Context) { return wfApiServer.NewWorkflowServiceClient(conn), client.GetContext() } diff --git a/cmd/argo/commands/get.go b/cmd/argo/commands/get.go index 32cd7a63abed..a09f0a66f84c 100644 --- a/cmd/argo/commands/get.go +++ b/cmd/argo/commands/get.go @@ -8,15 +8,14 @@ import ( "strings" "text/tabwriter" + "github.com/argoproj/pkg/errors" "github.com/argoproj/pkg/humanize" "github.com/spf13/cobra" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/yaml" - "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflow" + v1 "github.com/argoproj/argo/cmd/argo/commands/client/v1" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" - "github.com/argoproj/argo/workflow/packer" ) const onExitSuffix = "onExit" @@ -32,38 +31,21 @@ func NewGetCommand() *cobra.Command { ) var command = &cobra.Command{ - Use: "get WORKFLOW", + Use: "get WORKFLOW...", Short: "display details about a workflow", Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 { cmd.HelpFunc()(cmd, args) os.Exit(1) } - if client.ArgoServer != "" { - conn := client.GetClientConn() - defer conn.Close() - ns, _, _ := client.Config.Namespace() - client, ctx := GetWFApiServerGRPCClient(conn) - for _, arg := range args { - wfReq := workflow.WorkflowGetRequest{ - Name: arg, - Namespace: ns, - } - wf, err := client.GetWorkflow(ctx, &wfReq) - if err != nil { - log.Fatal(err) - } - outputWorkflow(wf, getArgs) - } - } else { - wfClient := InitWorkflowClient() - for _, arg := range args { - wf, err := wfClient.Get(arg, metav1.GetOptions{}) - if err != nil { - log.Fatal(err) - } - outputWorkflow(wf, getArgs) - } + client, err := v1.GetClient() + errors.CheckError(err) + namespace, err := client.Namespace() + errors.CheckError(err) + for _, name := range args { + wf, err := client.Get(namespace, name) + errors.CheckError(err) + outputWorkflow(wf, getArgs) } }, } @@ -75,10 +57,6 @@ func NewGetCommand() *cobra.Command { } func outputWorkflow(wf *wfv1.Workflow, getArgs getFlags) { - err := packer.DecompressWorkflow(wf) - if err != nil { - log.Fatal(err) - } printWorkflow(wf, getArgs.output, getArgs.status) } @@ -164,11 +142,11 @@ func printWorkflowHelper(wf *wfv1.Workflow, getArgs getFlags) { if printTree { w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0) fmt.Println() - // apply a dummy FgDefault format to align tabwriter with the rest of the columns + // apply a dummy FgDefault format to align tab writer with the rest of the columns if getArgs.output == "wide" { - fmt.Fprintf(w, "%s\tPODNAME\tDURATION\tARTIFACTS\tMESSAGE\n", ansiFormat("STEP", FgDefault)) + _, _ = fmt.Fprintf(w, "%s\tPODNAME\tDURATION\tARTIFACTS\tMESSAGE\n", ansiFormat("STEP", FgDefault)) } else { - fmt.Fprintf(w, "%s\tPODNAME\tDURATION\tMESSAGE\n", ansiFormat("STEP", FgDefault)) + _, _ = fmt.Fprintf(w, "%s\tPODNAME\tDURATION\tMESSAGE\n", ansiFormat("STEP", FgDefault)) } // Convert Nodes to Render Trees @@ -183,7 +161,7 @@ func printWorkflowHelper(wf *wfv1.Workflow, getArgs getFlags) { onExitID := wf.NodeID(wf.ObjectMeta.Name + "." + onExitSuffix) if onExitRoot, ok := roots[onExitID]; ok { - fmt.Fprintf(w, "\t\t\t\t\t\n") + _, _ = fmt.Fprintf(w, "\t\t\t\t\t\n") onExitRoot.renderNodes(w, wf, 0, " ", " ", getArgs) } _ = w.Flush() @@ -446,7 +424,7 @@ func renderChild(w *tabwriter.Writer, wf *wfv1.Workflow, nInfo renderNode, depth } // Main method to print information of node in get -func printNode(w *tabwriter.Writer, wf *wfv1.Workflow, node wfv1.NodeStatus, depth int, nodePrefix string, childPrefix string, getArgs getFlags) { +func printNode(w *tabwriter.Writer, node wfv1.NodeStatus, nodePrefix string, getArgs getFlags) { if getArgs.status != "" && string(node.Phase) != getArgs.status { return } @@ -467,9 +445,9 @@ func printNode(w *tabwriter.Writer, wf *wfv1.Workflow, node wfv1.NodeStatus, dep msg := args[len(args)-1] args[len(args)-1] = getArtifactsString(node) args = append(args, msg) - fmt.Fprintf(w, "%s%s\t%s\t%s\t%s\t%s\n", args...) + _, _ = fmt.Fprintf(w, "%s%s\t%s\t%s\t%s\t%s\n", args...) } else { - fmt.Fprintf(w, "%s%s\t%s\t%s\t%s\n", args...) + _, _ = fmt.Fprintf(w, "%s%s\t%s\t%s\t%s\n", args...) } } @@ -478,7 +456,7 @@ func printNode(w *tabwriter.Writer, wf *wfv1.Workflow, node wfv1.NodeStatus, dep func (nodeInfo *boundaryNode) renderNodes(w *tabwriter.Writer, wf *wfv1.Workflow, depth int, nodePrefix string, childPrefix string, getArgs getFlags) { filtered, childIndent := filterNode(nodeInfo.getNodeStatus(wf)) if !filtered { - printNode(w, wf, nodeInfo.getNodeStatus(wf), depth, nodePrefix, childPrefix, getArgs) + printNode(w, nodeInfo.getNodeStatus(wf), nodePrefix, getArgs) } for i, nInfo := range nodeInfo.boundaryContained { @@ -491,7 +469,7 @@ func (nodeInfo *boundaryNode) renderNodes(w *tabwriter.Writer, wf *wfv1.Workflow func (nodeInfo *nonBoundaryParentNode) renderNodes(w *tabwriter.Writer, wf *wfv1.Workflow, depth int, nodePrefix string, childPrefix string, getArgs getFlags) { filtered, childIndent := filterNode(nodeInfo.getNodeStatus(wf)) if !filtered { - printNode(w, wf, nodeInfo.getNodeStatus(wf), depth, nodePrefix, childPrefix, getArgs) + printNode(w, nodeInfo.getNodeStatus(wf), nodePrefix, getArgs) } for i, nInfo := range nodeInfo.children { @@ -501,10 +479,10 @@ func (nodeInfo *nonBoundaryParentNode) renderNodes(w *tabwriter.Writer, wf *wfv1 } // executionNode -func (nodeInfo *executionNode) renderNodes(w *tabwriter.Writer, wf *wfv1.Workflow, depth int, nodePrefix string, childPrefix string, getArgs getFlags) { +func (nodeInfo *executionNode) renderNodes(w *tabwriter.Writer, wf *wfv1.Workflow, _ int, nodePrefix string, _ string, getArgs getFlags) { filtered, _ := filterNode(nodeInfo.getNodeStatus(wf)) if !filtered { - printNode(w, wf, nodeInfo.getNodeStatus(wf), depth, nodePrefix, childPrefix, getArgs) + printNode(w, nodeInfo.getNodeStatus(wf), nodePrefix, getArgs) } } @@ -512,7 +490,7 @@ func getArtifactsString(node wfv1.NodeStatus) string { if node.Outputs == nil { return "" } - artNames := []string{} + var artNames []string for _, art := range node.Outputs.Artifacts { artNames = append(artNames, art.Name) } diff --git a/cmd/argo/commands/list.go b/cmd/argo/commands/list.go index 2efc489fb86a..d012a1874f31 100644 --- a/cmd/argo/commands/list.go +++ b/cmd/argo/commands/list.go @@ -1,7 +1,6 @@ package commands import ( - "context" "fmt" "log" "os" @@ -10,20 +9,17 @@ import ( "text/tabwriter" "time" + "github.com/argoproj/pkg/errors" "github.com/argoproj/pkg/humanize" argotime "github.com/argoproj/pkg/time" "github.com/spf13/cobra" - apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/selection" - "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflow" + v1 "github.com/argoproj/argo/cmd/argo/commands/client/v1" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" - "github.com/argoproj/argo/pkg/client/clientset/versioned/typed/workflow/v1alpha1" "github.com/argoproj/argo/workflow/common" - "github.com/argoproj/argo/workflow/packer" "github.com/argoproj/argo/workflow/util" ) @@ -47,27 +43,6 @@ func NewListCommand() *cobra.Command { Use: "list", Short: "list workflows", Run: func(cmd *cobra.Command, args []string) { - var wfClient v1alpha1.WorkflowInterface - var wfApiClient workflow.WorkflowServiceClient - var ctx context.Context - var ns string - - if client.ArgoServer == "" { - if listArgs.allNamespaces { - wfClient = InitWorkflowClient(apiv1.NamespaceAll) - } else { - wfClient = InitWorkflowClient() - } - } else { - conn := client.GetClientConn() - defer conn.Close() - if listArgs.allNamespaces { - ns = apiv1.NamespaceAll - } else { - ns, _, _ = client.Config.Namespace() - } - wfApiClient, ctx = GetWFApiServerGRPCClient(conn) - } listOpts := metav1.ListOptions{} labelSelector := labels.NewSelector() @@ -89,29 +64,23 @@ func NewListCommand() *cobra.Command { if listArgs.chunkSize != 0 { listOpts.Limit = listArgs.chunkSize } - var wfList *wfv1.WorkflowList - var err error - if client.ArgoServer == "" { - wfList, err = wfClient.List(listOpts) - if err != nil { - log.Fatal(err) - } - } else { - wfReq := workflow.WorkflowListRequest{ - Namespace: ns, - ListOptions: &listOpts, - } - wfList, err = wfApiClient.ListWorkflows(ctx, &wfReq) - if err != nil { - log.Fatal(err) - } + client, err := v1.GetClient() + errors.CheckError(err) + + namespace, err := client.Namespace() + errors.CheckError(err) + if listArgs.allNamespaces { + namespace = "" } + wfList, err := client.List(namespace, listOpts) + errors.CheckError(err) + tmpWorkFlows := wfList.Items for wfList.ListMeta.Continue != "" { listOpts.Continue = wfList.ListMeta.Continue - wfList, err = wfClient.List(listOpts) + wfList, err = client.List(namespace, listOpts) if err != nil { log.Fatal(err) } @@ -208,10 +177,6 @@ func countPendingRunningCompleted(wf *wfv1.Workflow) (int, int, int) { pending := 0 running := 0 completed := 0 - err := packer.DecompressWorkflow(wf) - if err != nil { - log.Fatal(err) - } for _, node := range wf.Status.Nodes { tmpl := wf.GetTemplateByName(node.TemplateName) if tmpl == nil || !tmpl.IsPodType() { diff --git a/cmd/argo/commands/submit.go b/cmd/argo/commands/submit.go index 0c6fa5eab9d3..7db90555576b 100644 --- a/cmd/argo/commands/submit.go +++ b/cmd/argo/commands/submit.go @@ -1,26 +1,20 @@ package commands import ( - "context" "log" "os" - "strconv" - - "github.com/spf13/cobra" - apimachineryversion "k8s.io/apimachinery/pkg/version" "github.com/argoproj/pkg/errors" argoJson "github.com/argoproj/pkg/json" + "github.com/spf13/cobra" - "github.com/argoproj/argo/cmd/argo/commands/client" - apiwf "github.com/argoproj/argo/cmd/server/workflow" + v1 "github.com/argoproj/argo/cmd/argo/commands/client/v1" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" - apiUtil "github.com/argoproj/argo/util/api" "github.com/argoproj/argo/workflow/common" "github.com/argoproj/argo/workflow/util" ) -// cliSubmitOpts holds submition options specific to CLI submission (e.g. controlling output) +// cliSubmitOpts holds submission options specific to CLI submission (e.g. controlling output) type cliSubmitOpts struct { output string // --output wait bool // --wait @@ -80,13 +74,12 @@ func SubmitWorkflows(filePaths []string, submitOpts *util.SubmitOpts, cliOpts *c if cliOpts == nil { cliOpts = &cliSubmitOpts{} } - defaultWFClient := InitWorkflowClient() - var defaultNS string - defaultNS, _, err := client.Config.Namespace() - if err != nil { - log.Fatal(err) - } + client, err := v1.GetClient() + errors.CheckError(err) + + defaultNS, err := client.Namespace() + errors.CheckError(err) fileContents, err := util.ReadManifest(filePaths...) if err != nil { @@ -136,17 +129,6 @@ func SubmitWorkflows(filePaths []string, submitOpts *util.SubmitOpts, cliOpts *c if cliOpts.output == "" { log.Fatalf("--server-dry-run should have an output option") } - serverVersion, err := wfClientset.Discovery().ServerVersion() - if err != nil { - log.Fatalf("Unexpected error while getting the server's api version") - } - isCompatible, err := checkServerVersionForDryRun(serverVersion) - if err != nil { - log.Fatalf("Unexpected error while checking the server's api version compatibility with --server-dry-run") - } - if !isCompatible { - log.Fatalf("--server-dry-run is not available for server api versions older than v1.12") - } } if len(workflows) == 0 { @@ -155,41 +137,16 @@ func SubmitWorkflows(filePaths []string, submitOpts *util.SubmitOpts, cliOpts *c } var workflowNames []string - var created *wfv1.Workflow - var apiGRPCClient apiwf.WorkflowServiceClient - var ctx context.Context - if client.ArgoServer != "" { - conn := client.GetClientConn() - defer conn.Close() - apiGRPCClient, ctx = GetWFApiServerGRPCClient(conn) - errors.CheckError(err) - } for _, wf := range workflows { if wf.Namespace == "" { // This is here to avoid passing an empty namespace when using --server-dry-run wf.Namespace = defaultNS } - if client.ArgoServer != "" { - err = util.ApplySubmitOpts(&wf, submitOpts) - errors.CheckError(err) - created, err = apiUtil.SubmitWorkflowToAPIServer(apiGRPCClient, ctx, &wf, submitOpts.ServerDryRun) - errors.CheckError(err) - } else { - wf.Spec.Priority = cliOpts.priority - wfClient := defaultWFClient - if wf.Namespace != defaultNS { - wfClient = InitWorkflowClient(wf.Namespace) - } else { - // This is here to avoid passing an empty namespace when using --server-dry-run - namespace, _, err := client.Config.Namespace() - if err != nil { - log.Fatal(err) - } - wf.Namespace = namespace - } - created, err = util.SubmitWorkflow(wfClient, wfClientset, namespace, &wf, submitOpts) - } + err := util.ApplySubmitOpts(&wf, submitOpts) + errors.CheckError(err) + wf.Spec.Priority = cliOpts.priority + created, err := client.Submit(wf.Namespace, &wf, submitOpts.ServerDryRun) if err != nil { log.Fatalf("Failed to submit workflow: %v", err) } @@ -200,24 +157,6 @@ func SubmitWorkflows(filePaths []string, submitOpts *util.SubmitOpts, cliOpts *c waitOrWatch(workflowNames, *cliOpts) } -// Checks whether the server has support for the dry-run option -func checkServerVersionForDryRun(serverVersion *apimachineryversion.Info) (bool, error) { - majorVersion, err := strconv.Atoi(serverVersion.Major) - if err != nil { - return false, err - } - minorVersion, err := strconv.Atoi(serverVersion.Minor) - if err != nil { - return false, err - } - if majorVersion < 1 { - return false, nil - } else if majorVersion == 1 && minorVersion < 12 { - return false, nil - } - return true, nil -} - // unmarshalWorkflows unmarshals the input bytes as either json or yaml func unmarshalWorkflows(wfBytes []byte, strict bool) []wfv1.Workflow { var wf wfv1.Workflow diff --git a/cmd/argo/commands/token.go b/cmd/argo/commands/token.go index 5ebb8f31c94b..5ffa9e3f9bd8 100644 --- a/cmd/argo/commands/token.go +++ b/cmd/argo/commands/token.go @@ -4,9 +4,10 @@ import ( "fmt" "os" + "github.com/argoproj/pkg/errors" "github.com/spf13/cobra" - "github.com/argoproj/argo/cmd/argo/commands/client" + v1 "github.com/argoproj/argo/cmd/argo/commands/client/v1" ) func NewTokenCommand() *cobra.Command { @@ -18,7 +19,11 @@ func NewTokenCommand() *cobra.Command { cmd.HelpFunc()(cmd, args) os.Exit(1) } - fmt.Print(client.GetBearerToken()) + client, err := v1.GetClient() + errors.CheckError(err) + token, err := client.GetToken() + errors.CheckError(err) + fmt.Print(token) }, } } diff --git a/test/e2e/cli_test.go b/test/e2e/cli_test.go index 2e0490db37ce..65d0c898366d 100644 --- a/test/e2e/cli_test.go +++ b/test/e2e/cli_test.go @@ -1,15 +1,12 @@ package e2e import ( + "os" "testing" - "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" "github.com/argoproj/argo/test/e2e/fixtures" ) @@ -19,7 +16,8 @@ type CLISuite struct { func (s *CLISuite) BeforeTest(suiteName, testName string) { s.E2ESuite.BeforeTest(suiteName, testName) - + _ = os.Unsetenv("ARGO_SERVER") + _ = os.Unsetenv("ARGO_TOKEN") } func (s *CLISuite) AfterTest(suiteName, testName string) { @@ -33,15 +31,6 @@ func (s *CLISuite) TestCompletion() { }) } -func (s *CLISuite) TestToken() { - s.Given().RunCli([]string{"token"}, func(t *testing.T, output string, err error) { - assert.NoError(t, err) - token, err := s.GetServiceAccountToken() - assert.NoError(t, err) - assert.Equal(t, token, output) - }) -} - func (s *CLISuite) TestRoot() { s.Given().RunCli([]string{"submit", "smoke/basic.yaml"}, func(t *testing.T, output string, err error) { assert.NoError(t, err) @@ -65,6 +54,10 @@ func (s *CLISuite) TestRoot() { assert.Contains(t, output, "Status:") assert.Contains(t, output, "Created:") }) + s.Given().RunCli([]string{"delete", "basic"}, func(t *testing.T, output string, err error) { + assert.NoError(t, err) + assert.Contains(t, output, "deleted") + }) } func (s *CLISuite) TestTemplate() { @@ -144,36 +137,6 @@ func (s *CLISuite) TestCron() { }) } -func (s *CLISuite) TestArchive() { - var uid types.UID - s.Given(). - Workflow("@smoke/basic.yaml"). - When(). - SubmitWorkflow(). - WaitForWorkflow(30*time.Second). - Then(). - Expect(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) { - uid = metadata.UID - }). - RunCli([]string{"archive", "list"}, func(t *testing.T, output string, err error) { - if assert.NoError(t, err) { - assert.Contains(t, output, "NAMESPACE NAME") - assert.Contains(t, output, "argo basic") - } - }). - RunCli([]string{"archive", "get", string(uid)}, func(t *testing.T, output string, err error) { - if assert.NoError(t, err) { - assert.Contains(t, output, "Succeeded") - } - }). - RunCli([]string{"archive", "delete", string(uid)}, func(t *testing.T, output string, err error) { - if assert.NoError(t, err) { - assert.Contains(t, output, "Archived workflow") - assert.Contains(t, output, "deleted") - } - }) -} - func TestCliSuite(t *testing.T) { suite.Run(t, new(CLISuite)) } diff --git a/test/e2e/cli_with_server_test.go b/test/e2e/cli_with_server_test.go new file mode 100644 index 000000000000..bc614b07d155 --- /dev/null +++ b/test/e2e/cli_with_server_test.go @@ -0,0 +1,76 @@ +package e2e + +import ( + "os" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/suite" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + + wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" +) + +type CLIWithServerSuite struct { + CLISuite +} + +func (s *CLIWithServerSuite) BeforeTest(suiteName, testName string) { + s.CLISuite.BeforeTest(suiteName, testName) + token, err := s.GetServiceAccountToken() + if err != nil { + panic(err) + } + _ = os.Setenv("ARGO_TOKEN", token) +} + +func (s *CLIWithServerSuite) AfterTest(suiteName, testName string) { + s.CLISuite.AfterTest(suiteName, testName) + _ = os.Unsetenv("ARGO_TOKEN") +} + +func (s *CLIWithServerSuite) TestToken() { + s.Given(). + RunCli([]string{"token"}, func(t *testing.T, output string, err error) { + assert.NoError(t, err) + token, err := s.GetServiceAccountToken() + assert.NoError(t, err) + assert.Equal(t, token, output) + }) +} + +func (s *CLIWithServerSuite) TestArchive() { + var uid types.UID + s.Given(). + Workflow("@smoke/basic.yaml"). + When(). + SubmitWorkflow(). + WaitForWorkflow(30*time.Second). + Then(). + Expect(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) { + uid = metadata.UID + }). + RunCli([]string{"archive", "list"}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "NAMESPACE NAME") + assert.Contains(t, output, "argo basic") + } + }). + RunCli([]string{"archive", "get", string(uid)}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "Succeeded") + } + }). + RunCli([]string{"archive", "delete", string(uid)}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "Archived workflow") + assert.Contains(t, output, "deleted") + } + }) +} + +func TestCLIWithServerSuite(t *testing.T) { + suite.Run(t, new(CLIWithServerSuite)) +} diff --git a/test/e2e/fixtures/e2e_suite.go b/test/e2e/fixtures/e2e_suite.go index 4ab6cfe180c4..99df80c81376 100644 --- a/test/e2e/fixtures/e2e_suite.go +++ b/test/e2e/fixtures/e2e_suite.go @@ -33,7 +33,6 @@ func init() { type E2ESuite struct { suite.Suite - Env Diagnostics *Diagnostics Persistence *Persistence RestConfig *rest.Config @@ -49,11 +48,6 @@ func (s *E2ESuite) SetupSuite() { if err != nil { panic(err) } - token, err := s.GetServiceAccountToken() - if err != nil { - panic(err) - } - s.SetEnv(token) s.KubeClient, err = kubernetes.NewForConfig(s.RestConfig) if err != nil { panic(err) @@ -67,7 +61,6 @@ func (s *E2ESuite) SetupSuite() { func (s *E2ESuite) TearDownSuite() { s.Persistence.Close() - s.UnsetEnv() } func (s *E2ESuite) BeforeTest(_, _ string) { diff --git a/test/e2e/fixtures/env.go b/test/e2e/fixtures/env.go deleted file mode 100644 index feb2bde538c7..000000000000 --- a/test/e2e/fixtures/env.go +++ /dev/null @@ -1,15 +0,0 @@ -package fixtures - -import "os" - -type Env struct { -} - -func (s *Env) SetEnv(token string) { - _ = os.Setenv("ARGO_SERVER", "localhost:2746") - _ = os.Setenv("ARGO_TOKEN", token) -} -func (s *Env) UnsetEnv() { - _ = os.Unsetenv("ARGO_SERVER") - _ = os.Unsetenv("ARGO_TOKEN") -} From ba81475ff22d48b045c868a3408a23310d85be90 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Fri, 24 Jan 2020 16:23:37 -0800 Subject: [PATCH 02/34] add missing env vars --- Gopkg.lock | 1 - Makefile | 1 + test/e2e/cli_with_server_test.go | 2 ++ 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Gopkg.lock b/Gopkg.lock index 4080ef3f4e35..9382a40df4a5 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -1696,7 +1696,6 @@ "k8s.io/apimachinery/pkg/util/strategicpatch", "k8s.io/apimachinery/pkg/util/validation", "k8s.io/apimachinery/pkg/util/wait", - "k8s.io/apimachinery/pkg/version", "k8s.io/apimachinery/pkg/watch", "k8s.io/client-go/discovery", "k8s.io/client-go/discovery/fake", diff --git a/Makefile b/Makefile index 456f95e3f12e..83181dd2ff45 100644 --- a/Makefile +++ b/Makefile @@ -382,6 +382,7 @@ test-api: test-images test-cli: test-images # Run CLI tests go test -timeout 1m -v -count 1 -p 1 -run CliSuite ./test/e2e + go test -timeout 1m -v -count 1 -p 1 -run CLIWithServerSuite ./test/e2e # clean diff --git a/test/e2e/cli_with_server_test.go b/test/e2e/cli_with_server_test.go index 1b7fbe53561d..4e6d433d4cb9 100644 --- a/test/e2e/cli_with_server_test.go +++ b/test/e2e/cli_with_server_test.go @@ -23,11 +23,13 @@ func (s *CLIWithServerSuite) BeforeTest(suiteName, testName string) { if err != nil { panic(err) } + _ = os.Setenv("ARGO_SERVER", "localhost:2746") _ = os.Setenv("ARGO_TOKEN", token) } func (s *CLIWithServerSuite) AfterTest(suiteName, testName string) { s.CLISuite.AfterTest(suiteName, testName) + _ = os.Unsetenv("ARGO_SERVER") _ = os.Unsetenv("ARGO_TOKEN") } From 61fcc65cf8f611d9384c4858f6bef01777320acc Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Fri, 24 Jan 2020 17:32:01 -0800 Subject: [PATCH 03/34] namespace --- cmd/argo/commands/archive/list.go | 10 ++-- cmd/argo/commands/artifact/list.go | 54 ++++++++++++++++++++++ cmd/argo/commands/artifact/root.go | 16 +++++++ cmd/argo/commands/client/v1/kube-client.go | 2 +- 4 files changed, 76 insertions(+), 6 deletions(-) create mode 100644 cmd/argo/commands/artifact/list.go create mode 100644 cmd/argo/commands/artifact/root.go diff --git a/cmd/argo/commands/archive/list.go b/cmd/argo/commands/archive/list.go index c42df4f1b475..87acbd74414d 100644 --- a/cmd/argo/commands/archive/list.go +++ b/cmd/argo/commands/archive/list.go @@ -16,15 +16,16 @@ import ( func NewListCommand() *cobra.Command { var ( - output string - namespace string + output string ) var command = &cobra.Command{ Use: "list", Run: func(cmd *cobra.Command, args []string) { - argoClient, err := v1.GetClient() + client, err := v1.GetClient() errors.CheckError(err) - resp, err := argoClient.ListArchivedWorkflows(namespace) + namespace, err := client.Namespace() + errors.CheckError(err) + resp, err := client.ListArchivedWorkflows(namespace) errors.CheckError(err) switch output { case "json": @@ -50,6 +51,5 @@ func NewListCommand() *cobra.Command { }, } command.Flags().StringVarP(&output, "output", "o", "wide", "Output format. One of: json|yaml|wide") - command.Flags().StringVarP(&namespace, "namespace", "n", "", "The namespace") return command } diff --git a/cmd/argo/commands/artifact/list.go b/cmd/argo/commands/artifact/list.go new file mode 100644 index 000000000000..b675afd057fa --- /dev/null +++ b/cmd/argo/commands/artifact/list.go @@ -0,0 +1,54 @@ +package artifact + +import ( + "os" + + "github.com/spf13/cobra" +) + +func NewListCommand() *cobra.Command { + + var command = &cobra.Command{ + Use: "list WORKFLOW", + Short: "List a workfow's artifact", + Run: func(cmd *cobra.Command, args []string) { + if len(args) == 0 { + cmd.HelpFunc()(cmd, args) + os.Exit(1) + } + workflowName := args[0] + + conn := client.GetClientConn() + ctx := client.GetContext() + client := workflowarchive.NewArchivedWorkflowServiceClient(conn) + resp, err := client.ListArchivedWorkflows(ctx, &workflowarchive.ListArchivedWorkflowsRequest{ + ListOptions: &metav1.ListOptions{FieldSelector: "metadata.namespace=" + namespace}, + }) + if err != nil { + log.Fatal(err) + } + switch output { + case "json": + output, err := json.Marshal(resp.Items) + if err != nil { + log.Fatal(err) + } + fmt.Println(string(output)) + case "yaml": + output, err := yaml.Marshal(resp.Items) + if err != nil { + log.Fatal(err) + } + fmt.Println(string(output)) + default: + w := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', 0) + _, _ = fmt.Fprintln(w, "NAMESPACE", "NAME", "UID") + for _, item := range resp.Items { + _, _ = fmt.Fprintln(w, item.Namespace, item.Name, item.UID) + } + _ = w.Flush() + }, + } + + return command +} diff --git a/cmd/argo/commands/artifact/root.go b/cmd/argo/commands/artifact/root.go new file mode 100644 index 000000000000..580114ac5531 --- /dev/null +++ b/cmd/argo/commands/artifact/root.go @@ -0,0 +1,16 @@ +package artifact + +import ( + "github.com/spf13/cobra" +) + +func NewArchiveCommand() *cobra.Command { + var command = &cobra.Command{ + Use: "archive", + Run: func(cmd *cobra.Command, args []string) { + cmd.HelpFunc()(cmd, args) + }, + } + command.AddCommand(NewListCommand()) + return command +} diff --git a/cmd/argo/commands/client/v1/kube-client.go b/cmd/argo/commands/client/v1/kube-client.go index e308d7c13ca1..337d382f6555 100644 --- a/cmd/argo/commands/client/v1/kube-client.go +++ b/cmd/argo/commands/client/v1/kube-client.go @@ -11,7 +11,7 @@ import ( "github.com/argoproj/argo/workflow/packer" ) -var misuseError = fmt.Errorf("this doesn't make sense unless you are using argo server") +var misuseError = fmt.Errorf("this doesn't make sense unless you are using argo server, perhaps something like `export ARGO_SERVER=localhost:2746` would help") type kubeClient struct { versioned.Interface From 1a75fddde18770a6485912f9969dfabf38dd74b5 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Fri, 24 Jan 2020 17:33:22 -0800 Subject: [PATCH 04/34] removed files --- cmd/argo/commands/artifact/list.go | 54 ------------------------------ cmd/argo/commands/artifact/root.go | 16 --------- 2 files changed, 70 deletions(-) delete mode 100644 cmd/argo/commands/artifact/list.go delete mode 100644 cmd/argo/commands/artifact/root.go diff --git a/cmd/argo/commands/artifact/list.go b/cmd/argo/commands/artifact/list.go deleted file mode 100644 index b675afd057fa..000000000000 --- a/cmd/argo/commands/artifact/list.go +++ /dev/null @@ -1,54 +0,0 @@ -package artifact - -import ( - "os" - - "github.com/spf13/cobra" -) - -func NewListCommand() *cobra.Command { - - var command = &cobra.Command{ - Use: "list WORKFLOW", - Short: "List a workfow's artifact", - Run: func(cmd *cobra.Command, args []string) { - if len(args) == 0 { - cmd.HelpFunc()(cmd, args) - os.Exit(1) - } - workflowName := args[0] - - conn := client.GetClientConn() - ctx := client.GetContext() - client := workflowarchive.NewArchivedWorkflowServiceClient(conn) - resp, err := client.ListArchivedWorkflows(ctx, &workflowarchive.ListArchivedWorkflowsRequest{ - ListOptions: &metav1.ListOptions{FieldSelector: "metadata.namespace=" + namespace}, - }) - if err != nil { - log.Fatal(err) - } - switch output { - case "json": - output, err := json.Marshal(resp.Items) - if err != nil { - log.Fatal(err) - } - fmt.Println(string(output)) - case "yaml": - output, err := yaml.Marshal(resp.Items) - if err != nil { - log.Fatal(err) - } - fmt.Println(string(output)) - default: - w := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', 0) - _, _ = fmt.Fprintln(w, "NAMESPACE", "NAME", "UID") - for _, item := range resp.Items { - _, _ = fmt.Fprintln(w, item.Namespace, item.Name, item.UID) - } - _ = w.Flush() - }, - } - - return command -} diff --git a/cmd/argo/commands/artifact/root.go b/cmd/argo/commands/artifact/root.go deleted file mode 100644 index 580114ac5531..000000000000 --- a/cmd/argo/commands/artifact/root.go +++ /dev/null @@ -1,16 +0,0 @@ -package artifact - -import ( - "github.com/spf13/cobra" -) - -func NewArchiveCommand() *cobra.Command { - var command = &cobra.Command{ - Use: "archive", - Run: func(cmd *cobra.Command, args []string) { - cmd.HelpFunc()(cmd, args) - }, - } - command.AddCommand(NewListCommand()) - return command -} From 860076be5251791ff452720f5755cf6ecc045725 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Sun, 26 Jan 2020 18:40:06 -0800 Subject: [PATCH 05/34] test: fatal if no argo-e2e label --- test/e2e/argo_server_test.go | 5 ---- test/e2e/cli_test.go | 4 --- .../expectedfailures/failed-step-event.yaml | 2 ++ test/e2e/expectedfailures/failed-step.yaml | 2 ++ .../volumes-pvc-fail-event.yaml | 2 ++ test/e2e/fixtures/given.go | 25 ++++++++----------- test/e2e/functional/success-event.yaml | 2 ++ test/e2e/smoke/hello-world-workflow-tmpl.yaml | 2 ++ .../workflow-template-whalesay-template.yaml | 2 ++ .../workflow-template-nested-template.yaml | 2 ++ test/e2e/workflow_template_test.go | 2 ++ 11 files changed, 26 insertions(+), 24 deletions(-) diff --git a/test/e2e/argo_server_test.go b/test/e2e/argo_server_test.go index e61c66e78f83..7b2d3bc73cf6 100644 --- a/test/e2e/argo_server_test.go +++ b/test/e2e/argo_server_test.go @@ -36,11 +36,6 @@ func (s *ArgoServerSuite) BeforeTest(suiteName, testName string) { if err != nil { panic(err) } - -} - -func (s *ArgoServerSuite) AfterTest(suiteName, testName string) { - s.E2ESuite.AfterTest(suiteName, testName) } func (s *ArgoServerSuite) e(t *testing.T) *httpexpect.Expect { diff --git a/test/e2e/cli_test.go b/test/e2e/cli_test.go index 65d0c898366d..2575efc26f82 100644 --- a/test/e2e/cli_test.go +++ b/test/e2e/cli_test.go @@ -20,10 +20,6 @@ func (s *CLISuite) BeforeTest(suiteName, testName string) { _ = os.Unsetenv("ARGO_TOKEN") } -func (s *CLISuite) AfterTest(suiteName, testName string) { - s.E2ESuite.AfterTest(suiteName, testName) -} - func (s *CLISuite) TestCompletion() { s.Given().RunCli([]string{"completion", "bash"}, func(t *testing.T, output string, err error) { assert.NoError(t, err) diff --git a/test/e2e/expectedfailures/failed-step-event.yaml b/test/e2e/expectedfailures/failed-step-event.yaml index 8e159ef15303..af1d6615a8ba 100644 --- a/test/e2e/expectedfailures/failed-step-event.yaml +++ b/test/e2e/expectedfailures/failed-step-event.yaml @@ -5,6 +5,8 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: failed-step-event- + labels: + argo-e2e: true spec: entrypoint: exit templates: diff --git a/test/e2e/expectedfailures/failed-step.yaml b/test/e2e/expectedfailures/failed-step.yaml index 28ff4d67022d..a01747a86625 100644 --- a/test/e2e/expectedfailures/failed-step.yaml +++ b/test/e2e/expectedfailures/failed-step.yaml @@ -5,6 +5,8 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: failed-step- + labels: + argo-e2e: true spec: entrypoint: failed-step templates: diff --git a/test/e2e/expectedfailures/volumes-pvc-fail-event.yaml b/test/e2e/expectedfailures/volumes-pvc-fail-event.yaml index 69ad6c6fb772..f78ad374a433 100644 --- a/test/e2e/expectedfailures/volumes-pvc-fail-event.yaml +++ b/test/e2e/expectedfailures/volumes-pvc-fail-event.yaml @@ -4,6 +4,8 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: volumes-pvc-fail-event- + labels: + argo-e2e: true spec: entrypoint: volumes-pvc-example volumeClaimTemplates: diff --git a/test/e2e/fixtures/given.go b/test/e2e/fixtures/given.go index 61f13bdfe7d8..5d6e12d0f5a7 100644 --- a/test/e2e/fixtures/given.go +++ b/test/e2e/fixtures/given.go @@ -5,6 +5,7 @@ import ( "strings" "testing" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "sigs.k8s.io/yaml" @@ -62,15 +63,16 @@ func (g *Given) Workflow(text string) *Given { g.t.Fatal(err) } } - if g.wf.GetLabels() == nil { - g.wf.SetLabels(map[string]string{}) - } - if g.wf.GetLabels()[label] == "" { - g.wf.GetLabels()[label] = "true" - } + g.checkLabels(g.wf.ObjectMeta) return g } +func (g *Given) checkLabels(m metav1.ObjectMeta) { + if m.GetLabels()[label] == "" { + g.t.Fatalf("%s%s does not have %s label", m.Name, m.GenerateName, label) + } +} + func (g *Given) WorkflowName(name string) *Given { g.workflowName = name return g @@ -106,12 +108,7 @@ func (g *Given) WorkflowTemplate(text string) *Given { if err != nil { g.t.Fatal(err) } - if wfTemplate.GetLabels() == nil { - wfTemplate.SetLabels(map[string]string{}) - } - if wfTemplate.GetLabels()[label] == "" { - wfTemplate.GetLabels()[label] = "true" - } + g.checkLabels(wfTemplate.ObjectMeta) g.wfTemplates = append(g.wfTemplates, wfTemplate) } return g @@ -150,9 +147,7 @@ func (g *Given) CronWorkflow(text string) *Given { if g.cronWf.GetLabels() == nil { g.cronWf.SetLabels(map[string]string{}) } - if g.cronWf.GetLabels()[label] == "" { - g.cronWf.GetLabels()[label] = "true" - } + g.checkLabels(g.cronWf.ObjectMeta) } return g } diff --git a/test/e2e/functional/success-event.yaml b/test/e2e/functional/success-event.yaml index d63dd4406534..434212880ba7 100644 --- a/test/e2e/functional/success-event.yaml +++ b/test/e2e/functional/success-event.yaml @@ -5,6 +5,8 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: success-event- + labels: + argo-e2e: true spec: entrypoint: exit templates: diff --git a/test/e2e/smoke/hello-world-workflow-tmpl.yaml b/test/e2e/smoke/hello-world-workflow-tmpl.yaml index d229238614d7..bf67292a1f3a 100644 --- a/test/e2e/smoke/hello-world-workflow-tmpl.yaml +++ b/test/e2e/smoke/hello-world-workflow-tmpl.yaml @@ -2,6 +2,8 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: workflow-template-hello-world- + labels: + argo-e2e: true spec: entrypoint: whalesay templates: diff --git a/test/e2e/smoke/workflow-template-whalesay-template.yaml b/test/e2e/smoke/workflow-template-whalesay-template.yaml index 5f6615af9418..5ee1eb865285 100644 --- a/test/e2e/smoke/workflow-template-whalesay-template.yaml +++ b/test/e2e/smoke/workflow-template-whalesay-template.yaml @@ -2,6 +2,8 @@ apiVersion: argoproj.io/v1alpha1 kind: WorkflowTemplate metadata: name: workflow-template-whalesay-template + labels: + argo-e2e: true spec: templates: - name: whalesay-template diff --git a/test/e2e/testdata/workflow-template-nested-template.yaml b/test/e2e/testdata/workflow-template-nested-template.yaml index ddbf101026e8..ae16c23d1209 100644 --- a/test/e2e/testdata/workflow-template-nested-template.yaml +++ b/test/e2e/testdata/workflow-template-nested-template.yaml @@ -2,6 +2,8 @@ apiVersion: argoproj.io/v1alpha1 kind: WorkflowTemplate metadata: name: workflow-template-nested-template + labels: + argo-e2e: true spec: templates: - name: whalesay-inner-template diff --git a/test/e2e/workflow_template_test.go b/test/e2e/workflow_template_test.go index 1a9eb5afccd6..e2a13e64e59e 100644 --- a/test/e2e/workflow_template_test.go +++ b/test/e2e/workflow_template_test.go @@ -23,6 +23,8 @@ func (w *WorkflowTemplateSuite) TestNestedWorkflowTemplate() { kind: Workflow metadata: generateName: workflow-template-nested- + labels: + argo-e2e: true spec: entrypoint: whalesay templates: From f502a5ce4a4f1de632426f2ab0bc52ba4f14b641 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Mon, 27 Jan 2020 08:32:48 -0800 Subject: [PATCH 06/34] test: change archive assertion to ignore the status --- test/e2e/cli_with_server_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/e2e/cli_with_server_test.go b/test/e2e/cli_with_server_test.go index 4e6d433d4cb9..97fc2b72cf05 100644 --- a/test/e2e/cli_with_server_test.go +++ b/test/e2e/cli_with_server_test.go @@ -65,7 +65,14 @@ func (s *CLIWithServerSuite) TestArchive() { }). RunCli([]string{"archive", "get", string(uid)}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { - assert.Contains(t, output, "Succeeded") + assert.Contains(t, output, "Name:") + assert.Contains(t, output, "Namespace:") + assert.Contains(t, output, "ServiceAccount:") + assert.Contains(t, output, "Status:") + assert.Contains(t, output, "Created:") + assert.Contains(t, output, "Started:") + assert.Contains(t, output, "Finished:") + assert.Contains(t, output, "Duration:") } }). RunCli([]string{"archive", "delete", string(uid)}, func(t *testing.T, output string, err error) { From 41f6030ac64839193fbc53c94f4c111083169fbe Mon Sep 17 00:00:00 2001 From: Simon Behar Date: Mon, 27 Jan 2020 10:20:05 -0800 Subject: [PATCH 07/34] refactor: Move server code (cmd/server/ -> server/) (#2071) --- .codecov.yml | 2 +- .golangci.yml | 4 +- Makefile | 20 +-- cmd/argo/commands/common.go | 2 +- cmd/argo/commands/delete.go | 2 +- cmd/argo/commands/lint.go | 2 +- cmd/argo/commands/logs.go | 2 +- cmd/argo/commands/resubmit.go | 2 +- cmd/argo/commands/resume.go | 2 +- cmd/argo/commands/retry.go | 2 +- cmd/argo/commands/server.go | 2 +- cmd/argo/commands/suspend.go | 2 +- cmd/argo/commands/template/common.go | 2 +- cmd/argo/commands/template/create.go | 2 +- cmd/argo/commands/template/delete.go | 2 +- cmd/argo/commands/template/get.go | 2 +- cmd/argo/commands/template/lint.go | 2 +- cmd/argo/commands/template/list.go | 2 +- cmd/argo/commands/terminate.go | 2 +- cmd/argo/commands/wait.go | 2 +- cmd/argo/commands/watch.go | 2 +- docs/rest-api.md | 6 +- {cmd/server => server}/.gitignore | 0 .../server => server}/apiserver/argoserver.go | 17 +- .../artifacts/artifact_server.go | 2 +- {cmd/server => server}/artifacts/resources.go | 0 {cmd/server => server}/auth/authorizer.go | 0 .../server => server}/auth/authorizer_test.go | 0 {cmd/server => server}/auth/gatekeeper.go | 0 .../server => server}/auth/gatekeeper_test.go | 0 .../cronworkflow/cron-workflow.pb.go | 106 +++++------ .../cronworkflow/cron-workflow.pb.gw.go | 2 +- .../cronworkflow/cron-workflow.proto | 2 +- .../cronworkflow/cron-workflow.swagger.json | 2 +- .../cronworkflow/cron_workflow_server.go | 2 +- .../cronworkflow/cron_workflow_server_test.go | 3 +- {cmd/server => server}/info/info.pb.go | 56 +++--- {cmd/server => server}/info/info.pb.gw.go | 2 +- {cmd/server => server}/info/info.proto | 2 +- {cmd/server => server}/info/info.swagger.json | 2 +- {cmd/server => server}/info/info_server.go | 0 {cmd/server => server}/static/static.go | 0 .../workflow/forwarder_overwrite.go | 0 .../server => server}/workflow/workflow.pb.go | 168 +++++++++--------- .../workflow/workflow.pb.gw.go | 2 +- .../server => server}/workflow/workflow.proto | 2 +- .../workflow/workflow.swagger.json | 0 .../workflow/workflow_server.go | 3 +- .../workflow/workflow_server_test.go | 2 +- .../archived_workflow_server.go | 2 +- .../archived_workflow_server_test.go | 3 +- .../workflowarchive/workflow-archive.pb.go | 73 ++++---- .../workflowarchive/workflow-archive.pb.gw.go | 2 +- .../workflowarchive/workflow-archive.proto | 2 +- .../workflow-archive.swagger.json | 2 +- .../workflowtemplate/workflow-template.pb.go | 115 ++++++------ .../workflow-template.pb.gw.go | 2 +- .../workflowtemplate/workflow-template.proto | 2 +- .../workflow-template.swagger.json | 0 .../workflow_template_server.go | 2 +- .../workflow_template_server_test.go | 5 +- test/e2e/README.md | 4 +- .../workflows-list/workflows-list.tsx | 2 +- util/api/util.go | 2 +- 64 files changed, 332 insertions(+), 329 deletions(-) rename {cmd/server => server}/.gitignore (100%) rename {cmd/server => server}/apiserver/argoserver.go (96%) rename {cmd/server => server}/artifacts/artifact_server.go (99%) rename {cmd/server => server}/artifacts/resources.go (100%) rename {cmd/server => server}/auth/authorizer.go (100%) rename {cmd/server => server}/auth/authorizer_test.go (100%) rename {cmd/server => server}/auth/gatekeeper.go (100%) rename {cmd/server => server}/auth/gatekeeper_test.go (100%) rename {cmd/server => server}/cronworkflow/cron-workflow.pb.go (92%) rename {cmd/server => server}/cronworkflow/cron-workflow.pb.gw.go (99%) rename {cmd/server => server}/cronworkflow/cron-workflow.proto (97%) rename {cmd/server => server}/cronworkflow/cron-workflow.swagger.json (99%) rename {cmd/server => server}/cronworkflow/cron_workflow_server.go (97%) rename {cmd/server => server}/cronworkflow/cron_workflow_server_test.go (97%) rename {cmd/server => server}/info/info.pb.go (85%) rename {cmd/server => server}/info/info.pb.gw.go (99%) rename {cmd/server => server}/info/info.proto (89%) rename {cmd/server => server}/info/info.swagger.json (94%) rename {cmd/server => server}/info/info_server.go (100%) rename {cmd/server => server}/static/static.go (100%) rename {cmd/server => server}/workflow/forwarder_overwrite.go (100%) rename {cmd/server => server}/workflow/workflow.pb.go (94%) rename {cmd/server => server}/workflow/workflow.pb.gw.go (99%) rename {cmd/server => server}/workflow/workflow.proto (98%) rename {cmd/server => server}/workflow/workflow.swagger.json (100%) rename {cmd/server => server}/workflow/workflow_server.go (99%) rename {cmd/server => server}/workflow/workflow_server_test.go (99%) rename {cmd/server => server}/workflowarchive/archived_workflow_server.go (98%) rename {cmd/server => server}/workflowarchive/archived_workflow_server_test.go (98%) rename {cmd/server => server}/workflowarchive/workflow-archive.pb.go (89%) rename {cmd/server => server}/workflowarchive/workflow-archive.pb.gw.go (99%) rename {cmd/server => server}/workflowarchive/workflow-archive.proto (94%) rename {cmd/server => server}/workflowarchive/workflow-archive.swagger.json (99%) rename {cmd/server => server}/workflowtemplate/workflow-template.pb.go (92%) rename {cmd/server => server}/workflowtemplate/workflow-template.pb.gw.go (99%) rename {cmd/server => server}/workflowtemplate/workflow-template.proto (97%) rename {cmd/server => server}/workflowtemplate/workflow-template.swagger.json (100%) rename {cmd/server => server}/workflowtemplate/workflow_template_server.go (98%) rename {cmd/server => server}/workflowtemplate/workflow_template_server_test.go (97%) diff --git a/.codecov.yml b/.codecov.yml index db5454daa98d..9c251044255d 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,5 +1,5 @@ ignore: - - "cmd/server/static/files.go" + - "server/static/files.go" - "pkg/client" coverage: status: diff --git a/.golangci.yml b/.golangci.yml index 2775ba98f55d..fd934fc5df02 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,7 +6,7 @@ run: - vendor - ui skip-files: - - cmd/server/static/files.go + - server/static/files.go linters: enable: - goimports @@ -17,4 +17,4 @@ service: golangci-lint-version: 1.21.x project-path: github.com/argoproj/argo prepare: - - make vendor cmd/server/static/files.go CI=true \ No newline at end of file + - make vendor server/static/files.go CI=true \ No newline at end of file diff --git a/Makefile b/Makefile index 3072788a7308..ce705d9e0711 100644 --- a/Makefile +++ b/Makefile @@ -89,26 +89,26 @@ $(HOME)/go/bin/staticfiles: # Install the "staticfiles" tool go get bou.ke/staticfiles -cmd/server/static/files.go: $(HOME)/go/bin/staticfiles ui/dist/app +server/static/files.go: $(HOME)/go/bin/staticfiles ui/dist/app # Pack UI into a Go file. - staticfiles -o cmd/server/static/files.go ui/dist/app + staticfiles -o server/static/files.go ui/dist/app -dist/argo: vendor cmd/server/static/files.go $(CLI_PKGS) +dist/argo: vendor server/static/files.go $(CLI_PKGS) go build -v -i -ldflags '${LDFLAGS}' -o dist/argo ./cmd/argo -dist/argo-linux-amd64: vendor cmd/server/static/files.go $(CLI_PKGS) +dist/argo-linux-amd64: vendor server/static/files.go $(CLI_PKGS) CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -i -ldflags '${LDFLAGS}' -o dist/argo-linux-amd64 ./cmd/argo -dist/argo-linux-ppc64le: vendor cmd/server/static/files.go $(CLI_PKGS) +dist/argo-linux-ppc64le: vendor server/static/files.go $(CLI_PKGS) CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le go build -v -i -ldflags '${LDFLAGS}' -o dist/argo-linux-ppc64le ./cmd/argo -dist/argo-linux-s390x: vendor cmd/server/static/files.go $(CLI_PKGS) +dist/argo-linux-s390x: vendor server/static/files.go $(CLI_PKGS) CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le go build -v -i -ldflags '${LDFLAGS}' -o dist/argo-linux-s390x ./cmd/argo -dist/argo-darwin-amd64: vendor cmd/server/static/files.go $(CLI_PKGS) +dist/argo-darwin-amd64: vendor server/static/files.go $(CLI_PKGS) CGO_ENABLED=0 GOOS=darwin go build -v -i -ldflags '${LDFLAGS}' -o dist/argo-darwin-amd64 ./cmd/argo -dist/argo-windows-amd64: vendor cmd/server/static/files.go $(CLI_PKGS) +dist/argo-windows-amd64: vendor server/static/files.go $(CLI_PKGS) CGO_ENABLED=0 GOARCH=amd64 GOOS=windows go build -v -i -ldflags '${LDFLAGS}' -o dist/argo-windows-amd64 ./cmd/argo .PHONY: cli-image @@ -220,7 +220,7 @@ manifests/quick-start-postgres.yaml: dist/VERSION $(MANIFESTS) # lint/test/etc .PHONY: lint -lint: cmd/server/static/files.go +lint: server/static/files.go # Lint Go files golangci-lint run --fix --verbose ifeq ($(CI),false) @@ -229,7 +229,7 @@ ifeq ($(CI),false) endif .PHONY: test -test: cmd/server/static/files.go vendor +test: server/static/files.go vendor # Run unit tests ifeq ($(CI),false) go test `go list ./... | grep -v 'test/e2e'` diff --git a/cmd/argo/commands/common.go b/cmd/argo/commands/common.go index 1d376f208da5..76b05aad0f86 100644 --- a/cmd/argo/commands/common.go +++ b/cmd/argo/commands/common.go @@ -14,10 +14,10 @@ import ( "k8s.io/client-go/rest" "github.com/argoproj/argo/cmd/argo/commands/client" - wfApiServer "github.com/argoproj/argo/cmd/server/workflow" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" "github.com/argoproj/argo/pkg/client/clientset/versioned" "github.com/argoproj/argo/pkg/client/clientset/versioned/typed/workflow/v1alpha1" + wfApiServer "github.com/argoproj/argo/server/workflow" "github.com/argoproj/argo/workflow/templateresolution" ) diff --git a/cmd/argo/commands/delete.go b/cmd/argo/commands/delete.go index 4d37509e29dc..d332a9ddfd3c 100644 --- a/cmd/argo/commands/delete.go +++ b/cmd/argo/commands/delete.go @@ -8,7 +8,7 @@ import ( "time" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflow" + "github.com/argoproj/argo/server/workflow" argotime "github.com/argoproj/pkg/time" "github.com/spf13/cobra" diff --git a/cmd/argo/commands/lint.go b/cmd/argo/commands/lint.go index 85dc0848ef9b..8f49c66dd36c 100644 --- a/cmd/argo/commands/lint.go +++ b/cmd/argo/commands/lint.go @@ -11,8 +11,8 @@ import ( "google.golang.org/grpc" "github.com/argoproj/argo/cmd/argo/commands/client" - apiServer "github.com/argoproj/argo/cmd/server/workflow" "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" + apiServer "github.com/argoproj/argo/server/workflow" cmdutil "github.com/argoproj/argo/util/cmd" "github.com/argoproj/argo/workflow/validate" ) diff --git a/cmd/argo/commands/logs.go b/cmd/argo/commands/logs.go index deebada65413..9cdc56c19f6e 100644 --- a/cmd/argo/commands/logs.go +++ b/cmd/argo/commands/logs.go @@ -27,9 +27,9 @@ import ( "github.com/argoproj/pkg/errors" "github.com/argoproj/argo/cmd/argo/commands/client" - apiv1 "github.com/argoproj/argo/cmd/server/workflow" "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" workflowv1 "github.com/argoproj/argo/pkg/client/clientset/versioned/typed/workflow/v1alpha1" + apiv1 "github.com/argoproj/argo/server/workflow" "github.com/argoproj/argo/workflow/packer" ) diff --git a/cmd/argo/commands/resubmit.go b/cmd/argo/commands/resubmit.go index 19d5dfaf915f..78269c7e5b41 100644 --- a/cmd/argo/commands/resubmit.go +++ b/cmd/argo/commands/resubmit.go @@ -9,8 +9,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflow" "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" + "github.com/argoproj/argo/server/workflow" apiUtil "github.com/argoproj/argo/util/api" "github.com/argoproj/argo/workflow/util" ) diff --git a/cmd/argo/commands/resume.go b/cmd/argo/commands/resume.go index 542f5081c8c2..e309b2569d42 100644 --- a/cmd/argo/commands/resume.go +++ b/cmd/argo/commands/resume.go @@ -8,7 +8,7 @@ import ( "github.com/spf13/cobra" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflow" + "github.com/argoproj/argo/server/workflow" "github.com/argoproj/argo/workflow/util" ) diff --git a/cmd/argo/commands/retry.go b/cmd/argo/commands/retry.go index 38cb59eeee0f..dae322434fbe 100644 --- a/cmd/argo/commands/retry.go +++ b/cmd/argo/commands/retry.go @@ -10,7 +10,7 @@ import ( "github.com/argoproj/pkg/errors" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflow" + "github.com/argoproj/argo/server/workflow" "github.com/argoproj/argo/workflow/packer" "github.com/argoproj/argo/workflow/util" ) diff --git a/cmd/argo/commands/server.go b/cmd/argo/commands/server.go index 828cfb9f8c3b..3f23cf960efc 100644 --- a/cmd/argo/commands/server.go +++ b/cmd/argo/commands/server.go @@ -12,8 +12,8 @@ import ( _ "k8s.io/client-go/plugin/pkg/client/auth" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/apiserver" wfclientset "github.com/argoproj/argo/pkg/client/clientset/versioned" + "github.com/argoproj/argo/server/apiserver" ) func NewServerCommand() *cobra.Command { diff --git a/cmd/argo/commands/suspend.go b/cmd/argo/commands/suspend.go index 2cf9ac6d26ce..9121d6335d7a 100644 --- a/cmd/argo/commands/suspend.go +++ b/cmd/argo/commands/suspend.go @@ -8,7 +8,7 @@ import ( "github.com/spf13/cobra" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflow" + "github.com/argoproj/argo/server/workflow" "github.com/argoproj/argo/workflow/util" ) diff --git a/cmd/argo/commands/template/common.go b/cmd/argo/commands/template/common.go index d6d04c36db05..4acafc995cab 100644 --- a/cmd/argo/commands/template/common.go +++ b/cmd/argo/commands/template/common.go @@ -9,10 +9,10 @@ import ( "k8s.io/client-go/rest" "github.com/argoproj/argo/cmd/argo/commands/client" - wftmplApiServer "github.com/argoproj/argo/cmd/server/workflowtemplate" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" "github.com/argoproj/argo/pkg/client/clientset/versioned" "github.com/argoproj/argo/pkg/client/clientset/versioned/typed/workflow/v1alpha1" + wftmplApiServer "github.com/argoproj/argo/server/workflowtemplate" "github.com/argoproj/argo/workflow/templateresolution" ) diff --git a/cmd/argo/commands/template/create.go b/cmd/argo/commands/template/create.go index 949f2287a87e..329eabdf7f4c 100644 --- a/cmd/argo/commands/template/create.go +++ b/cmd/argo/commands/template/create.go @@ -8,8 +8,8 @@ import ( "github.com/spf13/cobra" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflowtemplate" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" + "github.com/argoproj/argo/server/workflowtemplate" "github.com/argoproj/argo/workflow/common" "github.com/argoproj/argo/workflow/templateresolution" "github.com/argoproj/argo/workflow/util" diff --git a/cmd/argo/commands/template/delete.go b/cmd/argo/commands/template/delete.go index 09e90ffc09cb..1c54ac8ac0c0 100644 --- a/cmd/argo/commands/template/delete.go +++ b/cmd/argo/commands/template/delete.go @@ -12,7 +12,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflowtemplate" + "github.com/argoproj/argo/server/workflowtemplate" "github.com/argoproj/argo/pkg/client/clientset/versioned/typed/workflow/v1alpha1" ) diff --git a/cmd/argo/commands/template/get.go b/cmd/argo/commands/template/get.go index a420e1f8da54..dbf2d01e6c9f 100644 --- a/cmd/argo/commands/template/get.go +++ b/cmd/argo/commands/template/get.go @@ -13,8 +13,8 @@ import ( "github.com/argoproj/pkg/humanize" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflowtemplate" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" + "github.com/argoproj/argo/server/workflowtemplate" ) func NewGetCommand() *cobra.Command { diff --git a/cmd/argo/commands/template/lint.go b/cmd/argo/commands/template/lint.go index 848f89b0e20a..ac709059cad7 100644 --- a/cmd/argo/commands/template/lint.go +++ b/cmd/argo/commands/template/lint.go @@ -11,8 +11,8 @@ import ( "google.golang.org/grpc" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflowtemplate" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" + "github.com/argoproj/argo/server/workflowtemplate" cmdutil "github.com/argoproj/argo/util/cmd" "github.com/argoproj/argo/workflow/validate" ) diff --git a/cmd/argo/commands/template/list.go b/cmd/argo/commands/template/list.go index 9354869a3dbe..e92334408bd4 100644 --- a/cmd/argo/commands/template/list.go +++ b/cmd/argo/commands/template/list.go @@ -12,9 +12,9 @@ import ( "k8s.io/apimachinery/pkg/labels" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflowtemplate" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" "github.com/argoproj/argo/pkg/client/clientset/versioned/typed/workflow/v1alpha1" + "github.com/argoproj/argo/server/workflowtemplate" ) type listFlags struct { diff --git a/cmd/argo/commands/terminate.go b/cmd/argo/commands/terminate.go index 4b81668699bc..88c1cf77edcd 100644 --- a/cmd/argo/commands/terminate.go +++ b/cmd/argo/commands/terminate.go @@ -8,7 +8,7 @@ import ( "github.com/spf13/cobra" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflow" + "github.com/argoproj/argo/server/workflow" "github.com/argoproj/argo/workflow/util" ) diff --git a/cmd/argo/commands/wait.go b/cmd/argo/commands/wait.go index fca6bb1024c0..0bdcac7d8779 100644 --- a/cmd/argo/commands/wait.go +++ b/cmd/argo/commands/wait.go @@ -13,7 +13,7 @@ import ( "k8s.io/apimachinery/pkg/fields" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflow" + "github.com/argoproj/argo/server/workflow" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" ) diff --git a/cmd/argo/commands/watch.go b/cmd/argo/commands/watch.go index f001ba4f90e6..e8c14da4869d 100644 --- a/cmd/argo/commands/watch.go +++ b/cmd/argo/commands/watch.go @@ -6,7 +6,7 @@ import ( "time" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflow" + "github.com/argoproj/argo/server/workflow" "github.com/argoproj/pkg/errors" "github.com/spf13/cobra" diff --git a/docs/rest-api.md b/docs/rest-api.md index b1903ed93738..70ba641cd8d2 100644 --- a/docs/rest-api.md +++ b/docs/rest-api.md @@ -17,9 +17,9 @@ To view the API: 1. Open [https://editor.swagger.io/](https://editor.swagger.io/) 2. Copy and paste either: - 1. ../cmd/server/workflow/workflow.swagger.json - 2. ../cmd/server/workflowtemplate/workflow-template.swagger.json - 1. ../cmd/server/workflowarchive/archived-workflows.swagger.json + 1. ../server/workflow/workflow.swagger.json + 2. ../server/workflowtemplate/workflow-template.swagger.json + 1. ../server/workflowarchive/archived-workflows.swagger.json > v2.4 and before diff --git a/cmd/server/.gitignore b/server/.gitignore similarity index 100% rename from cmd/server/.gitignore rename to server/.gitignore diff --git a/cmd/server/apiserver/argoserver.go b/server/apiserver/argoserver.go similarity index 96% rename from cmd/server/apiserver/argoserver.go rename to server/apiserver/argoserver.go index 0b34a85805af..9262c8ccea2c 100644 --- a/cmd/server/apiserver/argoserver.go +++ b/server/apiserver/argoserver.go @@ -6,6 +6,15 @@ import ( "net/http" "time" + "github.com/argoproj/argo/server/artifacts" + "github.com/argoproj/argo/server/auth" + "github.com/argoproj/argo/server/cronworkflow" + "github.com/argoproj/argo/server/info" + "github.com/argoproj/argo/server/static" + "github.com/argoproj/argo/server/workflow" + "github.com/argoproj/argo/server/workflowarchive" + "github.com/argoproj/argo/server/workflowtemplate" + grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" grpc_logrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus" "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -20,14 +29,6 @@ import ( "k8s.io/client-go/rest" "sigs.k8s.io/yaml" - "github.com/argoproj/argo/cmd/server/artifacts" - "github.com/argoproj/argo/cmd/server/auth" - "github.com/argoproj/argo/cmd/server/cronworkflow" - "github.com/argoproj/argo/cmd/server/info" - "github.com/argoproj/argo/cmd/server/static" - "github.com/argoproj/argo/cmd/server/workflow" - "github.com/argoproj/argo/cmd/server/workflowarchive" - "github.com/argoproj/argo/cmd/server/workflowtemplate" "github.com/argoproj/argo/errors" "github.com/argoproj/argo/persist/sqldb" "github.com/argoproj/argo/pkg/apiclient" diff --git a/cmd/server/artifacts/artifact_server.go b/server/artifacts/artifact_server.go similarity index 99% rename from cmd/server/artifacts/artifact_server.go rename to server/artifacts/artifact_server.go index ba76067901bf..e97831a09860 100644 --- a/cmd/server/artifacts/artifact_server.go +++ b/server/artifacts/artifact_server.go @@ -14,9 +14,9 @@ import ( "google.golang.org/grpc/status" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/argoproj/argo/cmd/server/auth" "github.com/argoproj/argo/persist/sqldb" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" + "github.com/argoproj/argo/server/auth" artifact "github.com/argoproj/argo/workflow/artifacts" "github.com/argoproj/argo/workflow/packer" ) diff --git a/cmd/server/artifacts/resources.go b/server/artifacts/resources.go similarity index 100% rename from cmd/server/artifacts/resources.go rename to server/artifacts/resources.go diff --git a/cmd/server/auth/authorizer.go b/server/auth/authorizer.go similarity index 100% rename from cmd/server/auth/authorizer.go rename to server/auth/authorizer.go diff --git a/cmd/server/auth/authorizer_test.go b/server/auth/authorizer_test.go similarity index 100% rename from cmd/server/auth/authorizer_test.go rename to server/auth/authorizer_test.go diff --git a/cmd/server/auth/gatekeeper.go b/server/auth/gatekeeper.go similarity index 100% rename from cmd/server/auth/gatekeeper.go rename to server/auth/gatekeeper.go diff --git a/cmd/server/auth/gatekeeper_test.go b/server/auth/gatekeeper_test.go similarity index 100% rename from cmd/server/auth/gatekeeper_test.go rename to server/auth/gatekeeper_test.go diff --git a/cmd/server/cronworkflow/cron-workflow.pb.go b/server/cronworkflow/cron-workflow.pb.go similarity index 92% rename from cmd/server/cronworkflow/cron-workflow.pb.go rename to server/cronworkflow/cron-workflow.pb.go index 585c1d7947d6..7cad62d06db9 100644 --- a/cmd/server/cronworkflow/cron-workflow.pb.go +++ b/server/cronworkflow/cron-workflow.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cmd/server/cronworkflow/cron-workflow.proto +// source: server/cronworkflow/cron-workflow.proto package cronworkflow @@ -44,7 +44,7 @@ func (m *CreateCronWorkflowRequest) Reset() { *m = CreateCronWorkflowReq func (m *CreateCronWorkflowRequest) String() string { return proto.CompactTextString(m) } func (*CreateCronWorkflowRequest) ProtoMessage() {} func (*CreateCronWorkflowRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e71e06cfb78f032a, []int{0} + return fileDescriptor_02ecfb52b8f4ca0d, []int{0} } func (m *CreateCronWorkflowRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -106,7 +106,7 @@ func (m *ListCronWorkflowsRequest) Reset() { *m = ListCronWorkflowsReque func (m *ListCronWorkflowsRequest) String() string { return proto.CompactTextString(m) } func (*ListCronWorkflowsRequest) ProtoMessage() {} func (*ListCronWorkflowsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e71e06cfb78f032a, []int{1} + return fileDescriptor_02ecfb52b8f4ca0d, []int{1} } func (m *ListCronWorkflowsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -162,7 +162,7 @@ func (m *GetCronWorkflowRequest) Reset() { *m = GetCronWorkflowRequest{} func (m *GetCronWorkflowRequest) String() string { return proto.CompactTextString(m) } func (*GetCronWorkflowRequest) ProtoMessage() {} func (*GetCronWorkflowRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e71e06cfb78f032a, []int{2} + return fileDescriptor_02ecfb52b8f4ca0d, []int{2} } func (m *GetCronWorkflowRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -225,7 +225,7 @@ func (m *UpdateCronWorkflowRequest) Reset() { *m = UpdateCronWorkflowReq func (m *UpdateCronWorkflowRequest) String() string { return proto.CompactTextString(m) } func (*UpdateCronWorkflowRequest) ProtoMessage() {} func (*UpdateCronWorkflowRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e71e06cfb78f032a, []int{3} + return fileDescriptor_02ecfb52b8f4ca0d, []int{3} } func (m *UpdateCronWorkflowRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -288,7 +288,7 @@ func (m *DeleteCronWorkflowRequest) Reset() { *m = DeleteCronWorkflowReq func (m *DeleteCronWorkflowRequest) String() string { return proto.CompactTextString(m) } func (*DeleteCronWorkflowRequest) ProtoMessage() {} func (*DeleteCronWorkflowRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e71e06cfb78f032a, []int{4} + return fileDescriptor_02ecfb52b8f4ca0d, []int{4} } func (m *DeleteCronWorkflowRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -348,7 +348,7 @@ func (m *CronWorkflowDeletedResponse) Reset() { *m = CronWorkflowDeleted func (m *CronWorkflowDeletedResponse) String() string { return proto.CompactTextString(m) } func (*CronWorkflowDeletedResponse) ProtoMessage() {} func (*CronWorkflowDeletedResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e71e06cfb78f032a, []int{5} + return fileDescriptor_02ecfb52b8f4ca0d, []int{5} } func (m *CronWorkflowDeletedResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -387,51 +387,51 @@ func init() { } func init() { - proto.RegisterFile("cmd/server/cronworkflow/cron-workflow.proto", fileDescriptor_e71e06cfb78f032a) -} - -var fileDescriptor_e71e06cfb78f032a = []byte{ - // 638 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x96, 0x4f, 0x6b, 0xd4, 0x4e, - 0x18, 0xc7, 0x99, 0xf6, 0x47, 0xa1, 0xd3, 0x5f, 0x11, 0x47, 0x91, 0x6d, 0xac, 0xa5, 0x84, 0x62, - 0xff, 0xd1, 0x99, 0x6e, 0xdb, 0x83, 0x78, 0x10, 0xb4, 0x95, 0x5e, 0x0a, 0x4a, 0x8a, 0x48, 0xbd, - 0x4d, 0xb3, 0x8f, 0xd9, 0xb8, 0xbb, 0x99, 0x38, 0x33, 0x4d, 0x11, 0xe9, 0xc5, 0xbb, 0x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0xf4, 0xad, - 0xbb, 0x80, 0x1e, 0x6d, 0x96, 0x7e, 0xa6, 0x4b, 0xfe, 0x64, 0x1c, 0x4f, 0x99, 0xcf, 0xee, 0xf6, - 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x34, 0x28, 0x9d, 0xdc, 0x86, 0x08, 0x00, 0x00, + proto.RegisterFile("server/cronworkflow/cron-workflow.proto", fileDescriptor_02ecfb52b8f4ca0d) +} + +var fileDescriptor_02ecfb52b8f4ca0d = []byte{ + // 632 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x96, 0xcf, 0x6e, 0xd3, 0x40, + 0x10, 0xc6, 0xb5, 0x2d, 0xaa, 0xd4, 0x2d, 0x15, 0x62, 0x41, 0x28, 0x35, 0x25, 0xaa, 0xac, 0x8a, + 0xb4, 0x81, 0xae, 0x49, 0xdb, 0x03, 0xea, 0x0d, 0x52, 0xd4, 0x4b, 0x25, 0x90, 0x2b, 0x84, 0xca, + 0x6d, 0xeb, 0x0c, 0x8e, 0x49, 0xe2, 0x35, 0xbb, 0x5b, 0x57, 0x08, 0xf5, 0xc2, 0x9d, 0x13, 0x47, + 0x78, 0x00, 0x2e, 0xc0, 0x05, 0xf1, 0x0c, 0x1c, 0x91, 0x78, 0x01, 0x14, 0xf1, 0x16, 0x1c, 0x40, + 0xde, 0xc4, 0xf1, 0x9f, 0xc4, 0xc2, 0xd0, 0x70, 0x1b, 0x7b, 0x77, 0x66, 0x7e, 0xfb, 0x65, 0xbe, + 0x75, 0x70, 0x4d, 0x82, 0x08, 0x41, 0x58, 0x8e, 0xe0, 0xfe, 0x09, 0x17, 0x9d, 0x27, 0x5d, 0x7e, + 0xa2, 0x1f, 0x36, 0xe2, 0x27, 0x1a, 0x08, 0xae, 0x38, 0x39, 0x9f, 0xde, 0x61, 0x5c, 0x76, 0xb9, + 0xcb, 0xf5, 0x82, 0x15, 0x45, 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 0x74, + 0x07, 0xd5, 0xc9, 0x07, 0x84, 0x2f, 0x8e, 0x39, 0x8f, 0x5c, 0xcf, 0x02, 0x17, 0x59, 0xd3, 0xb8, + 0x77, 0x66, 0xde, 0xa8, 0xb4, 0x59, 0xd7, 0xcc, 0xab, 0xa4, 0x04, 0x33, 0x79, 0x8f, 0xf0, 0x85, + 0x9c, 0x35, 0xc9, 0x6a, 0x16, 0x77, 0xb2, 0x73, 0xa7, 0x21, 0x6e, 0x43, 0x83, 0xde, 0x20, 0xeb, + 0x7f, 0x06, 0x1d, 0xc4, 0xa7, 0xe4, 0x33, 0xc2, 0x64, 0xdc, 0xab, 0xf9, 0x91, 0x28, 0x74, 0xf3, + 0x34, 0xa8, 0xb7, 0x35, 0x35, 0x35, 0xca, 0x53, 0x47, 0x93, 0xf1, 0x06, 0x61, 0x32, 0xee, 0xd6, + 0x3c, 0x78, 0xa1, 0x9f, 0x8d, 0xf5, 0xfc, 0xd0, 0x17, 0xda, 0x29, 0x96, 0xb5, 0x5e, 0x1e, 0xf0, + 0xee, 0xce, 0x97, 0x7e, 0x15, 0x7d, 0xed, 0x57, 0xd1, 0xf7, 0x7e, 0x15, 0x3d, 0xbe, 0x59, 0xf8, + 0x99, 0x9e, 0xf0, 0x07, 0xe3, 0x68, 0x4e, 0x7f, 0x72, 0xb7, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, + 0x95, 0xe2, 0x7d, 0x1a, 0x7e, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -655,7 +655,7 @@ var _CronWorkflowService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "cmd/server/cronworkflow/cron-workflow.proto", + Metadata: "server/cronworkflow/cron-workflow.proto", } func (m *CreateCronWorkflowRequest) Marshal() (dAtA []byte, err error) { diff --git a/cmd/server/cronworkflow/cron-workflow.pb.gw.go b/server/cronworkflow/cron-workflow.pb.gw.go similarity index 99% rename from cmd/server/cronworkflow/cron-workflow.pb.gw.go rename to server/cronworkflow/cron-workflow.pb.gw.go index 6dafb793c6f2..05545936878f 100644 --- a/cmd/server/cronworkflow/cron-workflow.pb.gw.go +++ b/server/cronworkflow/cron-workflow.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: cmd/server/cronworkflow/cron-workflow.proto +// source: server/cronworkflow/cron-workflow.proto /* Package cronworkflow is a reverse proxy. diff --git a/cmd/server/cronworkflow/cron-workflow.proto b/server/cronworkflow/cron-workflow.proto similarity index 97% rename from cmd/server/cronworkflow/cron-workflow.proto rename to server/cronworkflow/cron-workflow.proto index bf6498b1df0b..c602d7f0126b 100644 --- a/cmd/server/cronworkflow/cron-workflow.proto +++ b/server/cronworkflow/cron-workflow.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -option go_package = "github.com/argoproj/argo/cmd/server/cronworkflow"; +option go_package = "github.com/argoproj/argo/server/cronworkflow"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; diff --git a/cmd/server/cronworkflow/cron-workflow.swagger.json b/server/cronworkflow/cron-workflow.swagger.json similarity index 99% rename from cmd/server/cronworkflow/cron-workflow.swagger.json rename to server/cronworkflow/cron-workflow.swagger.json index 1df3ed600246..0c6a80cac71e 100644 --- a/cmd/server/cronworkflow/cron-workflow.swagger.json +++ b/server/cronworkflow/cron-workflow.swagger.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "title": "cmd/server/cronworkflow/cron-workflow.proto", + "title": "server/cronworkflow/cron-workflow.proto", "version": "version not set" }, "consumes": [ diff --git a/cmd/server/cronworkflow/cron_workflow_server.go b/server/cronworkflow/cron_workflow_server.go similarity index 97% rename from cmd/server/cronworkflow/cron_workflow_server.go rename to server/cronworkflow/cron_workflow_server.go index b00ac84c3408..93b0b427318f 100644 --- a/cmd/server/cronworkflow/cron_workflow_server.go +++ b/server/cronworkflow/cron_workflow_server.go @@ -5,8 +5,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/argoproj/argo/cmd/server/auth" "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" + "github.com/argoproj/argo/server/auth" ) type cronWorkflowServiceServer struct { diff --git a/cmd/server/cronworkflow/cron_workflow_server_test.go b/server/cronworkflow/cron_workflow_server_test.go similarity index 97% rename from cmd/server/cronworkflow/cron_workflow_server_test.go rename to server/cronworkflow/cron_workflow_server_test.go index 5182219623d1..1dbf4f37e4a9 100644 --- a/cmd/server/cronworkflow/cron_workflow_server_test.go +++ b/server/cronworkflow/cron_workflow_server_test.go @@ -4,10 +4,11 @@ import ( "context" "testing" + "github.com/argoproj/argo/server/auth" + "github.com/stretchr/testify/assert" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/argoproj/argo/cmd/server/auth" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" wftFake "github.com/argoproj/argo/pkg/client/clientset/versioned/fake" ) diff --git a/cmd/server/info/info.pb.go b/server/info/info.pb.go similarity index 85% rename from cmd/server/info/info.pb.go rename to server/info/info.pb.go index 91e924d566b8..5001edcd3d89 100644 --- a/cmd/server/info/info.pb.go +++ b/server/info/info.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cmd/server/info/info.proto +// source: server/info/info.proto package info @@ -41,7 +41,7 @@ func (m *GetInfoRequest) Reset() { *m = GetInfoRequest{} } func (m *GetInfoRequest) String() string { return proto.CompactTextString(m) } func (*GetInfoRequest) ProtoMessage() {} func (*GetInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8b893c3550e6e6df, []int{0} + return fileDescriptor_bc6e4252b6544a4e, []int{0} } func (m *GetInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -81,7 +81,7 @@ func (m *InfoResponse) Reset() { *m = InfoResponse{} } func (m *InfoResponse) String() string { return proto.CompactTextString(m) } func (*InfoResponse) ProtoMessage() {} func (*InfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8b893c3550e6e6df, []int{1} + return fileDescriptor_bc6e4252b6544a4e, []int{1} } func (m *InfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -122,30 +122,30 @@ func init() { proto.RegisterType((*InfoResponse)(nil), "info.InfoResponse") } -func init() { proto.RegisterFile("cmd/server/info/info.proto", fileDescriptor_8b893c3550e6e6df) } - -var fileDescriptor_8b893c3550e6e6df = []byte{ - // 312 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xc1, 0x4a, 0x3b, 0x31, - 0x10, 0xc6, 0xd9, 0x3f, 0x7f, 0x14, 0xd7, 0x52, 0xca, 0xd2, 0x83, 0x2c, 0x52, 0x64, 0x4f, 0xc5, - 0xc3, 0x0e, 0x55, 0x11, 0xf1, 0xa8, 0x07, 0xe9, 0xc5, 0x43, 0xbd, 0x88, 0xb7, 0xe9, 0x76, 0x9a, - 0xc6, 0x36, 0x99, 0x98, 0xa4, 0x5b, 0xbc, 0xfa, 0x0a, 0xbe, 0x94, 0x47, 0xc1, 0x17, 0x90, 0xe2, - 0x83, 0xc8, 0xa6, 0x0b, 0x55, 0xab, 0x97, 0x30, 0xf9, 0x3e, 0xbe, 0xf9, 0x25, 0x33, 0x71, 0x5a, - 0xa8, 0x11, 0x38, 0xb2, 0x25, 0x59, 0x90, 0x7a, 0xcc, 0xe1, 0xc8, 0x8d, 0x65, 0xcf, 0xc9, 0xff, - 0xaa, 0x4e, 0xdb, 0x82, 0x05, 0x07, 0x01, 0xaa, 0x6a, 0xe5, 0xa5, 0xfb, 0x82, 0x59, 0xcc, 0x08, - 0xd0, 0x48, 0x40, 0xad, 0xd9, 0xa3, 0x97, 0xac, 0x5d, 0xed, 0x9e, 0x4c, 0xcf, 0x5c, 0x2e, 0xb9, - 0x72, 0x15, 0x16, 0x13, 0xa9, 0xc9, 0x3e, 0x82, 0x99, 0x8a, 0x4a, 0x70, 0xa0, 0xc8, 0x23, 0x94, - 0x3d, 0x10, 0xa4, 0xc9, 0xa2, 0xa7, 0x51, 0x9d, 0xba, 0x14, 0xd2, 0x4f, 0xe6, 0xc3, 0xbc, 0x60, - 0x05, 0x68, 0x03, 0xf4, 0x3e, 0x14, 0xeb, 0xe8, 0x82, 0xed, 0x74, 0x3c, 0xe3, 0x05, 0x94, 0x3d, - 0x9c, 0x99, 0x09, 0x6e, 0x36, 0xc9, 0xd6, 0x68, 0x28, 0xd8, 0xd2, 0x2f, 0xa0, 0xac, 0x15, 0x37, - 0xaf, 0xc8, 0xf7, 0xf5, 0x98, 0x07, 0xf4, 0x30, 0x27, 0xe7, 0xb3, 0xf3, 0xb8, 0xb1, 0xba, 0x3a, - 0xc3, 0xda, 0x51, 0x72, 0x18, 0xb7, 0x14, 0x6a, 0x14, 0x34, 0xba, 0x46, 0x45, 0xce, 0x60, 0x41, - 0x7b, 0xd1, 0x41, 0xd4, 0xdd, 0x19, 0x6c, 0xe8, 0x47, 0xb7, 0xf1, 0x6e, 0x95, 0xbd, 0x21, 0x5b, - 0xca, 0x82, 0x92, 0x7e, 0xbc, 0x5d, 0x37, 0x4f, 0xda, 0x79, 0x98, 0xe6, 0x77, 0x56, 0x9a, 0xac, - 0xd4, 0xaf, 0xbc, 0xac, 0xfd, 0xf4, 0xf6, 0xf1, 0xfc, 0xaf, 0x99, 0x34, 0xc2, 0xbb, 0xcb, 0x5e, - 0x58, 0xc3, 0xc5, 0xe9, 0xcb, 0xb2, 0x13, 0xbd, 0x2e, 0x3b, 0xd1, 0xfb, 0xb2, 0x13, 0xdd, 0x75, - 0xff, 0x1c, 0xcf, 0x8f, 0x1d, 0x0e, 0xb7, 0xc2, 0x37, 0x8f, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, - 0x05, 0xce, 0x15, 0x70, 0xdd, 0x01, 0x00, 0x00, +func init() { proto.RegisterFile("server/info/info.proto", fileDescriptor_bc6e4252b6544a4e) } + +var fileDescriptor_bc6e4252b6544a4e = []byte{ + // 308 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xc1, 0x4a, 0x03, 0x31, + 0x10, 0x86, 0x59, 0x11, 0xc5, 0x58, 0x4a, 0x09, 0x45, 0xa4, 0x48, 0x91, 0xc5, 0x83, 0x78, 0xd8, + 0xd0, 0xea, 0x41, 0x3c, 0xea, 0x41, 0x7a, 0xf1, 0x50, 0x2f, 0xe2, 0x6d, 0xba, 0x9d, 0xa6, 0xb1, + 0xdd, 0x4c, 0x4c, 0xd2, 0x2d, 0x5e, 0x7d, 0x05, 0x5f, 0xca, 0xa3, 0xe0, 0x0b, 0xc8, 0xe2, 0x83, + 0xc8, 0x66, 0x17, 0x5a, 0xa9, 0x5e, 0xc2, 0xe4, 0xff, 0xf9, 0xe7, 0x4b, 0x66, 0xd8, 0x81, 0x43, + 0x9b, 0xa3, 0x15, 0x4a, 0x4f, 0x28, 0x1c, 0x89, 0xb1, 0xe4, 0x89, 0x6f, 0x97, 0x75, 0xa7, 0x2d, + 0x49, 0x52, 0x10, 0x44, 0x59, 0x55, 0x5e, 0xe7, 0x48, 0x12, 0xc9, 0x39, 0x0a, 0x30, 0x4a, 0x80, + 0xd6, 0xe4, 0xc1, 0x2b, 0xd2, 0xae, 0x76, 0x2f, 0x66, 0x97, 0x2e, 0x51, 0x54, 0xba, 0x19, 0xa4, + 0x53, 0xa5, 0xd1, 0xbe, 0x08, 0x33, 0x93, 0xa5, 0xe0, 0x44, 0x86, 0x1e, 0x44, 0xde, 0x13, 0x12, + 0x35, 0x5a, 0xf0, 0x38, 0xae, 0x53, 0x37, 0x52, 0xf9, 0xe9, 0x62, 0x94, 0xa4, 0x94, 0x09, 0xb0, + 0x01, 0xfa, 0x14, 0x8a, 0x55, 0x74, 0x49, 0x76, 0x36, 0x99, 0xd3, 0x52, 0xe4, 0x3d, 0x98, 0x9b, + 0x29, 0x6c, 0x36, 0x89, 0x57, 0x68, 0x91, 0x92, 0xc5, 0x3f, 0x40, 0x71, 0x8b, 0x35, 0x6f, 0xd1, + 0x0f, 0xf4, 0x84, 0x86, 0xf8, 0xbc, 0x40, 0xe7, 0xe3, 0x2b, 0xd6, 0xa8, 0xae, 0xce, 0x90, 0x76, + 0xc8, 0xcf, 0x58, 0x2b, 0x03, 0x0d, 0x12, 0xc7, 0x77, 0x90, 0xa1, 0x33, 0x90, 0xe2, 0x61, 0x74, + 0x1c, 0x9d, 0xee, 0x0d, 0x37, 0xf4, 0xfe, 0x03, 0xdb, 0x2f, 0xb3, 0xf7, 0x68, 0x73, 0x95, 0x22, + 0x1f, 0xb0, 0xdd, 0xba, 0x39, 0x6f, 0x27, 0x61, 0x9a, 0xbf, 0x59, 0x1d, 0x5e, 0xa9, 0xeb, 0xbc, + 0xb8, 0xfd, 0xfa, 0xf9, 0xfd, 0xb6, 0xd5, 0xe4, 0x8d, 0xf0, 0xee, 0xbc, 0x17, 0xd6, 0x70, 0xdd, + 0x7f, 0x2f, 0xba, 0xd1, 0x47, 0xd1, 0x8d, 0xbe, 0x8a, 0x6e, 0xf4, 0x78, 0xf2, 0xef, 0x78, 0xd6, + 0xf6, 0x37, 0xda, 0x09, 0x5f, 0x3c, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x1e, 0xdc, 0xbc, 0xc6, + 0xd5, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -225,7 +225,7 @@ var _InfoService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "cmd/server/info/info.proto", + Metadata: "server/info/info.proto", } func (m *GetInfoRequest) Marshal() (dAtA []byte, err error) { diff --git a/cmd/server/info/info.pb.gw.go b/server/info/info.pb.gw.go similarity index 99% rename from cmd/server/info/info.pb.gw.go rename to server/info/info.pb.gw.go index f1ac742bd078..3f7eb316976f 100644 --- a/cmd/server/info/info.pb.gw.go +++ b/server/info/info.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: cmd/server/info/info.proto +// source: server/info/info.proto /* Package info is a reverse proxy. diff --git a/cmd/server/info/info.proto b/server/info/info.proto similarity index 89% rename from cmd/server/info/info.proto rename to server/info/info.proto index c8697d88db17..cc3cc7c8687e 100644 --- a/cmd/server/info/info.proto +++ b/server/info/info.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -option go_package = "github.com/argoproj/argo/cmd/server/info"; +option go_package = "github.com/argoproj/argo/server/info"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; diff --git a/cmd/server/info/info.swagger.json b/server/info/info.swagger.json similarity index 94% rename from cmd/server/info/info.swagger.json rename to server/info/info.swagger.json index 99a3cc9a7af1..d9739808f9d1 100644 --- a/cmd/server/info/info.swagger.json +++ b/server/info/info.swagger.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "title": "cmd/server/info/info.proto", + "title": "server/info/info.proto", "version": "version not set" }, "consumes": [ diff --git a/cmd/server/info/info_server.go b/server/info/info_server.go similarity index 100% rename from cmd/server/info/info_server.go rename to server/info/info_server.go diff --git a/cmd/server/static/static.go b/server/static/static.go similarity index 100% rename from cmd/server/static/static.go rename to server/static/static.go diff --git a/cmd/server/workflow/forwarder_overwrite.go b/server/workflow/forwarder_overwrite.go similarity index 100% rename from cmd/server/workflow/forwarder_overwrite.go rename to server/workflow/forwarder_overwrite.go diff --git a/cmd/server/workflow/workflow.pb.go b/server/workflow/workflow.pb.go similarity index 94% rename from cmd/server/workflow/workflow.pb.go rename to server/workflow/workflow.pb.go index 33d795b0c94e..8fc32b9a7bfb 100644 --- a/cmd/server/workflow/workflow.pb.go +++ b/server/workflow/workflow.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cmd/server/workflow/workflow.proto +// source: server/workflow/workflow.proto // Workflow Service // @@ -50,7 +50,7 @@ func (m *WorkflowCreateRequest) Reset() { *m = WorkflowCreateRequest{} } func (m *WorkflowCreateRequest) String() string { return proto.CompactTextString(m) } func (*WorkflowCreateRequest) ProtoMessage() {} func (*WorkflowCreateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_192bc67c39cca05a, []int{0} + return fileDescriptor_2af0e6384e310358, []int{0} } func (m *WorkflowCreateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -127,7 +127,7 @@ func (m *WorkflowGetRequest) Reset() { *m = WorkflowGetRequest{} } func (m *WorkflowGetRequest) String() string { return proto.CompactTextString(m) } func (*WorkflowGetRequest) ProtoMessage() {} func (*WorkflowGetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_192bc67c39cca05a, []int{1} + return fileDescriptor_2af0e6384e310358, []int{1} } func (m *WorkflowGetRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -189,7 +189,7 @@ func (m *WorkflowListRequest) Reset() { *m = WorkflowListRequest{} } func (m *WorkflowListRequest) String() string { return proto.CompactTextString(m) } func (*WorkflowListRequest) ProtoMessage() {} func (*WorkflowListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_192bc67c39cca05a, []int{2} + return fileDescriptor_2af0e6384e310358, []int{2} } func (m *WorkflowListRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -245,7 +245,7 @@ func (m *WorkflowResubmitRequest) Reset() { *m = WorkflowResubmitRequest func (m *WorkflowResubmitRequest) String() string { return proto.CompactTextString(m) } func (*WorkflowResubmitRequest) ProtoMessage() {} func (*WorkflowResubmitRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_192bc67c39cca05a, []int{3} + return fileDescriptor_2af0e6384e310358, []int{3} } func (m *WorkflowResubmitRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -307,7 +307,7 @@ func (m *WorkflowRetryRequest) Reset() { *m = WorkflowRetryRequest{} } func (m *WorkflowRetryRequest) String() string { return proto.CompactTextString(m) } func (*WorkflowRetryRequest) ProtoMessage() {} func (*WorkflowRetryRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_192bc67c39cca05a, []int{4} + return fileDescriptor_2af0e6384e310358, []int{4} } func (m *WorkflowRetryRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -362,7 +362,7 @@ func (m *WorkflowResumeRequest) Reset() { *m = WorkflowResumeRequest{} } func (m *WorkflowResumeRequest) String() string { return proto.CompactTextString(m) } func (*WorkflowResumeRequest) ProtoMessage() {} func (*WorkflowResumeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_192bc67c39cca05a, []int{5} + return fileDescriptor_2af0e6384e310358, []int{5} } func (m *WorkflowResumeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -417,7 +417,7 @@ func (m *WorkflowTerminateRequest) Reset() { *m = WorkflowTerminateReque func (m *WorkflowTerminateRequest) String() string { return proto.CompactTextString(m) } func (*WorkflowTerminateRequest) ProtoMessage() {} func (*WorkflowTerminateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_192bc67c39cca05a, []int{6} + return fileDescriptor_2af0e6384e310358, []int{6} } func (m *WorkflowTerminateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -472,7 +472,7 @@ func (m *WorkflowSuspendRequest) Reset() { *m = WorkflowSuspendRequest{} func (m *WorkflowSuspendRequest) String() string { return proto.CompactTextString(m) } func (*WorkflowSuspendRequest) ProtoMessage() {} func (*WorkflowSuspendRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_192bc67c39cca05a, []int{7} + return fileDescriptor_2af0e6384e310358, []int{7} } func (m *WorkflowSuspendRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -529,7 +529,7 @@ func (m *WorkflowLogRequest) Reset() { *m = WorkflowLogRequest{} } func (m *WorkflowLogRequest) String() string { return proto.CompactTextString(m) } func (*WorkflowLogRequest) ProtoMessage() {} func (*WorkflowLogRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_192bc67c39cca05a, []int{8} + return fileDescriptor_2af0e6384e310358, []int{8} } func (m *WorkflowLogRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -599,7 +599,7 @@ func (m *WorkflowDeleteRequest) Reset() { *m = WorkflowDeleteRequest{} } func (m *WorkflowDeleteRequest) String() string { return proto.CompactTextString(m) } func (*WorkflowDeleteRequest) ProtoMessage() {} func (*WorkflowDeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_192bc67c39cca05a, []int{9} + return fileDescriptor_2af0e6384e310358, []int{9} } func (m *WorkflowDeleteRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -659,7 +659,7 @@ func (m *WorkflowDeleteResponse) Reset() { *m = WorkflowDeleteResponse{} func (m *WorkflowDeleteResponse) String() string { return proto.CompactTextString(m) } func (*WorkflowDeleteResponse) ProtoMessage() {} func (*WorkflowDeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_192bc67c39cca05a, []int{10} + return fileDescriptor_2af0e6384e310358, []int{10} } func (m *WorkflowDeleteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -700,7 +700,7 @@ func (m *WatchWorkflowsRequest) Reset() { *m = WatchWorkflowsRequest{} } func (m *WatchWorkflowsRequest) String() string { return proto.CompactTextString(m) } func (*WatchWorkflowsRequest) ProtoMessage() {} func (*WatchWorkflowsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_192bc67c39cca05a, []int{11} + return fileDescriptor_2af0e6384e310358, []int{11} } func (m *WatchWorkflowsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -757,7 +757,7 @@ func (m *WorkflowWatchEvent) Reset() { *m = WorkflowWatchEvent{} } func (m *WorkflowWatchEvent) String() string { return proto.CompactTextString(m) } func (*WorkflowWatchEvent) ProtoMessage() {} func (*WorkflowWatchEvent) Descriptor() ([]byte, []int) { - return fileDescriptor_192bc67c39cca05a, []int{12} + return fileDescriptor_2af0e6384e310358, []int{12} } func (m *WorkflowWatchEvent) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -811,7 +811,7 @@ func (m *LogEntry) Reset() { *m = LogEntry{} } func (m *LogEntry) String() string { return proto.CompactTextString(m) } func (*LogEntry) ProtoMessage() {} func (*LogEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_192bc67c39cca05a, []int{13} + return fileDescriptor_2af0e6384e310358, []int{13} } func (m *LogEntry) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -859,7 +859,7 @@ func (m *WorkflowLintRequest) Reset() { *m = WorkflowLintRequest{} } func (m *WorkflowLintRequest) String() string { return proto.CompactTextString(m) } func (*WorkflowLintRequest) ProtoMessage() {} func (*WorkflowLintRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_192bc67c39cca05a, []int{14} + return fileDescriptor_2af0e6384e310358, []int{14} } func (m *WorkflowLintRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -920,76 +920,76 @@ func init() { proto.RegisterType((*WorkflowLintRequest)(nil), "workflow.WorkflowLintRequest") } -func init() { proto.RegisterFile("cmd/server/workflow/workflow.proto", fileDescriptor_192bc67c39cca05a) } +func init() { proto.RegisterFile("server/workflow/workflow.proto", fileDescriptor_2af0e6384e310358) } -var fileDescriptor_192bc67c39cca05a = []byte{ - // 1055 bytes of a gzipped FileDescriptorProto +var fileDescriptor_2af0e6384e310358 = []byte{ + // 1052 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x97, 0x4f, 0x6f, 0xdc, 0x44, 0x14, 0xc0, 0x35, 0x69, 0x68, 0xb7, 0x2f, 0xcd, 0x16, 0x86, 0x02, 0x2b, 0x2b, 0xdd, 0xa6, 0x43, - 0x0b, 0x51, 0x9a, 0xd8, 0xd9, 0xa4, 0x40, 0x89, 0xc4, 0xa1, 0x24, 0x55, 0x28, 0x5a, 0x41, 0xe5,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0x7b, 0xe8, 0x4b, 0x7d, 0xe7, 0xa4, 0xfc, 0x88, 0xdd, 0xf8, 0x2f, + 0x00, 0x00, 0xff, 0xff, 0x02, 0xf6, 0x61, 0x76, 0xc3, 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1520,7 +1520,7 @@ var _WorkflowService_serviceDesc = grpc.ServiceDesc{ ServerStreams: true, }, }, - Metadata: "cmd/server/workflow/workflow.proto", + Metadata: "server/workflow/workflow.proto", } func (m *WorkflowCreateRequest) Marshal() (dAtA []byte, err error) { diff --git a/cmd/server/workflow/workflow.pb.gw.go b/server/workflow/workflow.pb.gw.go similarity index 99% rename from cmd/server/workflow/workflow.pb.gw.go rename to server/workflow/workflow.pb.gw.go index 85327ac7a409..6058c4b0e5e2 100644 --- a/cmd/server/workflow/workflow.pb.gw.go +++ b/server/workflow/workflow.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: cmd/server/workflow/workflow.proto +// source: server/workflow/workflow.proto /* Package workflow is a reverse proxy. diff --git a/cmd/server/workflow/workflow.proto b/server/workflow/workflow.proto similarity index 98% rename from cmd/server/workflow/workflow.proto rename to server/workflow/workflow.proto index 90505401351c..471980b0e800 100644 --- a/cmd/server/workflow/workflow.proto +++ b/server/workflow/workflow.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -option go_package = "github.com/argoproj/argo/cmd/server/workflow"; +option go_package = "github.com/argoproj/argo/server/workflow"; import "gogoproto/gogo.proto"; diff --git a/cmd/server/workflow/workflow.swagger.json b/server/workflow/workflow.swagger.json similarity index 100% rename from cmd/server/workflow/workflow.swagger.json rename to server/workflow/workflow.swagger.json diff --git a/cmd/server/workflow/workflow_server.go b/server/workflow/workflow_server.go similarity index 99% rename from cmd/server/workflow/workflow_server.go rename to server/workflow/workflow_server.go index 4498514cc44d..cd74d55ba8ed 100644 --- a/cmd/server/workflow/workflow_server.go +++ b/server/workflow/workflow_server.go @@ -4,11 +4,12 @@ import ( "bufio" "fmt" + "github.com/argoproj/argo/server/auth" + log "github.com/sirupsen/logrus" "golang.org/x/net/context" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/argoproj/argo/cmd/server/auth" "github.com/argoproj/argo/persist/sqldb" "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" "github.com/argoproj/argo/workflow/common" diff --git a/cmd/server/workflow/workflow_server_test.go b/server/workflow/workflow_server_test.go similarity index 99% rename from cmd/server/workflow/workflow_server_test.go rename to server/workflow/workflow_server_test.go index dceb458a15bd..5ed56c9a998f 100644 --- a/cmd/server/workflow/workflow_server_test.go +++ b/server/workflow/workflow_server_test.go @@ -13,11 +13,11 @@ import ( "k8s.io/client-go/kubernetes/fake" ktesting "k8s.io/client-go/testing" - "github.com/argoproj/argo/cmd/server/auth" "github.com/argoproj/argo/persist/sqldb" "github.com/argoproj/argo/persist/sqldb/mocks" "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" v1alpha "github.com/argoproj/argo/pkg/client/clientset/versioned/fake" + "github.com/argoproj/argo/server/auth" ) const wf1 = ` diff --git a/cmd/server/workflowarchive/archived_workflow_server.go b/server/workflowarchive/archived_workflow_server.go similarity index 98% rename from cmd/server/workflowarchive/archived_workflow_server.go rename to server/workflowarchive/archived_workflow_server.go index e1ca683f2fd3..652159714d28 100644 --- a/cmd/server/workflowarchive/archived_workflow_server.go +++ b/server/workflowarchive/archived_workflow_server.go @@ -11,9 +11,9 @@ import ( "google.golang.org/grpc/status" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/argoproj/argo/cmd/server/auth" "github.com/argoproj/argo/persist/sqldb" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" + "github.com/argoproj/argo/server/auth" ) type archivedWorkflowServer struct { diff --git a/cmd/server/workflowarchive/archived_workflow_server_test.go b/server/workflowarchive/archived_workflow_server_test.go similarity index 98% rename from cmd/server/workflowarchive/archived_workflow_server_test.go rename to server/workflowarchive/archived_workflow_server_test.go index f778db69b4eb..55cfe67c8ee7 100644 --- a/cmd/server/workflowarchive/archived_workflow_server_test.go +++ b/server/workflowarchive/archived_workflow_server_test.go @@ -4,6 +4,8 @@ import ( "context" "testing" + "github.com/argoproj/argo/server/auth" + "github.com/stretchr/testify/assert" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -14,7 +16,6 @@ import ( kubefake "k8s.io/client-go/kubernetes/fake" k8stesting "k8s.io/client-go/testing" - "github.com/argoproj/argo/cmd/server/auth" "github.com/argoproj/argo/persist/sqldb/mocks" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" argofake "github.com/argoproj/argo/pkg/client/clientset/versioned/fake" diff --git a/cmd/server/workflowarchive/workflow-archive.pb.go b/server/workflowarchive/workflow-archive.pb.go similarity index 89% rename from cmd/server/workflowarchive/workflow-archive.pb.go rename to server/workflowarchive/workflow-archive.pb.go index 1e0a56c6ab8d..f5169c1e0632 100644 --- a/cmd/server/workflowarchive/workflow-archive.pb.go +++ b/server/workflowarchive/workflow-archive.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cmd/server/workflowarchive/workflow-archive.proto +// source: server/workflowarchive/workflow-archive.proto package workflowarchive @@ -42,7 +42,7 @@ func (m *ListArchivedWorkflowsRequest) Reset() { *m = ListArchivedWorkfl func (m *ListArchivedWorkflowsRequest) String() string { return proto.CompactTextString(m) } func (*ListArchivedWorkflowsRequest) ProtoMessage() {} func (*ListArchivedWorkflowsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_393acb86a8d0f616, []int{0} + return fileDescriptor_d8c091cafb6e62fe, []int{0} } func (m *ListArchivedWorkflowsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -89,7 +89,7 @@ func (m *GetArchivedWorkflowRequest) Reset() { *m = GetArchivedWorkflowR func (m *GetArchivedWorkflowRequest) String() string { return proto.CompactTextString(m) } func (*GetArchivedWorkflowRequest) ProtoMessage() {} func (*GetArchivedWorkflowRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_393acb86a8d0f616, []int{1} + return fileDescriptor_d8c091cafb6e62fe, []int{1} } func (m *GetArchivedWorkflowRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -136,7 +136,7 @@ func (m *DeleteArchivedWorkflowRequest) Reset() { *m = DeleteArchivedWor func (m *DeleteArchivedWorkflowRequest) String() string { return proto.CompactTextString(m) } func (*DeleteArchivedWorkflowRequest) ProtoMessage() {} func (*DeleteArchivedWorkflowRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_393acb86a8d0f616, []int{2} + return fileDescriptor_d8c091cafb6e62fe, []int{2} } func (m *DeleteArchivedWorkflowRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -182,7 +182,7 @@ func (m *ArchivedWorkflowDeletedResponse) Reset() { *m = ArchivedWorkflo func (m *ArchivedWorkflowDeletedResponse) String() string { return proto.CompactTextString(m) } func (*ArchivedWorkflowDeletedResponse) ProtoMessage() {} func (*ArchivedWorkflowDeletedResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_393acb86a8d0f616, []int{3} + return fileDescriptor_d8c091cafb6e62fe, []int{3} } func (m *ArchivedWorkflowDeletedResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -219,41 +219,40 @@ func init() { } func init() { - proto.RegisterFile("cmd/server/workflowarchive/workflow-archive.proto", fileDescriptor_393acb86a8d0f616) + proto.RegisterFile("server/workflowarchive/workflow-archive.proto", fileDescriptor_d8c091cafb6e62fe) } -var fileDescriptor_393acb86a8d0f616 = []byte{ - // 466 bytes of a gzipped FileDescriptorProto +var fileDescriptor_d8c091cafb6e62fe = []byte{ + // 464 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcd, 0x8a, 0x13, 0x41, 0x10, 0xa6, 0x55, 0x04, 0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x17, 0x84, 0xb7, 0xd4, - 0x22, 0x31, 0x16, 0xd7, 0x10, 0x71, 0x47, 0x7b, 0x87, 0xda, 0xf9, 0xe1, 0x72, 0xc3, 0xf4, 0x75, - 0x0d, 0xea, 0x46, 0xf8, 0x7e, 0x86, 0xce, 0xb3, 0x23, 0xba, 0x93, 0x69, 0xe7, 0x5f, 0x15, 0x61, - 0xa7, 0x3b, 0x64, 0x97, 0xec, 0xed, 0xec, 0xc7, 0xb0, 0x44, 0x86, 0xd3, 0x4b, 0x41, 0x31, 0x51, - 0x55, 0xc2, 0x41, 0xb5, 0x14, 0x94, 0x31, 0x1c, 0xb6, 0x83, 0xa3, 0xd3, 0x28, 0x1c, 0x68, 0xf4, - 0x12, 0x3b, 0x9c, 0x0d, 0xe5, 0x35, 0x7a, 0x71, 0xa6, 0xd3, 0x40, 0x75, 0x65, 0x54, 0x85, 0x3c, - 0xa6, 0x77, 0x5f, 0x60, 0x86, 0x1e, 0xff, 0x7f, 0xe4, 0x3e, 0xbd, 0xb7, 0xda, 0xbc, 0x84, 0x48, - 0x47, 0xe8, 0x0a, 0x93, 0x3b, 0xdc, 0xff, 0x7a, 0x89, 0xde, 0x5e, 0xed, 0x39, 0x42, 0x5b, 0xea, - 0x04, 0xd9, 0x0f, 0x42, 0x6f, 0xae, 0xbd, 0x0b, 0x1b, 0xc0, 0xca, 0xbf, 0x02, 0xce, 0xba, 0x5f, - 0x34, 0x84, 0xd6, 0x49, 0x68, 0x9c, 0x0c, 0x41, 0x7b, 0xaf, 0x06, 0x10, 0x1a, 0x27, 0xa1, 0x81, - 0xa9, 0xa0, 0x39, 0xff, 0xfc, 0xfb, 0xef, 0x97, 0x0b, 0x3d, 0x16, 0x05, 0x23, 0xcb, 0x58, 0xd4, - 0xc4, 0xe9, 0x60, 0x7e, 0xa2, 0xea, 0x3b, 0xa1, 0xd7, 0xd7, 0x9c, 0x94, 0x3d, 0xec, 0xa8, 0xdd, - 0x7c, 0xf8, 0xe8, 0xe9, 0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0x90, 0xfd, + 0x20, 0xf4, 0x66, 0xef, 0x5d, 0xd8, 0x08, 0xd6, 0xfe, 0x15, 0x70, 0xda, 0xfd, 0xa2, 0x7d, 0x68, + 0x9d, 0x84, 0xc6, 0xc9, 0x10, 0xb4, 0xf7, 0x6a, 0x00, 0xa1, 0x71, 0x12, 0x1a, 0x98, 0x0a, 0x9a, + 0xf3, 0xcf, 0xbf, 0xff, 0x7e, 0xb9, 0x30, 0x60, 0x51, 0x30, 0xb2, 0x8c, 0x45, 0x4d, 0x9c, 0x8e, + 0x16, 0xc7, 0xaa, 0xbe, 0x13, 0x7a, 0xbd, 0xe7, 0xa4, 0xec, 0x61, 0x47, 0xed, 0xe6, 0xc3, 0x47, + 0x7b, 0xe7, 0xd2, 0xca, 0x77, 0x82, 0x4e, 0xce, 0xb6, 0x37, 0xeb, 0x14, 0x1f, 0xe7, 0x3a, 0xfd, + 0xc4, 0xbe, 0x11, 0x7a, 0xab, 0xdf, 0x50, 0x06, 0x1d, 0xc1, 0xa7, 0x3a, 0x1f, 0x3d, 0xea, 0xf4, + 0x9f, 0x61, 0x7b, 0x23, 0xf3, 0xc1, 0x99, 0x32, 0x9f, 0xed, 0xfd, 0x5c, 0x0e, 0xc9, 0xaf, 0xe5, + 0x90, 0xfc, 0x59, 0x0e, 0xc9, 0x1b, 0xb1, 0xf1, 0x49, 0xf6, 0x7f, 0x55, 0x8e, 0x2e, 0x87, 0x17, + 0xf6, 0xf8, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4b, 0xcf, 0xc4, 0x0e, 0x76, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -405,7 +404,7 @@ var _ArchivedWorkflowService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "cmd/server/workflowarchive/workflow-archive.proto", + Metadata: "server/workflowarchive/workflow-archive.proto", } func (m *ListArchivedWorkflowsRequest) Marshal() (dAtA []byte, err error) { diff --git a/cmd/server/workflowarchive/workflow-archive.pb.gw.go b/server/workflowarchive/workflow-archive.pb.gw.go similarity index 99% rename from cmd/server/workflowarchive/workflow-archive.pb.gw.go rename to server/workflowarchive/workflow-archive.pb.gw.go index 8ed3b55b2d9d..42e8d911c919 100644 --- a/cmd/server/workflowarchive/workflow-archive.pb.gw.go +++ b/server/workflowarchive/workflow-archive.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: cmd/server/workflowarchive/workflow-archive.proto +// source: server/workflowarchive/workflow-archive.proto /* Package workflowarchive is a reverse proxy. diff --git a/cmd/server/workflowarchive/workflow-archive.proto b/server/workflowarchive/workflow-archive.proto similarity index 94% rename from cmd/server/workflowarchive/workflow-archive.proto rename to server/workflowarchive/workflow-archive.proto index 95a096979bd6..6b012f50b52c 100644 --- a/cmd/server/workflowarchive/workflow-archive.proto +++ b/server/workflowarchive/workflow-archive.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -option go_package = "github.com/argoproj/argo/cmd/server/workflowarchive"; +option go_package = "github.com/argoproj/argo/server/workflowarchive"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; diff --git a/cmd/server/workflowarchive/workflow-archive.swagger.json b/server/workflowarchive/workflow-archive.swagger.json similarity index 99% rename from cmd/server/workflowarchive/workflow-archive.swagger.json rename to server/workflowarchive/workflow-archive.swagger.json index cdf02cda680a..bb8a6206a707 100644 --- a/cmd/server/workflowarchive/workflow-archive.swagger.json +++ b/server/workflowarchive/workflow-archive.swagger.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "title": "cmd/server/workflowarchive/workflow-archive.proto", + "title": "server/workflowarchive/workflow-archive.proto", "version": "version not set" }, "consumes": [ diff --git a/cmd/server/workflowtemplate/workflow-template.pb.go b/server/workflowtemplate/workflow-template.pb.go similarity index 92% rename from cmd/server/workflowtemplate/workflow-template.pb.go rename to server/workflowtemplate/workflow-template.pb.go index f999972b5925..690253d56d0d 100644 --- a/cmd/server/workflowtemplate/workflow-template.pb.go +++ b/server/workflowtemplate/workflow-template.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cmd/server/workflowtemplate/workflow-template.proto +// source: server/workflowtemplate/workflow-template.proto // Workflow Service // @@ -48,7 +48,7 @@ func (m *WorkflowTemplateCreateRequest) Reset() { *m = WorkflowTemplateC func (m *WorkflowTemplateCreateRequest) String() string { return proto.CompactTextString(m) } func (*WorkflowTemplateCreateRequest) ProtoMessage() {} func (*WorkflowTemplateCreateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ffa03b43b9ae30de, []int{0} + return fileDescriptor_73c94a413b9efa43, []int{0} } func (m *WorkflowTemplateCreateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -111,7 +111,7 @@ func (m *WorkflowTemplateGetRequest) Reset() { *m = WorkflowTemplateGetR func (m *WorkflowTemplateGetRequest) String() string { return proto.CompactTextString(m) } func (*WorkflowTemplateGetRequest) ProtoMessage() {} func (*WorkflowTemplateGetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ffa03b43b9ae30de, []int{1} + return fileDescriptor_73c94a413b9efa43, []int{1} } func (m *WorkflowTemplateGetRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -173,7 +173,7 @@ func (m *WorkflowTemplateListRequest) Reset() { *m = WorkflowTemplateLis func (m *WorkflowTemplateListRequest) String() string { return proto.CompactTextString(m) } func (*WorkflowTemplateListRequest) ProtoMessage() {} func (*WorkflowTemplateListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ffa03b43b9ae30de, []int{2} + return fileDescriptor_73c94a413b9efa43, []int{2} } func (m *WorkflowTemplateListRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -229,7 +229,7 @@ func (m *WorkflowTemplateUpdateRequest) Reset() { *m = WorkflowTemplateU func (m *WorkflowTemplateUpdateRequest) String() string { return proto.CompactTextString(m) } func (*WorkflowTemplateUpdateRequest) ProtoMessage() {} func (*WorkflowTemplateUpdateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ffa03b43b9ae30de, []int{3} + return fileDescriptor_73c94a413b9efa43, []int{3} } func (m *WorkflowTemplateUpdateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -292,7 +292,7 @@ func (m *WorkflowTemplateDeleteRequest) Reset() { *m = WorkflowTemplateD func (m *WorkflowTemplateDeleteRequest) String() string { return proto.CompactTextString(m) } func (*WorkflowTemplateDeleteRequest) ProtoMessage() {} func (*WorkflowTemplateDeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ffa03b43b9ae30de, []int{4} + return fileDescriptor_73c94a413b9efa43, []int{4} } func (m *WorkflowTemplateDeleteRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -352,7 +352,7 @@ func (m *WorkflowDeleteResponse) Reset() { *m = WorkflowDeleteResponse{} func (m *WorkflowDeleteResponse) String() string { return proto.CompactTextString(m) } func (*WorkflowDeleteResponse) ProtoMessage() {} func (*WorkflowDeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ffa03b43b9ae30de, []int{5} + return fileDescriptor_73c94a413b9efa43, []int{5} } func (m *WorkflowDeleteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -394,7 +394,7 @@ func (m *WorkflowTemplateLintRequest) Reset() { *m = WorkflowTemplateLin func (m *WorkflowTemplateLintRequest) String() string { return proto.CompactTextString(m) } func (*WorkflowTemplateLintRequest) ProtoMessage() {} func (*WorkflowTemplateLintRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ffa03b43b9ae30de, []int{6} + return fileDescriptor_73c94a413b9efa43, []int{6} } func (m *WorkflowTemplateLintRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -455,55 +455,54 @@ func init() { } func init() { - proto.RegisterFile("cmd/server/workflowtemplate/workflow-template.proto", fileDescriptor_ffa03b43b9ae30de) -} - -var fileDescriptor_ffa03b43b9ae30de = []byte{ - // 689 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0x41, 0x6b, 0xd4, 0x4e, - 0x14, 0x67, 0xda, 0x3f, 0x7f, 0xec, 0x94, 0x82, 0x8c, 0x75, 0x5d, 0x62, 0x2d, 0x65, 0x0e, 0xb2, - 0xb4, 0x76, 0xa6, 0xdb, 0x56, 0x29, 0x3d, 0xb6, 0x95, 0x22, 0x14, 0x94, 0x54, 0x91, 0x7a, 0x9b, - 0x66, 0x9f, 0x69, 0xdc, 0x6c, 0x26, 0x66, 0xa6, 0x5b, 0x44, 0x7a, 0xf1, 0x13, 0x08, 0x7e, 0x01, - 0x8f, 0x22, 0x1e, 0xfd, 0x02, 0xa2, 0x07, 0xf1, 0x24, 0xf8, 0x05, 0xa4, 0xf8, 0x25, 0xc4, 0x8b, - 0x64, 0xb2, 0xd9, 0x64, 0xb3, 0xdb, 0x36, 0xad, 0xeb, 0xc9, 0xdb, 0x30, 0x33, 0xef, 0xbd, 0xdf, - 0xef, 0xbd, 0x5f, 0x7e, 0x19, 0xbc, 0xe4, 0xb4, 0x1a, 0x5c, 0x41, 0xd4, 0x86, 0x88, 0x1f, 0xc8, - 0xa8, 0xf9, 0xd8, 0x97, 0x07, 0x1a, 0x5a, 0xa1, 0x2f, 0x34, 0x74, 0x37, 0xe6, 0xd3, 0x1d, 0x16, - 0x46, 0x52, 0x4b, 0x72, 0xb1, 0x78, 0xd3, 0x9a, 0x74, 0xa5, 0x2b, 0xcd, 0x21, 0x8f, 0x57, 0xc9, - 0x3d, 0x6b, 0xca, 0x95, 0xd2, 0xf5, 0x81, 0x8b, 0xd0, 0xe3, 0x22, 0x08, 0xa4, 0x16, 0xda, 0x93, - 0x81, 0xea, 0x9c, 0x2e, 0x37, 0x57, 0x14, 0xf3, 0x64, 0x7c, 0xda, 0x12, 0xce, 0x9e, 0x17, 0x40, -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 0xf8, - 0x93, 0xf5, 0x61, 0xcc, 0xe1, 0x72, 0x6c, 0x1f, 0xc5, 0x7c, 0x8a, 0xcc, 0x9f, 0xce, 0x22, 0xe7, - 0x6e, 0xd6, 0x9d, 0xa1, 0xd0, 0x88, 0x33, 0x52, 0x66, 0xa8, 0xd4, 0x48, 0xc9, 0x51, 0x90, 0x2f, - 0x08, 0x57, 0x12, 0x57, 0x3b, 0x8f, 0x9a, 0x7a, 0xfc, 0x70, 0x58, 0xd3, 0x58, 0x31, 0x14, 0x16, - 0xad, 0xb3, 0x4d, 0x23, 0x16, 0xd5, 0x5b, 0x84, 0x2b, 0x89, 0x8b, 0x9c, 0x87, 0x4c, 0x8f, 0x4b, - 0x5a, 0xb5, 0xe3, 0x03, 0x0a, 0x46, 0xd5, 0x51, 0xcf, 0xec, 0x19, 0xd5, 0xf3, 0x09, 0xe1, 0xc9, - 0xd8, 0xcf, 0xfa, 0xa0, 0x96, 0x12, 0x4f, 0x30, 0xec, 0x6f, 0xe0, 0x96, 0x61, 0xb1, 0x40, 0xe7, - 0x4a, 0xb2, 0xf0, 0xbd, 0x40, 0xaf, 0xa2, 0xd9, 0xb5, 0xb5, 0xcf, 0x47, 0xd3, 0xe8, 0xeb, 0xd1, - 0x34, 0xfa, 0x7e, 0x34, 0x8d, 0x1e, 0x2d, 0x1f, 0xfb, 0xa2, 0x3b, 0xe1, 0x6d, 0xba, 0xfb, 0xbf, - 0x79, 0xa5, 0x2d, 0xfd, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xe5, 0x17, 0x92, 0xa3, 0xc1, 0x0a, 0x00, - 0x00, + proto.RegisterFile("server/workflowtemplate/workflow-template.proto", fileDescriptor_73c94a413b9efa43) +} + +var fileDescriptor_73c94a413b9efa43 = []byte{ + // 686 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0xcd, 0x6a, 0x14, 0x4d, + 0x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 0xb3, 0x96, 0xec, 0x70, 0x11, 0x9a, 0xa2, 0x8f, + 0xcd, 0x22, 0x0b, 0x4d, 0xd1, 0xf1, 0x6e, 0x53, 0x78, 0xc1, 0xae, 0xe8, 0x4f, 0x42, 0xb3, 0xd2, + 0xbc, 0x25, 0x43, 0x18, 0x50, 0x88, 0xfe, 0x44, 0xf8, 0xd2, 0x83, 0x24, 0xd3, 0xbd, 0x84, 0xe7, + 0x6a, 0x08, 0x42, 0x83, 0x0d, 0x4f, 0xf6, 0x40, 0x69, 0x32, 0x85, 0xc7, 0x7c, 0xd1, 0x01, 0x15, + 0x88, 0x16, 0xd4, 0xd1, 0x0c, 0x6a, 0x8c, 0xd9, 0xd9, 0x06, 0x11, 0xf8, 0x4c, 0xda, 0x9e, 0xfa, + 0xc8, 0x0c, 0x6a, 0x8c, 0x2f, 0xde, 0x62, 0x19, 0x76, 0x96, 0x62, 0x37, 0x0b, 0x16, 0xb4, 0x1d, + 0x16, 0x61, 0x67, 0x29, 0x76, 0x96, 0x62, 0x67, 0x65, 0x0c, 0x76, 0x2f, 0x2d, 0xd9, 0xc2, 0x13, + 0x2d, 0x83, 0xe8, 0x4e, 0x60, 0x1a, 0x5b, 0x1f, 0x35, 0x75, 0x96, 0x58, 0x4c, 0x8f, 0xe5, 0x3b, + 0x9b, 0x95, 0x88, 0x3a, 0xcb, 0xba, 0x4d, 0xb6, 0x9a, 0x0f, 0xb5, 0x8b, 0x99, 0xe8, 0x2b, 0x84, + 0xad, 0x72, 0xe5, 0x75, 0xd0, 0x29, 0x75, 0x82, 0xff, 0x8b, 0x98, 0x26, 0xac, 0xcd, 0xba, 0xd8, + 0x8e, 0x91, 0x72, 0x3b, 0xee, 0x62, 0xec, 0x80, 0x2e, 0x02, 0x5d, 0xa8, 0x06, 0x74, 0xbd, 0x17, + 0x67, 0xe7, 0x72, 0xd0, 0x17, 0x08, 0x5f, 0x2c, 0x43, 0xdc, 0x70, 0x95, 0xae, 0x36, 0x9e, 0x4d, +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 0x99, 0xa1, 0xd2, 0x20, 0x15, 0x47, 0x41, 0x3e, 0x23, 0x5c, 0x8b, + 0x5d, 0xed, 0x34, 0x6a, 0x2a, 0xf8, 0xe1, 0xb0, 0xa6, 0xb1, 0x6c, 0x28, 0x2c, 0x5a, 0x27, 0x9b, + 0x46, 0x24, 0xaa, 0x37, 0x08, 0xd7, 0x62, 0x17, 0x39, 0x0d, 0x99, 0x82, 0x4b, 0x5a, 0x8d, 0xa3, + 0x03, 0x4a, 0x46, 0x95, 0xa8, 0x67, 0xf6, 0x84, 0xea, 0xf9, 0x88, 0xf0, 0x64, 0xe4, 0x67, 0x7d, + 0x50, 0x2b, 0x89, 0xc7, 0x1f, 0xf6, 0x37, 0x70, 0xdd, 0xb0, 0x58, 0xa0, 0x73, 0x15, 0x59, 0x78, + 0xae, 0xaf, 0x57, 0xd0, 0xec, 0xcd, 0x1b, 0x9f, 0x0e, 0xa7, 0xd1, 0x97, 0xc3, 0x69, 0xf4, 0xed, + 0x70, 0x1a, 0x3d, 0x5c, 0x38, 0xf2, 0x45, 0x77, 0xc4, 0xbb, 0x74, 0xfb, 0x7f, 0xf3, 0x42, 0x5b, + 0xfa, 0x15, 0x00, 0x00, 0xff, 0xff, 0x44, 0x24, 0xc1, 0x3b, 0xb9, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -763,7 +762,7 @@ var _WorkflowTemplateService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "cmd/server/workflowtemplate/workflow-template.proto", + Metadata: "server/workflowtemplate/workflow-template.proto", } func (m *WorkflowTemplateCreateRequest) Marshal() (dAtA []byte, err error) { diff --git a/cmd/server/workflowtemplate/workflow-template.pb.gw.go b/server/workflowtemplate/workflow-template.pb.gw.go similarity index 99% rename from cmd/server/workflowtemplate/workflow-template.pb.gw.go rename to server/workflowtemplate/workflow-template.pb.gw.go index 1b4de88931d6..4d116eaee4d6 100644 --- a/cmd/server/workflowtemplate/workflow-template.pb.gw.go +++ b/server/workflowtemplate/workflow-template.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: cmd/server/workflowtemplate/workflow-template.proto +// source: server/workflowtemplate/workflow-template.proto /* Package workflowtemplate is a reverse proxy. diff --git a/cmd/server/workflowtemplate/workflow-template.proto b/server/workflowtemplate/workflow-template.proto similarity index 97% rename from cmd/server/workflowtemplate/workflow-template.proto rename to server/workflowtemplate/workflow-template.proto index 04c00929c196..1c78dbd80db7 100644 --- a/cmd/server/workflowtemplate/workflow-template.proto +++ b/server/workflowtemplate/workflow-template.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -option go_package = "github.com/argoproj/argo/cmd/server/workflowtemplate"; +option go_package = "github.com/argoproj/argo/server/workflowtemplate"; import "gogoproto/gogo.proto"; diff --git a/cmd/server/workflowtemplate/workflow-template.swagger.json b/server/workflowtemplate/workflow-template.swagger.json similarity index 100% rename from cmd/server/workflowtemplate/workflow-template.swagger.json rename to server/workflowtemplate/workflow-template.swagger.json diff --git a/cmd/server/workflowtemplate/workflow_template_server.go b/server/workflowtemplate/workflow_template_server.go similarity index 98% rename from cmd/server/workflowtemplate/workflow_template_server.go rename to server/workflowtemplate/workflow_template_server.go index 428ec4c57dda..8bb9c098274c 100644 --- a/cmd/server/workflowtemplate/workflow_template_server.go +++ b/server/workflowtemplate/workflow_template_server.go @@ -7,8 +7,8 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/argoproj/argo/cmd/server/auth" "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" + "github.com/argoproj/argo/server/auth" "github.com/argoproj/argo/workflow/templateresolution" "github.com/argoproj/argo/workflow/validate" ) diff --git a/cmd/server/workflowtemplate/workflow_template_server_test.go b/server/workflowtemplate/workflow_template_server_test.go similarity index 97% rename from cmd/server/workflowtemplate/workflow_template_server_test.go rename to server/workflowtemplate/workflow_template_server_test.go index 4f87434e9b13..c191c08232dc 100644 --- a/cmd/server/workflowtemplate/workflow_template_server_test.go +++ b/server/workflowtemplate/workflow_template_server_test.go @@ -5,11 +5,12 @@ import ( "encoding/json" "testing" + "github.com/argoproj/argo/server/auth" + "github.com/stretchr/testify/assert" "k8s.io/client-go/kubernetes/fake" - "github.com/argoproj/argo/cmd/server/auth" - v1alpha1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" + "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" wftFake "github.com/argoproj/argo/pkg/client/clientset/versioned/fake" ) diff --git a/test/e2e/README.md b/test/e2e/README.md index b9b8f5ff8e6c..54908b0d32c3 100644 --- a/test/e2e/README.md +++ b/test/e2e/README.md @@ -65,7 +65,7 @@ kubectl -n argo scale deploy/argo-server --replicas 0 Kill any port forwards on 2746. -The run `cmd/server/main.go` using these arguments, which enable debug logging, and make sure you use locally build image: +The run `server/main.go` using these arguments, which enable debug logging, and make sure you use locally build image: ``` See dist/postgres.yaml @@ -79,7 +79,7 @@ kubectl -n argo scale deploy/argo-server --replicas 0 Kill any port forwards on 2746. -The run `cmd/server/main.go` using these arguments, which enable debug logging, and make sure you use locally build image: +The run `server/main.go` using these arguments, which enable debug logging, and make sure you use locally build image: ``` See dist/postgres.yaml diff --git a/ui/src/app/workflows/components/workflows-list/workflows-list.tsx b/ui/src/app/workflows/components/workflows-list/workflows-list.tsx index eb2d0a696bb3..8059cc68d8e1 100644 --- a/ui/src/app/workflows/components/workflows-list/workflows-list.tsx +++ b/ui/src/app/workflows/components/workflows-list/workflows-list.tsx @@ -72,7 +72,7 @@ export class WorkflowsList extends BasePage, State> { .map(workflowChange => { const workflows = this.state.workflows; if (!workflowChange) { - return {workflows, updated: false}; + return {workflows, updated: false}; } const index = workflows.findIndex(item => item.metadata.name === workflowChange.object.metadata.name); if (index > -1 && workflowChange.object.metadata.resourceVersion === workflows[index].metadata.resourceVersion) { diff --git a/util/api/util.go b/util/api/util.go index 5cc3c32bebc4..18af6e38ec9c 100644 --- a/util/api/util.go +++ b/util/api/util.go @@ -3,8 +3,8 @@ package api import ( "context" - apiwf "github.com/argoproj/argo/cmd/server/workflow" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" + apiwf "github.com/argoproj/argo/server/workflow" ) func SubmitWorkflowToAPIServer(apiGRPCClient apiwf.WorkflowServiceClient, ctx context.Context, wf *wfv1.Workflow, dryRun bool) (*wfv1.Workflow, error) { From 941fc065e3cd2e0fdfc734f87badc3dcaa3fa3a9 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Mon, 27 Jan 2020 11:53:42 -0800 Subject: [PATCH 08/34] lint --- cmd/argo/commands/client/v1/argo-api-client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/argo/commands/client/v1/argo-api-client.go b/cmd/argo/commands/client/v1/argo-api-client.go index 8aa7ee2085ae..832c6d584ec0 100644 --- a/cmd/argo/commands/client/v1/argo-api-client.go +++ b/cmd/argo/commands/client/v1/argo-api-client.go @@ -5,9 +5,9 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/cmd/server/workflow" - "github.com/argoproj/argo/cmd/server/workflowarchive" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" + "github.com/argoproj/argo/server/workflow" + "github.com/argoproj/argo/server/workflowarchive" ) type argoAPIClient struct { From e0b672a84aabad1c856eb36a8ae4ce2d0faad054 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Mon, 27 Jan 2020 17:30:19 -0800 Subject: [PATCH 09/34] move code around --- cmd/argo/commands/client/conn.go | 4 +- .../commands/client/v1/argo-api-client.go | 26 +++++----- cmd/argo/commands/client/v1/interface.go | 10 ++-- cmd/argo/commands/client/v1/kube-client.go | 49 ++++++++++++++++--- cmd/argo/commands/get.go | 2 +- cmd/argo/commands/list.go | 4 +- cmd/argo/commands/submit.go | 2 +- cmd/argo/commands/token.go | 2 +- 8 files changed, 70 insertions(+), 29 deletions(-) diff --git a/cmd/argo/commands/client/conn.go b/cmd/argo/commands/client/conn.go index 1512c60da2e1..5dcca4f02868 100644 --- a/cmd/argo/commands/client/conn.go +++ b/cmd/argo/commands/client/conn.go @@ -45,14 +45,14 @@ func GetClientConn() *grpc.ClientConn { // DEPRECATED should only be used by client/v1 package func GetContext() context.Context { - token := GetToken() + token := GetBearerToken() if token == "" { return context.Background() } return metadata.NewOutgoingContext(context.Background(), metadata.Pairs("authorization", "Bearer "+token)) } -func GetToken() string { +func GetBearerToken() string { restConfig, err := Config.ClientConfig() if err != nil { log.Fatal(err) diff --git a/cmd/argo/commands/client/v1/argo-api-client.go b/cmd/argo/commands/client/v1/argo-api-client.go index 832c6d584ec0..fe6a00c88973 100644 --- a/cmd/argo/commands/client/v1/argo-api-client.go +++ b/cmd/argo/commands/client/v1/argo-api-client.go @@ -10,10 +10,16 @@ import ( "github.com/argoproj/argo/server/workflowarchive" ) +// This client communicates with Argo using the Argo Server API. +// This supports all features, but requires you to install the Argo Server. type argoAPIClient struct { *grpc.ClientConn } +func newArgoAPIClient() Interface { + return &argoAPIClient{client.GetClientConn()} +} + func (a *argoAPIClient) Namespace() (string, error) { namespace, _, err := client.Config.Namespace() return namespace, err @@ -37,33 +43,31 @@ func (a *argoAPIClient) DeleteArchivedWorkflow(uid string) error { }) return err } - -func newArgoAPIClient() Interface { - return &argoAPIClient{client.GetClientConn()} -} - -func (a *argoAPIClient) Get(namespace, name string) (*wfv1.Workflow, error) { +func (a *argoAPIClient) GetWorkflow(namespace, name string) (*wfv1.Workflow, error) { return workflow.NewWorkflowServiceClient(a.ClientConn).GetWorkflow(client.GetContext(), &workflow.WorkflowGetRequest{ Name: name, Namespace: namespace, }) } -func (a *argoAPIClient) List(namespace string, opts metav1.ListOptions) (*wfv1.WorkflowList, error) { +func (a *argoAPIClient) ListWorkflows(namespace string, opts metav1.ListOptions) (*wfv1.WorkflowList, error) { return workflow.NewWorkflowServiceClient(a.ClientConn).ListWorkflows(client.GetContext(), &workflow.WorkflowListRequest{ Namespace: namespace, ListOptions: &opts, }) } -func (a *argoAPIClient) Submit(namespace string, wf *wfv1.Workflow, dryRun bool) (*wfv1.Workflow, error) { +func (a *argoAPIClient) Submit(namespace string, wf *wfv1.Workflow, dryRun, serverDryRun bool) (*wfv1.Workflow, error) { + if dryRun { + return wf, nil + } return workflow.NewWorkflowServiceClient(a.ClientConn).CreateWorkflow(client.GetContext(), &workflow.WorkflowCreateRequest{ Namespace: namespace, Workflow: wf, - ServerDryRun: dryRun, + ServerDryRun: serverDryRun, }) } -func (a *argoAPIClient) GetToken() (string, error) { - return client.GetToken(), nil +func (a *argoAPIClient) Token() (string, error) { + return client.GetBearerToken(), nil } diff --git a/cmd/argo/commands/client/v1/interface.go b/cmd/argo/commands/client/v1/interface.go index 083c9436ed0b..c6027dd20896 100644 --- a/cmd/argo/commands/client/v1/interface.go +++ b/cmd/argo/commands/client/v1/interface.go @@ -8,10 +8,10 @@ import ( ) type Interface interface { - Submit(namespace string, wf *wfv1.Workflow, dryRun bool) (*wfv1.Workflow, error) - List(namespace string, opts v1.ListOptions) (*wfv1.WorkflowList, error) - Get(namespace, name string) (*wfv1.Workflow, error) - GetToken() (string, error) + Submit(namespace string, wf *wfv1.Workflow, dryRun, serverDryRun bool) (*wfv1.Workflow, error) + ListWorkflows(namespace string, opts v1.ListOptions) (*wfv1.WorkflowList, error) + GetWorkflow(namespace, name string) (*wfv1.Workflow, error) + Token() (string, error) DeleteArchivedWorkflow(uid string) error GetArchivedWorkflow(uid string) (*wfv1.Workflow, error) ListArchivedWorkflows(namespace string) (*wfv1.WorkflowList, error) @@ -22,6 +22,6 @@ func GetClient() (Interface, error) { if client.ArgoServer != "" { return newArgoAPIClient(), nil } else { - return newKubeImpl() + return newKubeClient() } } diff --git a/cmd/argo/commands/client/v1/kube-client.go b/cmd/argo/commands/client/v1/kube-client.go index 337d382f6555..72f253548e05 100644 --- a/cmd/argo/commands/client/v1/kube-client.go +++ b/cmd/argo/commands/client/v1/kube-client.go @@ -2,6 +2,7 @@ package v1 import ( "fmt" + "strconv" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -9,10 +10,14 @@ import ( wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" "github.com/argoproj/argo/pkg/client/clientset/versioned" "github.com/argoproj/argo/workflow/packer" + "github.com/argoproj/argo/workflow/util" ) var misuseError = fmt.Errorf("this doesn't make sense unless you are using argo server, perhaps something like `export ARGO_SERVER=localhost:2746` would help") +// This client communicates with Argo using the K8S API. +// This is useful if you to speak to a system that does not have the Argo Server, but does not +// support some features, such as offloading large workflows or the workflow archive. type kubeClient struct { versioned.Interface } @@ -34,7 +39,7 @@ func (k *kubeClient) DeleteArchivedWorkflow(_ string) error { return misuseError } -func newKubeImpl() (Interface, error) { +func newKubeClient() (Interface, error) { restConfig, err := client.Config.ClientConfig() if err != nil { return nil, err @@ -46,7 +51,7 @@ func newKubeImpl() (Interface, error) { return &kubeClient{wfClient}, nil } -func (k *kubeClient) Get(namespace, name string) (*wfv1.Workflow, error) { +func (k *kubeClient) GetWorkflow(namespace, name string) (*wfv1.Workflow, error) { wf, err := k.ArgoprojV1alpha1().Workflows(namespace).Get(name, metav1.GetOptions{}) if err != nil { return nil, err @@ -58,7 +63,7 @@ func (k *kubeClient) Get(namespace, name string) (*wfv1.Workflow, error) { return wf, nil } -func (k *kubeClient) List(namespace string, opts metav1.ListOptions) (*wfv1.WorkflowList, error) { +func (k *kubeClient) ListWorkflows(namespace string, opts metav1.ListOptions) (*wfv1.WorkflowList, error) { list, err := k.ArgoprojV1alpha1().Workflows(namespace).List(opts) if err != nil { return nil, err @@ -72,13 +77,45 @@ func (k *kubeClient) List(namespace string, opts metav1.ListOptions) (*wfv1.Work return list, nil } -func (k *kubeClient) Submit(namespace string, wf *wfv1.Workflow, dryRun bool) (*wfv1.Workflow, error) { +func (k *kubeClient) Submit(namespace string, wf *wfv1.Workflow, dryRun, serverDryRun bool) (*wfv1.Workflow, error) { if dryRun { - return nil, fmt.Errorf("dryRun not implemented") + return wf, nil + } + if serverDryRun { + ok, err := k.checkServerVersionForDryRun() + if err != nil { + return nil, err + } + if !ok { + return nil, fmt.Errorf("server-dry-run is not available for server api versions older than v1.12") + } + // kind of gross code, but find + return util.CreateServerDryRun(wf, k.Interface) } return k.ArgoprojV1alpha1().Workflows(namespace).Create(wf) } -func (k *kubeClient) GetToken() (string, error) { +func (k *kubeClient) Token() (string, error) { return "", misuseError } + +func (k *kubeClient) checkServerVersionForDryRun() (bool, error) { + serverVersion, err := k.Discovery().ServerVersion() + if err != nil { + return false, err + } + majorVersion, err := strconv.Atoi(serverVersion.Major) + if err != nil { + return false, err + } + minorVersion, err := strconv.Atoi(serverVersion.Minor) + if err != nil { + return false, err + } + if majorVersion < 1 { + return false, nil + } else if majorVersion == 1 && minorVersion < 12 { + return false, nil + } + return true, nil +} diff --git a/cmd/argo/commands/get.go b/cmd/argo/commands/get.go index a09f0a66f84c..83a60a6f1925 100644 --- a/cmd/argo/commands/get.go +++ b/cmd/argo/commands/get.go @@ -43,7 +43,7 @@ func NewGetCommand() *cobra.Command { namespace, err := client.Namespace() errors.CheckError(err) for _, name := range args { - wf, err := client.Get(namespace, name) + wf, err := client.GetWorkflow(namespace, name) errors.CheckError(err) outputWorkflow(wf, getArgs) } diff --git a/cmd/argo/commands/list.go b/cmd/argo/commands/list.go index d012a1874f31..d0f228cbe25b 100644 --- a/cmd/argo/commands/list.go +++ b/cmd/argo/commands/list.go @@ -74,13 +74,13 @@ func NewListCommand() *cobra.Command { namespace = "" } - wfList, err := client.List(namespace, listOpts) + wfList, err := client.ListWorkflows(namespace, listOpts) errors.CheckError(err) tmpWorkFlows := wfList.Items for wfList.ListMeta.Continue != "" { listOpts.Continue = wfList.ListMeta.Continue - wfList, err = client.List(namespace, listOpts) + wfList, err = client.ListWorkflows(namespace, listOpts) if err != nil { log.Fatal(err) } diff --git a/cmd/argo/commands/submit.go b/cmd/argo/commands/submit.go index 7db90555576b..bdff305bb2d2 100644 --- a/cmd/argo/commands/submit.go +++ b/cmd/argo/commands/submit.go @@ -146,7 +146,7 @@ func SubmitWorkflows(filePaths []string, submitOpts *util.SubmitOpts, cliOpts *c err := util.ApplySubmitOpts(&wf, submitOpts) errors.CheckError(err) wf.Spec.Priority = cliOpts.priority - created, err := client.Submit(wf.Namespace, &wf, submitOpts.ServerDryRun) + created, err := client.Submit(wf.Namespace, &wf, submitOpts.DryRun, submitOpts.ServerDryRun) if err != nil { log.Fatalf("Failed to submit workflow: %v", err) } diff --git a/cmd/argo/commands/token.go b/cmd/argo/commands/token.go index 5ffa9e3f9bd8..77f0bc3722e3 100644 --- a/cmd/argo/commands/token.go +++ b/cmd/argo/commands/token.go @@ -21,7 +21,7 @@ func NewTokenCommand() *cobra.Command { } client, err := v1.GetClient() errors.CheckError(err) - token, err := client.GetToken() + token, err := client.Token() errors.CheckError(err) fmt.Print(token) }, From 6a2ad93601692dfc0bc018d335fb3c81578aed3e Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Tue, 28 Jan 2020 10:37:43 -0800 Subject: [PATCH 10/34] moved files --- .../apiclient}/cronworkflow/cron-workflow.pb.go | 0 .../cronworkflow/cron-workflow.pb.gw.go | 0 .../apiclient}/cronworkflow/cron-workflow.proto | 0 .../cronworkflow/cron-workflow.swagger.json | 0 server/apiserver/argoserver.go | 5 +++-- server/cronworkflow/cron_workflow_server.go | 15 ++++++++------- server/cronworkflow/cron_workflow_server_test.go | 11 ++++++----- 7 files changed, 17 insertions(+), 14 deletions(-) rename {server => pkg/apiclient}/cronworkflow/cron-workflow.pb.go (100%) rename {server => pkg/apiclient}/cronworkflow/cron-workflow.pb.gw.go (100%) rename {server => pkg/apiclient}/cronworkflow/cron-workflow.proto (100%) rename {server => pkg/apiclient}/cronworkflow/cron-workflow.swagger.json (100%) diff --git a/server/cronworkflow/cron-workflow.pb.go b/pkg/apiclient/cronworkflow/cron-workflow.pb.go similarity index 100% rename from server/cronworkflow/cron-workflow.pb.go rename to pkg/apiclient/cronworkflow/cron-workflow.pb.go diff --git a/server/cronworkflow/cron-workflow.pb.gw.go b/pkg/apiclient/cronworkflow/cron-workflow.pb.gw.go similarity index 100% rename from server/cronworkflow/cron-workflow.pb.gw.go rename to pkg/apiclient/cronworkflow/cron-workflow.pb.gw.go diff --git a/server/cronworkflow/cron-workflow.proto b/pkg/apiclient/cronworkflow/cron-workflow.proto similarity index 100% rename from server/cronworkflow/cron-workflow.proto rename to pkg/apiclient/cronworkflow/cron-workflow.proto diff --git a/server/cronworkflow/cron-workflow.swagger.json b/pkg/apiclient/cronworkflow/cron-workflow.swagger.json similarity index 100% rename from server/cronworkflow/cron-workflow.swagger.json rename to pkg/apiclient/cronworkflow/cron-workflow.swagger.json diff --git a/server/apiserver/argoserver.go b/server/apiserver/argoserver.go index 9262c8ccea2c..ec3eb45ec64d 100644 --- a/server/apiserver/argoserver.go +++ b/server/apiserver/argoserver.go @@ -6,6 +6,7 @@ import ( "net/http" "time" + cronworkflowpkg "github.com/argoproj/argo/pkg/apiclient/cronworkflow" "github.com/argoproj/argo/server/artifacts" "github.com/argoproj/argo/server/auth" "github.com/argoproj/argo/server/cronworkflow" @@ -179,7 +180,7 @@ func (as *argoServer) newGRPCServer(offloadNodeStatusRepo sqldb.OffloadNodeStatu info.RegisterInfoServiceServer(grpcServer, info.NewInfoServer(as.managedNamespace)) workflow.RegisterWorkflowServiceServer(grpcServer, workflow.NewWorkflowServer(offloadNodeStatusRepo)) workflowtemplate.RegisterWorkflowTemplateServiceServer(grpcServer, workflowtemplate.NewWorkflowTemplateServer()) - cronworkflow.RegisterCronWorkflowServiceServer(grpcServer, cronworkflow.NewCronWorkflowServer()) + cronworkflowpkg.RegisterCronWorkflowServiceServer(grpcServer, cronworkflow.NewCronWorkflowServer()) workflowarchive.RegisterArchivedWorkflowServiceServer(grpcServer, workflowarchive.NewWorkflowArchiveServer(wfArchive)) return grpcServer @@ -213,7 +214,7 @@ func (as *argoServer) newHTTPServer(ctx context.Context, port int, artifactServe mustRegisterGWHandler(info.RegisterInfoServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) mustRegisterGWHandler(workflow.RegisterWorkflowServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) mustRegisterGWHandler(workflowtemplate.RegisterWorkflowTemplateServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) - mustRegisterGWHandler(cronworkflow.RegisterCronWorkflowServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) + mustRegisterGWHandler(cronworkflowpkg.RegisterCronWorkflowServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) mustRegisterGWHandler(workflowarchive.RegisterArchivedWorkflowServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) mux.Handle("/api/", gwmux) mux.HandleFunc("/artifacts/", artifactServer.GetArtifact) diff --git a/server/cronworkflow/cron_workflow_server.go b/server/cronworkflow/cron_workflow_server.go index 93b0b427318f..59e9ea028425 100644 --- a/server/cronworkflow/cron_workflow_server.go +++ b/server/cronworkflow/cron_workflow_server.go @@ -5,6 +5,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + cronworkflowpkg "github.com/argoproj/argo/pkg/apiclient/cronworkflow" "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" "github.com/argoproj/argo/server/auth" ) @@ -12,11 +13,11 @@ import ( type cronWorkflowServiceServer struct { } -func NewCronWorkflowServer() CronWorkflowServiceServer { +func NewCronWorkflowServer() cronworkflowpkg.CronWorkflowServiceServer { return &cronWorkflowServiceServer{} } -func (c *cronWorkflowServiceServer) ListCronWorkflows(ctx context.Context, req *ListCronWorkflowsRequest) (*v1alpha1.CronWorkflowList, error) { +func (c *cronWorkflowServiceServer) ListCronWorkflows(ctx context.Context, req *cronworkflowpkg.ListCronWorkflowsRequest) (*v1alpha1.CronWorkflowList, error) { options := metav1.ListOptions{} if req.ListOptions != nil { options = *req.ListOptions @@ -24,11 +25,11 @@ func (c *cronWorkflowServiceServer) ListCronWorkflows(ctx context.Context, req * return auth.GetWfClient(ctx).ArgoprojV1alpha1().CronWorkflows(req.Namespace).List(options) } -func (c *cronWorkflowServiceServer) CreateCronWorkflow(ctx context.Context, req *CreateCronWorkflowRequest) (*v1alpha1.CronWorkflow, error) { +func (c *cronWorkflowServiceServer) CreateCronWorkflow(ctx context.Context, req *cronworkflowpkg.CreateCronWorkflowRequest) (*v1alpha1.CronWorkflow, error) { return auth.GetWfClient(ctx).ArgoprojV1alpha1().CronWorkflows(req.Namespace).Create(req.CronWorkflow) } -func (c *cronWorkflowServiceServer) GetCronWorkflow(ctx context.Context, req *GetCronWorkflowRequest) (*v1alpha1.CronWorkflow, error) { +func (c *cronWorkflowServiceServer) GetCronWorkflow(ctx context.Context, req *cronworkflowpkg.GetCronWorkflowRequest) (*v1alpha1.CronWorkflow, error) { options := metav1.GetOptions{} if req.GetOptions != nil { options = *req.GetOptions @@ -36,7 +37,7 @@ func (c *cronWorkflowServiceServer) GetCronWorkflow(ctx context.Context, req *Ge return auth.GetWfClient(ctx).ArgoprojV1alpha1().CronWorkflows(req.Namespace).Get(req.Name, options) } -func (c *cronWorkflowServiceServer) UpdateCronWorkflow(ctx context.Context, req *UpdateCronWorkflowRequest) (*v1alpha1.CronWorkflow, error) { +func (c *cronWorkflowServiceServer) UpdateCronWorkflow(ctx context.Context, req *cronworkflowpkg.UpdateCronWorkflowRequest) (*v1alpha1.CronWorkflow, error) { cronWf, err := auth.GetWfClient(ctx).ArgoprojV1alpha1().CronWorkflows(req.Namespace).Update(req.CronWorkflow) if err != nil { return nil, err @@ -44,10 +45,10 @@ func (c *cronWorkflowServiceServer) UpdateCronWorkflow(ctx context.Context, req return cronWf, nil } -func (c *cronWorkflowServiceServer) DeleteCronWorkflow(ctx context.Context, req *DeleteCronWorkflowRequest) (*CronWorkflowDeletedResponse, error) { +func (c *cronWorkflowServiceServer) DeleteCronWorkflow(ctx context.Context, req *cronworkflowpkg.DeleteCronWorkflowRequest) (*cronworkflowpkg.CronWorkflowDeletedResponse, error) { err := auth.GetWfClient(ctx).ArgoprojV1alpha1().CronWorkflows(req.Namespace).Delete(req.Name, req.DeleteOptions) if err != nil { return nil, err } - return &CronWorkflowDeletedResponse{}, nil + return &cronworkflowpkg.CronWorkflowDeletedResponse{}, nil } diff --git a/server/cronworkflow/cron_workflow_server_test.go b/server/cronworkflow/cron_workflow_server_test.go index 1dbf4f37e4a9..986d3286b485 100644 --- a/server/cronworkflow/cron_workflow_server_test.go +++ b/server/cronworkflow/cron_workflow_server_test.go @@ -4,6 +4,7 @@ import ( "context" "testing" + cronworkflowpkg "github.com/argoproj/argo/pkg/apiclient/cronworkflow" "github.com/argoproj/argo/server/auth" "github.com/stretchr/testify/assert" @@ -22,7 +23,7 @@ func Test_cronWorkflowServiceServer(t *testing.T) { ctx := context.WithValue(context.TODO(), auth.WfKey, wfClientset) t.Run("CreateCronWorkflow", func(t *testing.T) { - created, err := server.CreateCronWorkflow(ctx, &CreateCronWorkflowRequest{ + created, err := server.CreateCronWorkflow(ctx, &cronworkflowpkg.CreateCronWorkflowRequest{ Namespace: "my-ns", CronWorkflow: cronWf, }) @@ -31,25 +32,25 @@ func Test_cronWorkflowServiceServer(t *testing.T) { } }) t.Run("ListCronWorkflows", func(t *testing.T) { - cronWfs, err := server.ListCronWorkflows(ctx, &ListCronWorkflowsRequest{Namespace: "my-ns"}) + cronWfs, err := server.ListCronWorkflows(ctx, &cronworkflowpkg.ListCronWorkflowsRequest{Namespace: "my-ns"}) if assert.NoError(t, err) { assert.Len(t, cronWfs.Items, 1) } }) t.Run("GetCronWorkflow", func(t *testing.T) { - cronWf, err := server.GetCronWorkflow(ctx, &GetCronWorkflowRequest{Namespace: "my-ns", Name: "my-name"}) + cronWf, err := server.GetCronWorkflow(ctx, &cronworkflowpkg.GetCronWorkflowRequest{Namespace: "my-ns", Name: "my-name"}) if assert.NoError(t, err) { assert.NotNil(t, cronWf) } }) t.Run("UpdateCronWorkflow", func(t *testing.T) { - cronWf, err := server.UpdateCronWorkflow(ctx, &UpdateCronWorkflowRequest{Namespace: "my-ns", Name: "my-name", CronWorkflow: cronWf}) + cronWf, err := server.UpdateCronWorkflow(ctx, &cronworkflowpkg.UpdateCronWorkflowRequest{Namespace: "my-ns", Name: "my-name", CronWorkflow: cronWf}) if assert.NoError(t, err) { assert.NotNil(t, cronWf) } }) t.Run("DeleteCronWorkflow", func(t *testing.T) { - _, err := server.DeleteCronWorkflow(ctx, &DeleteCronWorkflowRequest{Name: "my-name", Namespace: "my-ns"}) + _, err := server.DeleteCronWorkflow(ctx, &cronworkflowpkg.DeleteCronWorkflowRequest{Name: "my-name", Namespace: "my-ns"}) assert.NoError(t, err) }) } From e4cd1bdcfc22028f9d8392e56677ff8dfd3fa0df Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Tue, 28 Jan 2020 10:45:46 -0800 Subject: [PATCH 11/34] moved workflow files --- .../commands/client/v1/argo-api-client.go | 8 ++--- cmd/argo/commands/common.go | 6 ++-- cmd/argo/commands/delete.go | 14 ++++---- cmd/argo/commands/lint.go | 6 ++-- cmd/argo/commands/logs.go | 12 +++---- cmd/argo/commands/resubmit.go | 4 +-- cmd/argo/commands/resume.go | 4 +-- cmd/argo/commands/retry.go | 4 +-- cmd/argo/commands/suspend.go | 4 +-- cmd/argo/commands/terminate.go | 4 +-- cmd/argo/commands/wait.go | 9 +++-- cmd/argo/commands/watch.go | 8 ++--- .../workflow/forwarder_overwrite.go | 0 .../apiclient}/workflow/workflow.pb.go | 0 .../apiclient}/workflow/workflow.pb.gw.go | 0 .../apiclient}/workflow/workflow.proto | 0 .../apiclient}/workflow/workflow.swagger.json | 0 server/apiserver/argoserver.go | 5 +-- server/workflow/workflow_server.go | 36 +++++++++---------- server/workflow/workflow_server_test.go | 29 +++++++-------- util/api/util.go | 6 ++-- 21 files changed, 80 insertions(+), 79 deletions(-) rename {server => pkg/apiclient}/workflow/forwarder_overwrite.go (100%) rename {server => pkg/apiclient}/workflow/workflow.pb.go (100%) rename {server => pkg/apiclient}/workflow/workflow.pb.gw.go (100%) rename {server => pkg/apiclient}/workflow/workflow.proto (100%) rename {server => pkg/apiclient}/workflow/workflow.swagger.json (100%) diff --git a/cmd/argo/commands/client/v1/argo-api-client.go b/cmd/argo/commands/client/v1/argo-api-client.go index fe6a00c88973..92fb15b31918 100644 --- a/cmd/argo/commands/client/v1/argo-api-client.go +++ b/cmd/argo/commands/client/v1/argo-api-client.go @@ -5,8 +5,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/argoproj/argo/cmd/argo/commands/client" + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" - "github.com/argoproj/argo/server/workflow" "github.com/argoproj/argo/server/workflowarchive" ) @@ -44,14 +44,14 @@ func (a *argoAPIClient) DeleteArchivedWorkflow(uid string) error { return err } func (a *argoAPIClient) GetWorkflow(namespace, name string) (*wfv1.Workflow, error) { - return workflow.NewWorkflowServiceClient(a.ClientConn).GetWorkflow(client.GetContext(), &workflow.WorkflowGetRequest{ + return workflowpkg.NewWorkflowServiceClient(a.ClientConn).GetWorkflow(client.GetContext(), &workflowpkg.WorkflowGetRequest{ Name: name, Namespace: namespace, }) } func (a *argoAPIClient) ListWorkflows(namespace string, opts metav1.ListOptions) (*wfv1.WorkflowList, error) { - return workflow.NewWorkflowServiceClient(a.ClientConn).ListWorkflows(client.GetContext(), &workflow.WorkflowListRequest{ + return workflowpkg.NewWorkflowServiceClient(a.ClientConn).ListWorkflows(client.GetContext(), &workflowpkg.WorkflowListRequest{ Namespace: namespace, ListOptions: &opts, }) @@ -61,7 +61,7 @@ func (a *argoAPIClient) Submit(namespace string, wf *wfv1.Workflow, dryRun, serv if dryRun { return wf, nil } - return workflow.NewWorkflowServiceClient(a.ClientConn).CreateWorkflow(client.GetContext(), &workflow.WorkflowCreateRequest{ + return workflowpkg.NewWorkflowServiceClient(a.ClientConn).CreateWorkflow(client.GetContext(), &workflowpkg.WorkflowCreateRequest{ Namespace: namespace, Workflow: wf, ServerDryRun: serverDryRun, diff --git a/cmd/argo/commands/common.go b/cmd/argo/commands/common.go index 76b05aad0f86..806eb927711c 100644 --- a/cmd/argo/commands/common.go +++ b/cmd/argo/commands/common.go @@ -14,10 +14,10 @@ import ( "k8s.io/client-go/rest" "github.com/argoproj/argo/cmd/argo/commands/client" + "github.com/argoproj/argo/pkg/apiclient/workflow" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" "github.com/argoproj/argo/pkg/client/clientset/versioned" "github.com/argoproj/argo/pkg/client/clientset/versioned/typed/workflow/v1alpha1" - wfApiServer "github.com/argoproj/argo/server/workflow" "github.com/argoproj/argo/workflow/templateresolution" ) @@ -150,6 +150,6 @@ func (c LazyWorkflowTemplateGetter) Get(name string) (*wfv1.WorkflowTemplate, er var _ templateresolution.WorkflowTemplateNamespacedGetter = &LazyWorkflowTemplateGetter{} // DEPRECATED -func GetWFApiServerGRPCClient(conn *grpc.ClientConn) (wfApiServer.WorkflowServiceClient, context.Context) { - return wfApiServer.NewWorkflowServiceClient(conn), client.GetContext() +func GetWFApiServerGRPCClient(conn *grpc.ClientConn) (workflow.WorkflowServiceClient, context.Context) { + return workflow.NewWorkflowServiceClient(conn), client.GetContext() } diff --git a/cmd/argo/commands/delete.go b/cmd/argo/commands/delete.go index d332a9ddfd3c..fd0df1167c26 100644 --- a/cmd/argo/commands/delete.go +++ b/cmd/argo/commands/delete.go @@ -7,13 +7,13 @@ import ( "os" "time" - "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/server/workflow" - argotime "github.com/argoproj/pkg/time" "github.com/spf13/cobra" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/argoproj/argo/cmd/argo/commands/client" + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" + "github.com/argoproj/argo/workflow/common" ) @@ -107,8 +107,8 @@ func apiServerDeleteWorkflows(allWFs bool, older string, completed bool, wfNames } } -func getWFList(client workflow.WorkflowServiceClient, ctx context.Context, ns string, opts *metav1.ListOptions, older *time.Time) ([]string, error) { - wfReq := workflow.WorkflowListRequest{ +func getWFList(client workflowpkg.WorkflowServiceClient, ctx context.Context, ns string, opts *metav1.ListOptions, older *time.Time) ([]string, error) { + wfReq := workflowpkg.WorkflowListRequest{ ListOptions: opts, Namespace: ns, } @@ -128,8 +128,8 @@ func getWFList(client workflow.WorkflowServiceClient, ctx context.Context, ns st return wfNames, nil } -func apiServerDeleteWorkflow(client workflow.WorkflowServiceClient, ctx context.Context, wfName, ns string) { - wfReq := workflow.WorkflowDeleteRequest{ +func apiServerDeleteWorkflow(client workflowpkg.WorkflowServiceClient, ctx context.Context, wfName, ns string) { + wfReq := workflowpkg.WorkflowDeleteRequest{ Name: wfName, Namespace: ns, } diff --git a/cmd/argo/commands/lint.go b/cmd/argo/commands/lint.go index 8f49c66dd36c..647e495c5722 100644 --- a/cmd/argo/commands/lint.go +++ b/cmd/argo/commands/lint.go @@ -11,8 +11,8 @@ import ( "google.golang.org/grpc" "github.com/argoproj/argo/cmd/argo/commands/client" + "github.com/argoproj/argo/pkg/apiclient/workflow" "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" - apiServer "github.com/argoproj/argo/server/workflow" cmdutil "github.com/argoproj/argo/util/cmd" "github.com/argoproj/argo/workflow/validate" ) @@ -128,8 +128,8 @@ func ServerSideLint(arg string, conn *grpc.ClientConn, strict bool) error { return err } -func ServerLintValidation(ctx context.Context, client apiServer.WorkflowServiceClient, wf v1alpha1.Workflow, ns string) error { - wfReq := apiServer.WorkflowLintRequest{ +func ServerLintValidation(ctx context.Context, client workflow.WorkflowServiceClient, wf v1alpha1.Workflow, ns string) error { + wfReq := workflow.WorkflowLintRequest{ Namespace: ns, Workflow: &wf, } diff --git a/cmd/argo/commands/logs.go b/cmd/argo/commands/logs.go index 9cdc56c19f6e..fe916f9031d3 100644 --- a/cmd/argo/commands/logs.go +++ b/cmd/argo/commands/logs.go @@ -27,9 +27,9 @@ import ( "github.com/argoproj/pkg/errors" "github.com/argoproj/argo/cmd/argo/commands/client" + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" workflowv1 "github.com/argoproj/argo/pkg/client/clientset/versioned/typed/workflow/v1alpha1" - apiv1 "github.com/argoproj/argo/server/workflow" "github.com/argoproj/argo/workflow/packer" ) @@ -113,7 +113,7 @@ type logPrinter struct { tail *int64 timestamps bool kubeClient kubernetes.Interface - apiClient apiv1.WorkflowServiceClient + apiClient workflowpkg.WorkflowServiceClient ctx context.Context ns string apiServer bool @@ -124,7 +124,7 @@ func (p *logPrinter) PrintWorkflowLogs(workflow string) error { var wf *v1alpha1.Workflow var err error if p.apiServer { - wfReq := apiv1.WorkflowGetRequest{ + wfReq := workflowpkg.WorkflowGetRequest{ Name: workflow, Namespace: p.ns, } @@ -256,7 +256,7 @@ func (p *logPrinter) printLiveWorkflowLogs(workflowName string, wfClient workflo go func() { defer close(logs) if p.apiServer { - wfReq := apiv1.WatchWorkflowsRequest{ + wfReq := workflowpkg.WatchWorkflowsRequest{ Namespace: namespace, ListOptions: &metav1.ListOptions{ FieldSelector: fieldSelector.String(), @@ -387,7 +387,7 @@ func (p *logPrinter) getPodLogs( } var err error if p.apiServer { - wfLogReq := apiv1.WorkflowLogRequest{ + wfLogReq := workflowpkg.WorkflowLogRequest{ Name: "*", Namespace: p.ns, PodName: podName, @@ -400,7 +400,7 @@ func (p *logPrinter) getPodLogs( TailLines: p.tail, }, } - var logStream apiv1.WorkflowService_PodLogsClient + var logStream workflowpkg.WorkflowService_PodLogsClient var err error for { logStream, err = p.apiClient.PodLogs(ctx, &wfLogReq) diff --git a/cmd/argo/commands/resubmit.go b/cmd/argo/commands/resubmit.go index 78269c7e5b41..311ded7094ff 100644 --- a/cmd/argo/commands/resubmit.go +++ b/cmd/argo/commands/resubmit.go @@ -9,8 +9,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/argoproj/argo/cmd/argo/commands/client" + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" - "github.com/argoproj/argo/server/workflow" apiUtil "github.com/argoproj/argo/util/api" "github.com/argoproj/argo/workflow/util" ) @@ -40,7 +40,7 @@ func NewResubmitCommand() *cobra.Command { defer conn.Close() apiGRPCClient, ctx := GetWFApiServerGRPCClient(conn) errors.CheckError(err) - wfReq := workflow.WorkflowGetRequest{ + wfReq := workflowpkg.WorkflowGetRequest{ Namespace: namespace, Name: args[0], } diff --git a/cmd/argo/commands/resume.go b/cmd/argo/commands/resume.go index e309b2569d42..bedc18a529f1 100644 --- a/cmd/argo/commands/resume.go +++ b/cmd/argo/commands/resume.go @@ -8,7 +8,7 @@ import ( "github.com/spf13/cobra" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/server/workflow" + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" "github.com/argoproj/argo/workflow/util" ) @@ -26,7 +26,7 @@ func NewResumeCommand() *cobra.Command { conn := client.GetClientConn() apiGRPCClient, ctx := GetWFApiServerGRPCClient(conn) for _, wfName := range args { - wfUptReq := workflow.WorkflowResumeRequest{ + wfUptReq := workflowpkg.WorkflowResumeRequest{ Name: wfName, Namespace: namespace, } diff --git a/cmd/argo/commands/retry.go b/cmd/argo/commands/retry.go index dae322434fbe..152dfcf69eee 100644 --- a/cmd/argo/commands/retry.go +++ b/cmd/argo/commands/retry.go @@ -10,7 +10,7 @@ import ( "github.com/argoproj/pkg/errors" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/server/workflow" + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" "github.com/argoproj/argo/workflow/packer" "github.com/argoproj/argo/workflow/util" ) @@ -65,7 +65,7 @@ func apiServerWFRetry(wfName string, opts cliSubmitOpts) { ns, _, _ := client.Config.Namespace() wfApiClient, ctx := GetWFApiServerGRPCClient(conn) - wfReq := workflow.WorkflowRetryRequest{ + wfReq := workflowpkg.WorkflowRetryRequest{ Name: wfName, Namespace: ns, } diff --git a/cmd/argo/commands/suspend.go b/cmd/argo/commands/suspend.go index 9121d6335d7a..de949d503386 100644 --- a/cmd/argo/commands/suspend.go +++ b/cmd/argo/commands/suspend.go @@ -8,7 +8,7 @@ import ( "github.com/spf13/cobra" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/server/workflow" + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" "github.com/argoproj/argo/workflow/util" ) @@ -26,7 +26,7 @@ func NewSuspendCommand() *cobra.Command { conn := client.GetClientConn() apiGRPCClient, ctx := GetWFApiServerGRPCClient(conn) for _, wfName := range args { - wfUptReq := workflow.WorkflowSuspendRequest{ + wfUptReq := workflowpkg.WorkflowSuspendRequest{ Name: wfName, Namespace: namespace, } diff --git a/cmd/argo/commands/terminate.go b/cmd/argo/commands/terminate.go index 88c1cf77edcd..97c055fba2eb 100644 --- a/cmd/argo/commands/terminate.go +++ b/cmd/argo/commands/terminate.go @@ -8,7 +8,7 @@ import ( "github.com/spf13/cobra" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/server/workflow" + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" "github.com/argoproj/argo/workflow/util" ) @@ -26,7 +26,7 @@ func NewTerminateCommand() *cobra.Command { conn := client.GetClientConn() apiGRPCClient, ctx := GetWFApiServerGRPCClient(conn) for _, wfName := range args { - wfUptReq := workflow.WorkflowTerminateRequest{ + wfUptReq := workflowpkg.WorkflowTerminateRequest{ Name: wfName, Namespace: namespace, } diff --git a/cmd/argo/commands/wait.go b/cmd/argo/commands/wait.go index 0bdcac7d8779..0ee6de33dfd1 100644 --- a/cmd/argo/commands/wait.go +++ b/cmd/argo/commands/wait.go @@ -13,8 +13,7 @@ import ( "k8s.io/apimachinery/pkg/fields" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/server/workflow" - + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" ) @@ -42,7 +41,7 @@ func NewWaitCommand() *cobra.Command { func WaitWorkflows(workflowNames []string, ignoreNotFound, quiet bool) { var wg sync.WaitGroup wfSuccessStatus := true - var apiClient workflow.WorkflowServiceClient + var apiClient workflowpkg.WorkflowServiceClient var ctx context.Context ns, _, _ := client.Config.Namespace() if client.ArgoServer != "" { @@ -78,9 +77,9 @@ func WaitWorkflows(workflowNames []string, ignoreNotFound, quiet bool) { } } -func apiServerWaitOnOne(client workflow.WorkflowServiceClient, ctx context.Context, wfName string, namespace string, ignoreNotFound, quiet bool) bool { +func apiServerWaitOnOne(client workflowpkg.WorkflowServiceClient, ctx context.Context, wfName string, namespace string, ignoreNotFound, quiet bool) bool { fieldSelector := fields.ParseSelectorOrDie(fmt.Sprintf("metadata.name=%s", wfName)) - wfReq := workflow.WatchWorkflowsRequest{ + wfReq := workflowpkg.WatchWorkflowsRequest{ Namespace: namespace, ListOptions: &metav1.ListOptions{ FieldSelector: fieldSelector.String(), diff --git a/cmd/argo/commands/watch.go b/cmd/argo/commands/watch.go index e8c14da4869d..3940f5168f95 100644 --- a/cmd/argo/commands/watch.go +++ b/cmd/argo/commands/watch.go @@ -5,14 +5,14 @@ import ( "os" "time" - "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/server/workflow" - "github.com/argoproj/pkg/errors" "github.com/spf13/cobra" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" + "github.com/argoproj/argo/cmd/argo/commands/client" + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" + wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" "github.com/argoproj/argo/workflow/packer" ) @@ -38,7 +38,7 @@ func apiServerWatchWorkflow(wfName string) { defer conn.Close() apiClient, ctx := GetWFApiServerGRPCClient(conn) fieldSelector := fields.ParseSelectorOrDie(fmt.Sprintf("metadata.name=%s", wfName)) - wfReq := workflow.WatchWorkflowsRequest{ + wfReq := workflowpkg.WatchWorkflowsRequest{ Namespace: namespace, ListOptions: &metav1.ListOptions{ FieldSelector: fieldSelector.String(), diff --git a/server/workflow/forwarder_overwrite.go b/pkg/apiclient/workflow/forwarder_overwrite.go similarity index 100% rename from server/workflow/forwarder_overwrite.go rename to pkg/apiclient/workflow/forwarder_overwrite.go diff --git a/server/workflow/workflow.pb.go b/pkg/apiclient/workflow/workflow.pb.go similarity index 100% rename from server/workflow/workflow.pb.go rename to pkg/apiclient/workflow/workflow.pb.go diff --git a/server/workflow/workflow.pb.gw.go b/pkg/apiclient/workflow/workflow.pb.gw.go similarity index 100% rename from server/workflow/workflow.pb.gw.go rename to pkg/apiclient/workflow/workflow.pb.gw.go diff --git a/server/workflow/workflow.proto b/pkg/apiclient/workflow/workflow.proto similarity index 100% rename from server/workflow/workflow.proto rename to pkg/apiclient/workflow/workflow.proto diff --git a/server/workflow/workflow.swagger.json b/pkg/apiclient/workflow/workflow.swagger.json similarity index 100% rename from server/workflow/workflow.swagger.json rename to pkg/apiclient/workflow/workflow.swagger.json diff --git a/server/apiserver/argoserver.go b/server/apiserver/argoserver.go index ec3eb45ec64d..c4f2a6cbac2d 100644 --- a/server/apiserver/argoserver.go +++ b/server/apiserver/argoserver.go @@ -7,6 +7,7 @@ import ( "time" cronworkflowpkg "github.com/argoproj/argo/pkg/apiclient/cronworkflow" + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" "github.com/argoproj/argo/server/artifacts" "github.com/argoproj/argo/server/auth" "github.com/argoproj/argo/server/cronworkflow" @@ -178,7 +179,7 @@ func (as *argoServer) newGRPCServer(offloadNodeStatusRepo sqldb.OffloadNodeStatu grpcServer := grpc.NewServer(sOpts...) info.RegisterInfoServiceServer(grpcServer, info.NewInfoServer(as.managedNamespace)) - workflow.RegisterWorkflowServiceServer(grpcServer, workflow.NewWorkflowServer(offloadNodeStatusRepo)) + workflowpkg.RegisterWorkflowServiceServer(grpcServer, workflow.NewWorkflowServer(offloadNodeStatusRepo)) workflowtemplate.RegisterWorkflowTemplateServiceServer(grpcServer, workflowtemplate.NewWorkflowTemplateServer()) cronworkflowpkg.RegisterCronWorkflowServiceServer(grpcServer, cronworkflow.NewCronWorkflowServer()) workflowarchive.RegisterArchivedWorkflowServiceServer(grpcServer, workflowarchive.NewWorkflowArchiveServer(wfArchive)) @@ -212,7 +213,7 @@ func (as *argoServer) newHTTPServer(ctx context.Context, port int, artifactServe gwMuxOpts := runtime.WithMarshalerOption(runtime.MIMEWildcard, new(json.JSONMarshaler)) gwmux := runtime.NewServeMux(gwMuxOpts) mustRegisterGWHandler(info.RegisterInfoServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) - mustRegisterGWHandler(workflow.RegisterWorkflowServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) + mustRegisterGWHandler(workflowpkg.RegisterWorkflowServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) mustRegisterGWHandler(workflowtemplate.RegisterWorkflowTemplateServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) mustRegisterGWHandler(cronworkflowpkg.RegisterCronWorkflowServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) mustRegisterGWHandler(workflowarchive.RegisterArchivedWorkflowServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) diff --git a/server/workflow/workflow_server.go b/server/workflow/workflow_server.go index cd74d55ba8ed..958309f342a2 100644 --- a/server/workflow/workflow_server.go +++ b/server/workflow/workflow_server.go @@ -4,14 +4,14 @@ import ( "bufio" "fmt" - "github.com/argoproj/argo/server/auth" - log "github.com/sirupsen/logrus" "golang.org/x/net/context" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/argoproj/argo/persist/sqldb" + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" + "github.com/argoproj/argo/server/auth" "github.com/argoproj/argo/workflow/common" "github.com/argoproj/argo/workflow/packer" "github.com/argoproj/argo/workflow/templateresolution" @@ -23,13 +23,13 @@ type workflowServer struct { offloadNodeStatusRepo sqldb.OffloadNodeStatusRepo } -func NewWorkflowServer(offloadNodeStatusRepo sqldb.OffloadNodeStatusRepo) WorkflowServiceServer { +func NewWorkflowServer(offloadNodeStatusRepo sqldb.OffloadNodeStatusRepo) workflowpkg.WorkflowServiceServer { return &workflowServer{ offloadNodeStatusRepo: offloadNodeStatusRepo, } } -func (s *workflowServer) CreateWorkflow(ctx context.Context, req *WorkflowCreateRequest) (*v1alpha1.Workflow, error) { +func (s *workflowServer) CreateWorkflow(ctx context.Context, req *workflowpkg.WorkflowCreateRequest) (*v1alpha1.Workflow, error) { wfClient := auth.GetWfClient(ctx) if req.Workflow == nil { @@ -70,7 +70,7 @@ func (s *workflowServer) CreateWorkflow(ctx context.Context, req *WorkflowCreate return wf, nil } -func (s *workflowServer) GetWorkflow(ctx context.Context, req *WorkflowGetRequest) (*v1alpha1.Workflow, error) { +func (s *workflowServer) GetWorkflow(ctx context.Context, req *workflowpkg.WorkflowGetRequest) (*v1alpha1.Workflow, error) { wfClient := auth.GetWfClient(ctx) wfGetOption := metav1.GetOptions{} @@ -96,7 +96,7 @@ func (s *workflowServer) GetWorkflow(ctx context.Context, req *WorkflowGetReques return wf, nil } -func (s *workflowServer) ListWorkflows(ctx context.Context, req *WorkflowListRequest) (*v1alpha1.WorkflowList, error) { +func (s *workflowServer) ListWorkflows(ctx context.Context, req *workflowpkg.WorkflowListRequest) (*v1alpha1.WorkflowList, error) { wfClient := auth.GetWfClient(ctx) var listOption = metav1.ListOptions{} @@ -123,7 +123,7 @@ func (s *workflowServer) ListWorkflows(ctx context.Context, req *WorkflowListReq return &v1alpha1.WorkflowList{Items: wfList.Items}, nil } -func (s *workflowServer) WatchWorkflows(req *WatchWorkflowsRequest, ws WorkflowService_WatchWorkflowsServer) error { +func (s *workflowServer) WatchWorkflows(req *workflowpkg.WatchWorkflowsRequest, ws workflowpkg.WorkflowService_WatchWorkflowsServer) error { wfClient := auth.GetWfClient(ws.Context()) opts := metav1.ListOptions{} if req.ListOptions != nil { @@ -163,7 +163,7 @@ func (s *workflowServer) WatchWorkflows(req *WatchWorkflowsRequest, ws WorkflowS wf.Status.Nodes = offloadedNodes } logCtx.Debug("Sending event") - err = ws.Send(&WorkflowWatchEvent{Type: string(next.Type), Object: wf}) + err = ws.Send(&workflowpkg.WorkflowWatchEvent{Type: string(next.Type), Object: wf}) if err != nil { return err } @@ -173,17 +173,17 @@ func (s *workflowServer) WatchWorkflows(req *WatchWorkflowsRequest, ws WorkflowS return nil } -func (s *workflowServer) DeleteWorkflow(ctx context.Context, req *WorkflowDeleteRequest) (*WorkflowDeleteResponse, error) { +func (s *workflowServer) DeleteWorkflow(ctx context.Context, req *workflowpkg.WorkflowDeleteRequest) (*workflowpkg.WorkflowDeleteResponse, error) { wfClient := auth.GetWfClient(ctx) err := wfClient.ArgoprojV1alpha1().Workflows(req.Namespace).Delete(req.Name, &metav1.DeleteOptions{}) if err != nil { return nil, err } - return &WorkflowDeleteResponse{}, nil + return &workflowpkg.WorkflowDeleteResponse{}, nil } -func (s *workflowServer) RetryWorkflow(ctx context.Context, req *WorkflowRetryRequest) (*v1alpha1.Workflow, error) { +func (s *workflowServer) RetryWorkflow(ctx context.Context, req *workflowpkg.WorkflowRetryRequest) (*v1alpha1.Workflow, error) { wfClient := auth.GetWfClient(ctx) kubeClient := auth.GetKubeClient(ctx) @@ -199,7 +199,7 @@ func (s *workflowServer) RetryWorkflow(ctx context.Context, req *WorkflowRetryRe return wf, nil } -func (s *workflowServer) ResubmitWorkflow(ctx context.Context, req *WorkflowResubmitRequest) (*v1alpha1.Workflow, error) { +func (s *workflowServer) ResubmitWorkflow(ctx context.Context, req *workflowpkg.WorkflowResubmitRequest) (*v1alpha1.Workflow, error) { wfClient := auth.GetWfClient(ctx) wf, err := wfClient.ArgoprojV1alpha1().Workflows(req.Namespace).Get(req.Name, metav1.GetOptions{}) if err != nil { @@ -218,7 +218,7 @@ func (s *workflowServer) ResubmitWorkflow(ctx context.Context, req *WorkflowResu return created, nil } -func (s *workflowServer) ResumeWorkflow(ctx context.Context, req *WorkflowResumeRequest) (*v1alpha1.Workflow, error) { +func (s *workflowServer) ResumeWorkflow(ctx context.Context, req *workflowpkg.WorkflowResumeRequest) (*v1alpha1.Workflow, error) { wfClient := auth.GetWfClient(ctx) err := util.ResumeWorkflow(wfClient.ArgoprojV1alpha1().Workflows(req.Namespace), req.Name) if err != nil { @@ -234,7 +234,7 @@ func (s *workflowServer) ResumeWorkflow(ctx context.Context, req *WorkflowResume return wf, nil } -func (s *workflowServer) SuspendWorkflow(ctx context.Context, req *WorkflowSuspendRequest) (*v1alpha1.Workflow, error) { +func (s *workflowServer) SuspendWorkflow(ctx context.Context, req *workflowpkg.WorkflowSuspendRequest) (*v1alpha1.Workflow, error) { wfClient := auth.GetWfClient(ctx) err := util.SuspendWorkflow(wfClient.ArgoprojV1alpha1().Workflows(req.Namespace), req.Name) if err != nil { @@ -249,7 +249,7 @@ func (s *workflowServer) SuspendWorkflow(ctx context.Context, req *WorkflowSuspe return wf, nil } -func (s *workflowServer) TerminateWorkflow(ctx context.Context, req *WorkflowTerminateRequest) (*v1alpha1.Workflow, error) { +func (s *workflowServer) TerminateWorkflow(ctx context.Context, req *workflowpkg.WorkflowTerminateRequest) (*v1alpha1.Workflow, error) { wfClient := auth.GetWfClient(ctx) err := util.TerminateWorkflow(wfClient.ArgoprojV1alpha1().Workflows(req.Namespace), req.Name) if err != nil { @@ -263,7 +263,7 @@ func (s *workflowServer) TerminateWorkflow(ctx context.Context, req *WorkflowTer return wf, nil } -func (s *workflowServer) LintWorkflow(ctx context.Context, req *WorkflowLintRequest) (*v1alpha1.Workflow, error) { +func (s *workflowServer) LintWorkflow(ctx context.Context, req *workflowpkg.WorkflowLintRequest) (*v1alpha1.Workflow, error) { wfClient := auth.GetWfClient(ctx) wftmplGetter := templateresolution.WrapWorkflowTemplateInterface(wfClient.ArgoprojV1alpha1().WorkflowTemplates(req.Namespace)) @@ -276,7 +276,7 @@ func (s *workflowServer) LintWorkflow(ctx context.Context, req *WorkflowLintRequ return req.Workflow, nil } -func (s *workflowServer) PodLogs(req *WorkflowLogRequest, ws WorkflowService_PodLogsServer) error { +func (s *workflowServer) PodLogs(req *workflowpkg.WorkflowLogRequest, ws workflowpkg.WorkflowService_PodLogsServer) error { kubeClient := auth.GetKubeClient(ws.Context()) stream, err := kubeClient.CoreV1().Pods(req.Namespace).GetLogs(req.PodName, req.LogOptions).Stream() if err != nil { @@ -284,7 +284,7 @@ func (s *workflowServer) PodLogs(req *WorkflowLogRequest, ws WorkflowService_Pod } scanner := bufio.NewScanner(stream) for scanner.Scan() { - err = ws.Send(&LogEntry{Content: scanner.Text()}) + err = ws.Send(&workflowpkg.LogEntry{Content: scanner.Text()}) if err != nil { return err } diff --git a/server/workflow/workflow_server_test.go b/server/workflow/workflow_server_test.go index 5ed56c9a998f..8485b272c4b1 100644 --- a/server/workflow/workflow_server_test.go +++ b/server/workflow/workflow_server_test.go @@ -15,6 +15,7 @@ import ( "github.com/argoproj/argo/persist/sqldb" "github.com/argoproj/argo/persist/sqldb/mocks" + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" v1alpha "github.com/argoproj/argo/pkg/client/clientset/versioned/fake" "github.com/argoproj/argo/server/auth" @@ -356,7 +357,7 @@ const workflow = ` } ` -func getWorkflowServer() (WorkflowServiceServer, context.Context) { +func getWorkflowServer() (workflowpkg.WorkflowServiceServer, context.Context) { var wfObj1, wfObj2, wfObj3, wfObj4, wfObj5 v1alpha1.Workflow _ = json.Unmarshal([]byte(wf1), &wfObj1) @@ -385,9 +386,9 @@ func generateNameReactor(action ktesting.Action) (handled bool, ret runtime.Obje return false, nil, nil } -func getWorkflow(ctx context.Context, server WorkflowServiceServer, namespace string, wfName string) (*v1alpha1.Workflow, error) { +func getWorkflow(ctx context.Context, server workflowpkg.WorkflowServiceServer, namespace string, wfName string) (*v1alpha1.Workflow, error) { - req := WorkflowGetRequest{ + req := workflowpkg.WorkflowGetRequest{ Name: wfName, Namespace: namespace, } @@ -395,15 +396,15 @@ func getWorkflow(ctx context.Context, server WorkflowServiceServer, namespace st return server.GetWorkflow(ctx, &req) } -func getWorkflowList(ctx context.Context, server WorkflowServiceServer, namespace string) (*v1alpha1.WorkflowList, error) { - return server.ListWorkflows(ctx, &WorkflowListRequest{Namespace: namespace}) +func getWorkflowList(ctx context.Context, server workflowpkg.WorkflowServiceServer, namespace string) (*v1alpha1.WorkflowList, error) { + return server.ListWorkflows(ctx, &workflowpkg.WorkflowListRequest{Namespace: namespace}) } func TestCreateWorkflow(t *testing.T) { server, ctx := getWorkflowServer() - var req WorkflowCreateRequest + var req workflowpkg.WorkflowCreateRequest _ = json.Unmarshal([]byte(workflow), &req) wf, err := server.CreateWorkflow(ctx, &req) @@ -457,7 +458,7 @@ func TestDeleteWorkflow(t *testing.T) { wf, err := getWorkflow(ctx, server, "workflows", "hello-world-b6h5m") assert.Nil(t, err) - delReq := WorkflowDeleteRequest{ + delReq := workflowpkg.WorkflowDeleteRequest{ Name: wf.Name, Namespace: wf.Namespace, } @@ -478,7 +479,7 @@ func TestSuspendResumeWorkflow(t *testing.T) { wf, err := getWorkflow(ctx, server, "workflows", "hello-world-9tql2-run") assert.Nil(t, err) - susWfReq := WorkflowSuspendRequest{ + susWfReq := workflowpkg.WorkflowSuspendRequest{ Name: wf.Name, Namespace: wf.Namespace, } @@ -486,7 +487,7 @@ func TestSuspendResumeWorkflow(t *testing.T) { assert.NotNil(t, wf) assert.Equal(t, true, *wf.Spec.Suspend) assert.Nil(t, err) - rsmWfReq := WorkflowResumeRequest{ + rsmWfReq := workflowpkg.WorkflowResumeRequest{ Name: wf.Name, Namespace: wf.Namespace, } @@ -500,14 +501,14 @@ func TestSuspendResumeWorkflow(t *testing.T) { func TestSuspendResumeWorkflowWithNotFound(t *testing.T) { server, ctx := getWorkflowServer() - susWfReq := WorkflowSuspendRequest{ + susWfReq := workflowpkg.WorkflowSuspendRequest{ Name: "hello-world-9tql2-not", Namespace: "workflows", } wf, err := server.SuspendWorkflow(ctx, &susWfReq) assert.Nil(t, wf) assert.NotNil(t, err) - rsmWfReq := WorkflowResumeRequest{ + rsmWfReq := workflowpkg.WorkflowResumeRequest{ Name: "hello-world-9tql2-not", Namespace: "workflows", } @@ -521,7 +522,7 @@ func TestTerminateWorkflow(t *testing.T) { wf, err := getWorkflow(ctx, server, "workflows", "hello-world-9tql2-run") assert.Nil(t, err) - rsmWfReq := WorkflowTerminateRequest{ + rsmWfReq := workflowpkg.WorkflowTerminateRequest{ Name: wf.Name, Namespace: wf.Namespace, } @@ -530,7 +531,7 @@ func TestTerminateWorkflow(t *testing.T) { assert.Equal(t, int64(0), *wf.Spec.ActiveDeadlineSeconds) assert.Nil(t, err) - rsmWfReq = WorkflowTerminateRequest{ + rsmWfReq = workflowpkg.WorkflowTerminateRequest{ Name: "hello-world-9tql2-not", Namespace: "workflows", } @@ -544,7 +545,7 @@ func TestResubmitWorkflow(t *testing.T) { server, ctx := getWorkflowServer() wf, err := getWorkflow(ctx, server, "workflows", "hello-world-9tql2") assert.Nil(t, err) - wf, err = server.ResubmitWorkflow(ctx, &WorkflowResubmitRequest{ + wf, err = server.ResubmitWorkflow(ctx, &workflowpkg.WorkflowResubmitRequest{ Name: wf.Name, Namespace: wf.Namespace, }) diff --git a/util/api/util.go b/util/api/util.go index 18af6e38ec9c..3fbedae4f28b 100644 --- a/util/api/util.go +++ b/util/api/util.go @@ -3,13 +3,13 @@ package api import ( "context" + "github.com/argoproj/argo/pkg/apiclient/workflow" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" - apiwf "github.com/argoproj/argo/server/workflow" ) -func SubmitWorkflowToAPIServer(apiGRPCClient apiwf.WorkflowServiceClient, ctx context.Context, wf *wfv1.Workflow, dryRun bool) (*wfv1.Workflow, error) { +func SubmitWorkflowToAPIServer(apiGRPCClient workflow.WorkflowServiceClient, ctx context.Context, wf *wfv1.Workflow, dryRun bool) (*wfv1.Workflow, error) { - wfReq := apiwf.WorkflowCreateRequest{ + wfReq := workflow.WorkflowCreateRequest{ Namespace: wf.Namespace, Workflow: wf, ServerDryRun: dryRun, From 59f0d149b7f03e79a6344da86c7a8698caa13aaa Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Tue, 28 Jan 2020 10:51:20 -0800 Subject: [PATCH 12/34] moved workflow archive files --- .../commands/client/v1/argo-api-client.go | 8 ++++---- .../workflowarchive/workflow-archive.pb.go | 0 .../workflowarchive/workflow-archive.pb.gw.go | 0 .../workflowarchive/workflow-archive.proto | 0 .../workflow-archive.swagger.json | 0 server/apiserver/argoserver.go | 5 +++-- .../archived_workflow_server.go | 13 ++++++------ .../archived_workflow_server_test.go | 20 +++++++++---------- 8 files changed, 24 insertions(+), 22 deletions(-) rename {server => pkg/apiclient}/workflowarchive/workflow-archive.pb.go (100%) rename {server => pkg/apiclient}/workflowarchive/workflow-archive.pb.gw.go (100%) rename {server => pkg/apiclient}/workflowarchive/workflow-archive.proto (100%) rename {server => pkg/apiclient}/workflowarchive/workflow-archive.swagger.json (100%) diff --git a/cmd/argo/commands/client/v1/argo-api-client.go b/cmd/argo/commands/client/v1/argo-api-client.go index 92fb15b31918..90d0bbbba6bb 100644 --- a/cmd/argo/commands/client/v1/argo-api-client.go +++ b/cmd/argo/commands/client/v1/argo-api-client.go @@ -6,8 +6,8 @@ import ( "github.com/argoproj/argo/cmd/argo/commands/client" workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" + workflowarchivepkg "github.com/argoproj/argo/pkg/apiclient/workflowarchive" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" - "github.com/argoproj/argo/server/workflowarchive" ) // This client communicates with Argo using the Argo Server API. @@ -26,19 +26,19 @@ func (a *argoAPIClient) Namespace() (string, error) { } func (a *argoAPIClient) ListArchivedWorkflows(namespace string) (*wfv1.WorkflowList, error) { - return workflowarchive.NewArchivedWorkflowServiceClient(a.ClientConn).ListArchivedWorkflows(client.GetContext(), &workflowarchive.ListArchivedWorkflowsRequest{ + return workflowarchivepkg.NewArchivedWorkflowServiceClient(a.ClientConn).ListArchivedWorkflows(client.GetContext(), &workflowarchivepkg.ListArchivedWorkflowsRequest{ ListOptions: &metav1.ListOptions{FieldSelector: "metadata.namespace=" + namespace}, }) } func (a *argoAPIClient) GetArchivedWorkflow(uid string) (*wfv1.Workflow, error) { - return workflowarchive.NewArchivedWorkflowServiceClient(a.ClientConn).GetArchivedWorkflow(client.GetContext(), &workflowarchive.GetArchivedWorkflowRequest{ + return workflowarchivepkg.NewArchivedWorkflowServiceClient(a.ClientConn).GetArchivedWorkflow(client.GetContext(), &workflowarchivepkg.GetArchivedWorkflowRequest{ Uid: uid, }) } func (a *argoAPIClient) DeleteArchivedWorkflow(uid string) error { - _, err := workflowarchive.NewArchivedWorkflowServiceClient(a.ClientConn).DeleteArchivedWorkflow(client.GetContext(), &workflowarchive.DeleteArchivedWorkflowRequest{ + _, err := workflowarchivepkg.NewArchivedWorkflowServiceClient(a.ClientConn).DeleteArchivedWorkflow(client.GetContext(), &workflowarchivepkg.DeleteArchivedWorkflowRequest{ Uid: uid, }) return err diff --git a/server/workflowarchive/workflow-archive.pb.go b/pkg/apiclient/workflowarchive/workflow-archive.pb.go similarity index 100% rename from server/workflowarchive/workflow-archive.pb.go rename to pkg/apiclient/workflowarchive/workflow-archive.pb.go diff --git a/server/workflowarchive/workflow-archive.pb.gw.go b/pkg/apiclient/workflowarchive/workflow-archive.pb.gw.go similarity index 100% rename from server/workflowarchive/workflow-archive.pb.gw.go rename to pkg/apiclient/workflowarchive/workflow-archive.pb.gw.go diff --git a/server/workflowarchive/workflow-archive.proto b/pkg/apiclient/workflowarchive/workflow-archive.proto similarity index 100% rename from server/workflowarchive/workflow-archive.proto rename to pkg/apiclient/workflowarchive/workflow-archive.proto diff --git a/server/workflowarchive/workflow-archive.swagger.json b/pkg/apiclient/workflowarchive/workflow-archive.swagger.json similarity index 100% rename from server/workflowarchive/workflow-archive.swagger.json rename to pkg/apiclient/workflowarchive/workflow-archive.swagger.json diff --git a/server/apiserver/argoserver.go b/server/apiserver/argoserver.go index c4f2a6cbac2d..60c4757bdc6c 100644 --- a/server/apiserver/argoserver.go +++ b/server/apiserver/argoserver.go @@ -8,6 +8,7 @@ import ( cronworkflowpkg "github.com/argoproj/argo/pkg/apiclient/cronworkflow" workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" + workflowarchivepkg "github.com/argoproj/argo/pkg/apiclient/workflowarchive" "github.com/argoproj/argo/server/artifacts" "github.com/argoproj/argo/server/auth" "github.com/argoproj/argo/server/cronworkflow" @@ -182,7 +183,7 @@ func (as *argoServer) newGRPCServer(offloadNodeStatusRepo sqldb.OffloadNodeStatu workflowpkg.RegisterWorkflowServiceServer(grpcServer, workflow.NewWorkflowServer(offloadNodeStatusRepo)) workflowtemplate.RegisterWorkflowTemplateServiceServer(grpcServer, workflowtemplate.NewWorkflowTemplateServer()) cronworkflowpkg.RegisterCronWorkflowServiceServer(grpcServer, cronworkflow.NewCronWorkflowServer()) - workflowarchive.RegisterArchivedWorkflowServiceServer(grpcServer, workflowarchive.NewWorkflowArchiveServer(wfArchive)) + workflowarchivepkg.RegisterArchivedWorkflowServiceServer(grpcServer, workflowarchive.NewWorkflowArchiveServer(wfArchive)) return grpcServer } @@ -216,7 +217,7 @@ func (as *argoServer) newHTTPServer(ctx context.Context, port int, artifactServe mustRegisterGWHandler(workflowpkg.RegisterWorkflowServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) mustRegisterGWHandler(workflowtemplate.RegisterWorkflowTemplateServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) mustRegisterGWHandler(cronworkflowpkg.RegisterCronWorkflowServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) - mustRegisterGWHandler(workflowarchive.RegisterArchivedWorkflowServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) + mustRegisterGWHandler(workflowarchivepkg.RegisterArchivedWorkflowServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) mux.Handle("/api/", gwmux) mux.HandleFunc("/artifacts/", artifactServer.GetArtifact) mux.HandleFunc("/artifacts-by-uid/", artifactServer.GetArtifactByUID) diff --git a/server/workflowarchive/archived_workflow_server.go b/server/workflowarchive/archived_workflow_server.go index 652159714d28..b9349df5d3f6 100644 --- a/server/workflowarchive/archived_workflow_server.go +++ b/server/workflowarchive/archived_workflow_server.go @@ -12,6 +12,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/argoproj/argo/persist/sqldb" + workflowarchivepkg "github.com/argoproj/argo/pkg/apiclient/workflowarchive" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" "github.com/argoproj/argo/server/auth" ) @@ -20,11 +21,11 @@ type archivedWorkflowServer struct { wfArchive sqldb.WorkflowArchive } -func NewWorkflowArchiveServer(wfArchive sqldb.WorkflowArchive) ArchivedWorkflowServiceServer { +func NewWorkflowArchiveServer(wfArchive sqldb.WorkflowArchive) workflowarchivepkg.ArchivedWorkflowServiceServer { return &archivedWorkflowServer{wfArchive: wfArchive} } -func (w *archivedWorkflowServer) ListArchivedWorkflows(ctx context.Context, req *ListArchivedWorkflowsRequest) (*wfv1.WorkflowList, error) { +func (w *archivedWorkflowServer) ListArchivedWorkflows(ctx context.Context, req *workflowarchivepkg.ListArchivedWorkflowsRequest) (*wfv1.WorkflowList, error) { options := req.ListOptions if options == nil { options = &metav1.ListOptions{} @@ -78,7 +79,7 @@ func (w *archivedWorkflowServer) ListArchivedWorkflows(ctx context.Context, req return &wfv1.WorkflowList{ListMeta: meta, Items: items}, nil } -func (w *archivedWorkflowServer) GetArchivedWorkflow(ctx context.Context, req *GetArchivedWorkflowRequest) (*wfv1.Workflow, error) { +func (w *archivedWorkflowServer) GetArchivedWorkflow(ctx context.Context, req *workflowarchivepkg.GetArchivedWorkflowRequest) (*wfv1.Workflow, error) { wf, err := w.wfArchive.GetWorkflow(req.Uid) if err != nil { return nil, err @@ -96,8 +97,8 @@ func (w *archivedWorkflowServer) GetArchivedWorkflow(ctx context.Context, req *G return wf, err } -func (w *archivedWorkflowServer) DeleteArchivedWorkflow(ctx context.Context, req *DeleteArchivedWorkflowRequest) (*ArchivedWorkflowDeletedResponse, error) { - wf, err := w.GetArchivedWorkflow(ctx, &GetArchivedWorkflowRequest{Uid: req.Uid}) +func (w *archivedWorkflowServer) DeleteArchivedWorkflow(ctx context.Context, req *workflowarchivepkg.DeleteArchivedWorkflowRequest) (*workflowarchivepkg.ArchivedWorkflowDeletedResponse, error) { + wf, err := w.GetArchivedWorkflow(ctx, &workflowarchivepkg.GetArchivedWorkflowRequest{Uid: req.Uid}) if err != nil { return nil, err } @@ -112,5 +113,5 @@ func (w *archivedWorkflowServer) DeleteArchivedWorkflow(ctx context.Context, req if err != nil { return nil, err } - return &ArchivedWorkflowDeletedResponse{}, nil + return &workflowarchivepkg.ArchivedWorkflowDeletedResponse{}, nil } diff --git a/server/workflowarchive/archived_workflow_server_test.go b/server/workflowarchive/archived_workflow_server_test.go index 55cfe67c8ee7..e4bcc5d9b75d 100644 --- a/server/workflowarchive/archived_workflow_server_test.go +++ b/server/workflowarchive/archived_workflow_server_test.go @@ -4,8 +4,6 @@ import ( "context" "testing" - "github.com/argoproj/argo/server/auth" - "github.com/stretchr/testify/assert" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -17,8 +15,10 @@ import ( k8stesting "k8s.io/client-go/testing" "github.com/argoproj/argo/persist/sqldb/mocks" + workflowarchivepkg "github.com/argoproj/argo/pkg/apiclient/workflowarchive" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" argofake "github.com/argoproj/argo/pkg/client/clientset/versioned/fake" + "github.com/argoproj/argo/server/auth" ) func Test_archivedWorkflowServer(t *testing.T) { @@ -66,17 +66,17 @@ func Test_archivedWorkflowServer(t *testing.T) { ctx := context.WithValue(context.WithValue(context.TODO(), auth.WfKey, wfClient), auth.KubeKey, kubeClient) t.Run("ListArchivedWorkflows", func(t *testing.T) { allowed = false - resp, err := w.ListArchivedWorkflows(ctx, &ListArchivedWorkflowsRequest{ListOptions: &metav1.ListOptions{Limit: 1}}) + resp, err := w.ListArchivedWorkflows(ctx, &workflowarchivepkg.ListArchivedWorkflowsRequest{ListOptions: &metav1.ListOptions{Limit: 1}}) if assert.NoError(t, err) { assert.Len(t, resp.Items, 0) } allowed = true - resp, err = w.ListArchivedWorkflows(ctx, &ListArchivedWorkflowsRequest{ListOptions: &metav1.ListOptions{Limit: 1}}) + resp, err = w.ListArchivedWorkflows(ctx, &workflowarchivepkg.ListArchivedWorkflowsRequest{ListOptions: &metav1.ListOptions{Limit: 1}}) if assert.NoError(t, err) { assert.Len(t, resp.Items, 1) assert.Equal(t, "1", resp.Continue) } - resp, err = w.ListArchivedWorkflows(ctx, &ListArchivedWorkflowsRequest{ListOptions: &metav1.ListOptions{Continue: "1", Limit: 1}}) + resp, err = w.ListArchivedWorkflows(ctx, &workflowarchivepkg.ListArchivedWorkflowsRequest{ListOptions: &metav1.ListOptions{Continue: "1", Limit: 1}}) if assert.NoError(t, err) { assert.Len(t, resp.Items, 0) assert.Empty(t, resp.Continue) @@ -84,21 +84,21 @@ func Test_archivedWorkflowServer(t *testing.T) { }) t.Run("GetArchivedWorkflow", func(t *testing.T) { allowed = false - _, err := w.GetArchivedWorkflow(ctx, &GetArchivedWorkflowRequest{Uid: "my-uid"}) + _, err := w.GetArchivedWorkflow(ctx, &workflowarchivepkg.GetArchivedWorkflowRequest{Uid: "my-uid"}) assert.Equal(t, err, status.Error(codes.PermissionDenied, "permission denied")) allowed = true - _, err = w.GetArchivedWorkflow(ctx, &GetArchivedWorkflowRequest{}) + _, err = w.GetArchivedWorkflow(ctx, &workflowarchivepkg.GetArchivedWorkflowRequest{}) assert.Equal(t, err, status.Error(codes.NotFound, "not found")) - wf, err := w.GetArchivedWorkflow(ctx, &GetArchivedWorkflowRequest{Uid: "my-uid"}) + wf, err := w.GetArchivedWorkflow(ctx, &workflowarchivepkg.GetArchivedWorkflowRequest{Uid: "my-uid"}) assert.NoError(t, err) assert.NotNil(t, wf) }) t.Run("DeleteArchivedWorkflow", func(t *testing.T) { allowed = false - _, err := w.DeleteArchivedWorkflow(ctx, &DeleteArchivedWorkflowRequest{Uid: "my-uid"}) + _, err := w.DeleteArchivedWorkflow(ctx, &workflowarchivepkg.DeleteArchivedWorkflowRequest{Uid: "my-uid"}) assert.Equal(t, err, status.Error(codes.PermissionDenied, "permission denied")) allowed = true - _, err = w.DeleteArchivedWorkflow(ctx, &DeleteArchivedWorkflowRequest{Uid: "my-uid"}) + _, err = w.DeleteArchivedWorkflow(ctx, &workflowarchivepkg.DeleteArchivedWorkflowRequest{Uid: "my-uid"}) assert.NoError(t, err) }) } From 02c619349abd0746582935a73181e6fd2367e2bd Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Tue, 28 Jan 2020 10:55:55 -0800 Subject: [PATCH 13/34] moved workflow template files --- cmd/argo/commands/template/common.go | 6 +++--- cmd/argo/commands/template/create.go | 4 ++-- cmd/argo/commands/template/delete.go | 9 ++++----- cmd/argo/commands/template/get.go | 4 ++-- cmd/argo/commands/template/lint.go | 6 +++--- cmd/argo/commands/template/list.go | 4 ++-- .../workflowtemplate/workflow-template.pb.go | 0 .../workflowtemplate/workflow-template.pb.gw.go | 0 .../workflowtemplate/workflow-template.proto | 0 .../workflow-template.swagger.json | 0 server/apiserver/argoserver.go | 5 +++-- .../workflow_template_server.go | 17 +++++++++-------- .../workflow_template_server_test.go | 15 ++++++++------- 13 files changed, 36 insertions(+), 34 deletions(-) rename {server => pkg/apiclient}/workflowtemplate/workflow-template.pb.go (100%) rename {server => pkg/apiclient}/workflowtemplate/workflow-template.pb.gw.go (100%) rename {server => pkg/apiclient}/workflowtemplate/workflow-template.proto (100%) rename {server => pkg/apiclient}/workflowtemplate/workflow-template.swagger.json (100%) diff --git a/cmd/argo/commands/template/common.go b/cmd/argo/commands/template/common.go index 4acafc995cab..713528a84c28 100644 --- a/cmd/argo/commands/template/common.go +++ b/cmd/argo/commands/template/common.go @@ -9,10 +9,10 @@ import ( "k8s.io/client-go/rest" "github.com/argoproj/argo/cmd/argo/commands/client" + "github.com/argoproj/argo/pkg/apiclient/workflowtemplate" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" "github.com/argoproj/argo/pkg/client/clientset/versioned" "github.com/argoproj/argo/pkg/client/clientset/versioned/typed/workflow/v1alpha1" - wftmplApiServer "github.com/argoproj/argo/server/workflowtemplate" "github.com/argoproj/argo/workflow/templateresolution" ) @@ -77,6 +77,6 @@ func (c LazyWorkflowTemplateGetter) Get(name string) (*wfv1.WorkflowTemplate, er var _ templateresolution.WorkflowTemplateNamespacedGetter = &LazyWorkflowTemplateGetter{} -func GetWFtmplApiServerGRPCClient(conn *grpc.ClientConn) (wftmplApiServer.WorkflowTemplateServiceClient, context.Context) { - return wftmplApiServer.NewWorkflowTemplateServiceClient(conn), client.GetContext() +func GetWFtmplApiServerGRPCClient(conn *grpc.ClientConn) (workflowtemplate.WorkflowTemplateServiceClient, context.Context) { + return workflowtemplate.NewWorkflowTemplateServiceClient(conn), client.GetContext() } diff --git a/cmd/argo/commands/template/create.go b/cmd/argo/commands/template/create.go index 329eabdf7f4c..8d4ac4a41e70 100644 --- a/cmd/argo/commands/template/create.go +++ b/cmd/argo/commands/template/create.go @@ -8,8 +8,8 @@ import ( "github.com/spf13/cobra" "github.com/argoproj/argo/cmd/argo/commands/client" + workflowtemplatepkg "github.com/argoproj/argo/pkg/apiclient/workflowtemplate" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" - "github.com/argoproj/argo/server/workflowtemplate" "github.com/argoproj/argo/workflow/common" "github.com/argoproj/argo/workflow/templateresolution" "github.com/argoproj/argo/workflow/util" @@ -68,7 +68,7 @@ func CreateWorkflowTemplates(filePaths []string, cliOpts *cliCreateOpts) { var created *wfv1.WorkflowTemplate if client.ArgoServer != "" { ns, _, _ := client.Config.Namespace() - wftmplReq := workflowtemplate.WorkflowTemplateCreateRequest{ + wftmplReq := workflowtemplatepkg.WorkflowTemplateCreateRequest{ Namespace: ns, Template: &wftmpl, } diff --git a/cmd/argo/commands/template/delete.go b/cmd/argo/commands/template/delete.go index 1c54ac8ac0c0..651e5be3849d 100644 --- a/cmd/argo/commands/template/delete.go +++ b/cmd/argo/commands/template/delete.go @@ -12,8 +12,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/argoproj/argo/cmd/argo/commands/client" - "github.com/argoproj/argo/server/workflowtemplate" - + workflowtemplatepkg "github.com/argoproj/argo/pkg/apiclient/workflowtemplate" "github.com/argoproj/argo/pkg/client/clientset/versioned/typed/workflow/v1alpha1" ) @@ -58,7 +57,7 @@ func apiServerDeleteWorkflowTemplates(allWFs bool, wfTmplNames []string) { var delWFTmplNames []string if allWFs { - wftmplReq := workflowtemplate.WorkflowTemplateListRequest{ + wftmplReq := workflowtemplatepkg.WorkflowTemplateListRequest{ Namespace: ns, } wftmplList, err := wftmplApiClient.ListWorkflowTemplates(ctx, &wftmplReq) @@ -78,8 +77,8 @@ func apiServerDeleteWorkflowTemplates(allWFs bool, wfTmplNames []string) { } -func apiServerDeleteWorkflowTemplate(client workflowtemplate.WorkflowTemplateServiceClient, ctx context.Context, ns, wftmplName string) { - wfReq := workflowtemplate.WorkflowTemplateDeleteRequest{ +func apiServerDeleteWorkflowTemplate(client workflowtemplatepkg.WorkflowTemplateServiceClient, ctx context.Context, ns, wftmplName string) { + wfReq := workflowtemplatepkg.WorkflowTemplateDeleteRequest{ Name: wftmplName, Namespace: ns, } diff --git a/cmd/argo/commands/template/get.go b/cmd/argo/commands/template/get.go index dbf2d01e6c9f..1afdf966f3bb 100644 --- a/cmd/argo/commands/template/get.go +++ b/cmd/argo/commands/template/get.go @@ -13,8 +13,8 @@ import ( "github.com/argoproj/pkg/humanize" "github.com/argoproj/argo/cmd/argo/commands/client" + workflowtemplatepkg "github.com/argoproj/argo/pkg/apiclient/workflowtemplate" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" - "github.com/argoproj/argo/server/workflowtemplate" ) func NewGetCommand() *cobra.Command { @@ -38,7 +38,7 @@ func NewGetCommand() *cobra.Command { ns, _, _ := client.Config.Namespace() wftmplApiClient, ctx := GetWFtmplApiServerGRPCClient(conn) for _, arg := range args { - wfTempReq := workflowtemplate.WorkflowTemplateGetRequest{ + wfTempReq := workflowtemplatepkg.WorkflowTemplateGetRequest{ Name: arg, Namespace: ns, } diff --git a/cmd/argo/commands/template/lint.go b/cmd/argo/commands/template/lint.go index ac709059cad7..ddd85b2bedd6 100644 --- a/cmd/argo/commands/template/lint.go +++ b/cmd/argo/commands/template/lint.go @@ -11,8 +11,8 @@ import ( "google.golang.org/grpc" "github.com/argoproj/argo/cmd/argo/commands/client" + workflowtemplatepkg "github.com/argoproj/argo/pkg/apiclient/workflowtemplate" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" - "github.com/argoproj/argo/server/workflowtemplate" cmdutil "github.com/argoproj/argo/util/cmd" "github.com/argoproj/argo/workflow/validate" ) @@ -130,8 +130,8 @@ func ServerSideLint(args []string, conn *grpc.ClientConn, strict bool) error { return nil } -func ServerLintValidation(ctx context.Context, client workflowtemplate.WorkflowTemplateServiceClient, wfTmpl wfv1.WorkflowTemplate, ns string) error { - wfTmplReq := workflowtemplate.WorkflowTemplateLintRequest{ +func ServerLintValidation(ctx context.Context, client workflowtemplatepkg.WorkflowTemplateServiceClient, wfTmpl wfv1.WorkflowTemplate, ns string) error { + wfTmplReq := workflowtemplatepkg.WorkflowTemplateLintRequest{ Namespace: ns, Template: &wfTmpl, } diff --git a/cmd/argo/commands/template/list.go b/cmd/argo/commands/template/list.go index e92334408bd4..2ea03b29cda7 100644 --- a/cmd/argo/commands/template/list.go +++ b/cmd/argo/commands/template/list.go @@ -12,9 +12,9 @@ import ( "k8s.io/apimachinery/pkg/labels" "github.com/argoproj/argo/cmd/argo/commands/client" + workflowtemplatepkg "github.com/argoproj/argo/pkg/apiclient/workflowtemplate" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" "github.com/argoproj/argo/pkg/client/clientset/versioned/typed/workflow/v1alpha1" - "github.com/argoproj/argo/server/workflowtemplate" ) type listFlags struct { @@ -39,7 +39,7 @@ func NewListCommand() *cobra.Command { var wftmplList *wfv1.WorkflowTemplateList var err error if client.ArgoServer != "" { - wftmplReq := workflowtemplate.WorkflowTemplateListRequest{ + wftmplReq := workflowtemplatepkg.WorkflowTemplateListRequest{ Namespace: ns, } conn := client.GetClientConn() diff --git a/server/workflowtemplate/workflow-template.pb.go b/pkg/apiclient/workflowtemplate/workflow-template.pb.go similarity index 100% rename from server/workflowtemplate/workflow-template.pb.go rename to pkg/apiclient/workflowtemplate/workflow-template.pb.go diff --git a/server/workflowtemplate/workflow-template.pb.gw.go b/pkg/apiclient/workflowtemplate/workflow-template.pb.gw.go similarity index 100% rename from server/workflowtemplate/workflow-template.pb.gw.go rename to pkg/apiclient/workflowtemplate/workflow-template.pb.gw.go diff --git a/server/workflowtemplate/workflow-template.proto b/pkg/apiclient/workflowtemplate/workflow-template.proto similarity index 100% rename from server/workflowtemplate/workflow-template.proto rename to pkg/apiclient/workflowtemplate/workflow-template.proto diff --git a/server/workflowtemplate/workflow-template.swagger.json b/pkg/apiclient/workflowtemplate/workflow-template.swagger.json similarity index 100% rename from server/workflowtemplate/workflow-template.swagger.json rename to pkg/apiclient/workflowtemplate/workflow-template.swagger.json diff --git a/server/apiserver/argoserver.go b/server/apiserver/argoserver.go index 60c4757bdc6c..5a53b2b99e83 100644 --- a/server/apiserver/argoserver.go +++ b/server/apiserver/argoserver.go @@ -9,6 +9,7 @@ import ( cronworkflowpkg "github.com/argoproj/argo/pkg/apiclient/cronworkflow" workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" workflowarchivepkg "github.com/argoproj/argo/pkg/apiclient/workflowarchive" + workflowtemplatepkg "github.com/argoproj/argo/pkg/apiclient/workflowtemplate" "github.com/argoproj/argo/server/artifacts" "github.com/argoproj/argo/server/auth" "github.com/argoproj/argo/server/cronworkflow" @@ -181,7 +182,7 @@ func (as *argoServer) newGRPCServer(offloadNodeStatusRepo sqldb.OffloadNodeStatu info.RegisterInfoServiceServer(grpcServer, info.NewInfoServer(as.managedNamespace)) workflowpkg.RegisterWorkflowServiceServer(grpcServer, workflow.NewWorkflowServer(offloadNodeStatusRepo)) - workflowtemplate.RegisterWorkflowTemplateServiceServer(grpcServer, workflowtemplate.NewWorkflowTemplateServer()) + workflowtemplatepkg.RegisterWorkflowTemplateServiceServer(grpcServer, workflowtemplate.NewWorkflowTemplateServer()) cronworkflowpkg.RegisterCronWorkflowServiceServer(grpcServer, cronworkflow.NewCronWorkflowServer()) workflowarchivepkg.RegisterArchivedWorkflowServiceServer(grpcServer, workflowarchive.NewWorkflowArchiveServer(wfArchive)) @@ -215,7 +216,7 @@ func (as *argoServer) newHTTPServer(ctx context.Context, port int, artifactServe gwmux := runtime.NewServeMux(gwMuxOpts) mustRegisterGWHandler(info.RegisterInfoServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) mustRegisterGWHandler(workflowpkg.RegisterWorkflowServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) - mustRegisterGWHandler(workflowtemplate.RegisterWorkflowTemplateServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) + mustRegisterGWHandler(workflowtemplatepkg.RegisterWorkflowTemplateServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) mustRegisterGWHandler(cronworkflowpkg.RegisterCronWorkflowServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) mustRegisterGWHandler(workflowarchivepkg.RegisterArchivedWorkflowServiceHandlerFromEndpoint, ctx, gwmux, endpoint, dialOpts) mux.Handle("/api/", gwmux) diff --git a/server/workflowtemplate/workflow_template_server.go b/server/workflowtemplate/workflow_template_server.go index 8bb9c098274c..0ab30c5c576e 100644 --- a/server/workflowtemplate/workflow_template_server.go +++ b/server/workflowtemplate/workflow_template_server.go @@ -7,6 +7,7 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + workflowtemplatepkg "github.com/argoproj/argo/pkg/apiclient/workflowtemplate" "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" "github.com/argoproj/argo/server/auth" "github.com/argoproj/argo/workflow/templateresolution" @@ -16,11 +17,11 @@ import ( type WorkflowTemplateServer struct { } -func NewWorkflowTemplateServer() WorkflowTemplateServiceServer { +func NewWorkflowTemplateServer() workflowtemplatepkg.WorkflowTemplateServiceServer { return &WorkflowTemplateServer{} } -func (wts *WorkflowTemplateServer) CreateWorkflowTemplate(ctx context.Context, req *WorkflowTemplateCreateRequest) (*v1alpha1.WorkflowTemplate, error) { +func (wts *WorkflowTemplateServer) CreateWorkflowTemplate(ctx context.Context, req *workflowtemplatepkg.WorkflowTemplateCreateRequest) (*v1alpha1.WorkflowTemplate, error) { wfClient := auth.GetWfClient(ctx) if req.Template == nil { return nil, fmt.Errorf("workflow template was not found in the request body") @@ -36,7 +37,7 @@ func (wts *WorkflowTemplateServer) CreateWorkflowTemplate(ctx context.Context, r } -func (wts *WorkflowTemplateServer) GetWorkflowTemplate(ctx context.Context, req *WorkflowTemplateGetRequest) (*v1alpha1.WorkflowTemplate, error) { +func (wts *WorkflowTemplateServer) GetWorkflowTemplate(ctx context.Context, req *workflowtemplatepkg.WorkflowTemplateGetRequest) (*v1alpha1.WorkflowTemplate, error) { wfClient := auth.GetWfClient(ctx) wfTmpl, err := wfClient.ArgoprojV1alpha1().WorkflowTemplates(req.Namespace).Get(req.Name, v1.GetOptions{}) @@ -48,7 +49,7 @@ func (wts *WorkflowTemplateServer) GetWorkflowTemplate(ctx context.Context, req return wfTmpl, err } -func (wts *WorkflowTemplateServer) ListWorkflowTemplates(ctx context.Context, req *WorkflowTemplateListRequest) (*v1alpha1.WorkflowTemplateList, error) { +func (wts *WorkflowTemplateServer) ListWorkflowTemplates(ctx context.Context, req *workflowtemplatepkg.WorkflowTemplateListRequest) (*v1alpha1.WorkflowTemplateList, error) { wfClient := auth.GetWfClient(ctx) options := v1.ListOptions{} if req.ListOptions != nil { @@ -64,7 +65,7 @@ func (wts *WorkflowTemplateServer) ListWorkflowTemplates(ctx context.Context, re return wfList, nil } -func (wts *WorkflowTemplateServer) DeleteWorkflowTemplate(ctx context.Context, req *WorkflowTemplateDeleteRequest) (*WorkflowDeleteResponse, error) { +func (wts *WorkflowTemplateServer) DeleteWorkflowTemplate(ctx context.Context, req *workflowtemplatepkg.WorkflowTemplateDeleteRequest) (*workflowtemplatepkg.WorkflowDeleteResponse, error) { wfClient := auth.GetWfClient(ctx) err := wfClient.ArgoprojV1alpha1().WorkflowTemplates(req.Namespace).Delete(req.Name, &v1.DeleteOptions{}) @@ -72,10 +73,10 @@ func (wts *WorkflowTemplateServer) DeleteWorkflowTemplate(ctx context.Context, r return nil, err } - return &WorkflowDeleteResponse{}, nil + return &workflowtemplatepkg.WorkflowDeleteResponse{}, nil } -func (wts *WorkflowTemplateServer) LintWorkflowTemplate(ctx context.Context, req *WorkflowTemplateLintRequest) (*v1alpha1.WorkflowTemplate, error) { +func (wts *WorkflowTemplateServer) LintWorkflowTemplate(ctx context.Context, req *workflowtemplatepkg.WorkflowTemplateLintRequest) (*v1alpha1.WorkflowTemplate, error) { wfClient := auth.GetWfClient(ctx) wftmplGetter := templateresolution.WrapWorkflowTemplateInterface(wfClient.ArgoprojV1alpha1().WorkflowTemplates(req.Namespace)) @@ -88,7 +89,7 @@ func (wts *WorkflowTemplateServer) LintWorkflowTemplate(ctx context.Context, req return req.Template, nil } -func (wts *WorkflowTemplateServer) UpdateWorkflowTemplate(ctx context.Context, req *WorkflowTemplateUpdateRequest) (*v1alpha1.WorkflowTemplate, error) { +func (wts *WorkflowTemplateServer) UpdateWorkflowTemplate(ctx context.Context, req *workflowtemplatepkg.WorkflowTemplateUpdateRequest) (*v1alpha1.WorkflowTemplate, error) { if req.Template == nil { return nil, fmt.Errorf("WorkflowTemplate is not found in Request body") } diff --git a/server/workflowtemplate/workflow_template_server_test.go b/server/workflowtemplate/workflow_template_server_test.go index c191c08232dc..0e962bd89c32 100644 --- a/server/workflowtemplate/workflow_template_server_test.go +++ b/server/workflowtemplate/workflow_template_server_test.go @@ -5,6 +5,7 @@ import ( "encoding/json" "testing" + workflowtemplatepkg "github.com/argoproj/argo/pkg/apiclient/workflowtemplate" "github.com/argoproj/argo/server/auth" "github.com/stretchr/testify/assert" @@ -119,7 +120,7 @@ const wftStr3 = ` } ` -func getWorkflowTemplateServer() (WorkflowTemplateServiceServer, context.Context) { +func getWorkflowTemplateServer() (workflowtemplatepkg.WorkflowTemplateServiceServer, context.Context) { var wftObj1, wftObj2 v1alpha1.WorkflowTemplate _ = json.Unmarshal([]byte(wftStr2), &wftObj1) _ = json.Unmarshal([]byte(wftStr3), &wftObj2) @@ -131,7 +132,7 @@ func getWorkflowTemplateServer() (WorkflowTemplateServiceServer, context.Context func TestWorkflowTemplateServer_CreateWorkflowTemplate(t *testing.T) { server, ctx := getWorkflowTemplateServer() - var wftReq WorkflowTemplateCreateRequest + var wftReq workflowtemplatepkg.WorkflowTemplateCreateRequest err := json.Unmarshal([]byte(wftStr1), &wftReq) assert.Nil(t, err) wftRsp, err := server.CreateWorkflowTemplate(ctx, &wftReq) @@ -142,7 +143,7 @@ func TestWorkflowTemplateServer_CreateWorkflowTemplate(t *testing.T) { func TestWorkflowTemplateServer_GetWorkflowTemplate(t *testing.T) { server, ctx := getWorkflowTemplateServer() - wftReq := WorkflowTemplateGetRequest{ + wftReq := workflowtemplatepkg.WorkflowTemplateGetRequest{ Name: "workflow-template-whalesay-template2", Namespace: "default", } @@ -155,7 +156,7 @@ func TestWorkflowTemplateServer_GetWorkflowTemplate(t *testing.T) { func TestWorkflowTemplateServer_ListWorkflowTemplates(t *testing.T) { server, ctx := getWorkflowTemplateServer() - wftReq := WorkflowTemplateListRequest{ + wftReq := workflowtemplatepkg.WorkflowTemplateListRequest{ Namespace: "default", } wftRsp, err := server.ListWorkflowTemplates(ctx, &wftReq) @@ -163,7 +164,7 @@ func TestWorkflowTemplateServer_ListWorkflowTemplates(t *testing.T) { assert.Len(t, wftRsp.Items, 2) } - wftReq = WorkflowTemplateListRequest{ + wftReq = workflowtemplatepkg.WorkflowTemplateListRequest{ Namespace: "test", } wftRsp, err = server.ListWorkflowTemplates(ctx, &wftReq) @@ -174,7 +175,7 @@ func TestWorkflowTemplateServer_ListWorkflowTemplates(t *testing.T) { func TestWorkflowTemplateServer_DeleteWorkflowTemplate(t *testing.T) { server, ctx := getWorkflowTemplateServer() - wftReq := WorkflowTemplateDeleteRequest{ + wftReq := workflowtemplatepkg.WorkflowTemplateDeleteRequest{ Namespace: "default", Name: "workflow-template-whalesay-template2", } @@ -189,7 +190,7 @@ func TestWorkflowTemplateServer_UpdateWorkflowTemplate(t *testing.T) { err := json.Unmarshal([]byte(wftStr2), &wftObj1) assert.Nil(t, err) wftObj1.Spec.Templates[0].Container.Image = "alpine:latest" - wftReq := WorkflowTemplateUpdateRequest{ + wftReq := workflowtemplatepkg.WorkflowTemplateUpdateRequest{ Namespace: "default", Name: "workflow-template-whalesay-template2", Template: &wftObj1, From 7bd8619e313e80350df56386561989641ac0850b Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Tue, 28 Jan 2020 13:07:34 -0800 Subject: [PATCH 14/34] tweak readinessProbe --- manifests/install.yaml | 4 ++-- manifests/namespace-install.yaml | 4 ++-- manifests/quick-start-mysql.yaml | 4 ++-- manifests/quick-start-no-db.yaml | 4 ++-- manifests/quick-start-postgres.yaml | 4 ++-- test/e2e/manifests/mysql.yaml | 4 ++-- test/e2e/manifests/no-db.yaml | 4 ++-- test/e2e/manifests/postgres.yaml | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/manifests/install.yaml b/manifests/install.yaml index c06304a3e411..df2ac4fe00ac 100644 --- a/manifests/install.yaml +++ b/manifests/install.yaml @@ -357,8 +357,8 @@ spec: path: / port: 2746 scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 30 + initialDelaySeconds: 10 + periodSeconds: 20 serviceAccountName: argo-server --- apiVersion: apps/v1 diff --git a/manifests/namespace-install.yaml b/manifests/namespace-install.yaml index eb316b68c255..a3ba5cf3b99d 100644 --- a/manifests/namespace-install.yaml +++ b/manifests/namespace-install.yaml @@ -265,8 +265,8 @@ spec: path: / port: 2746 scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 30 + initialDelaySeconds: 10 + periodSeconds: 20 serviceAccountName: argo-server --- apiVersion: apps/v1 diff --git a/manifests/quick-start-mysql.yaml b/manifests/quick-start-mysql.yaml index fb974d567bfb..07d0284973c9 100644 --- a/manifests/quick-start-mysql.yaml +++ b/manifests/quick-start-mysql.yaml @@ -379,8 +379,8 @@ spec: path: / port: 2746 scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 30 + initialDelaySeconds: 10 + periodSeconds: 20 serviceAccountName: argo-server --- apiVersion: apps/v1 diff --git a/manifests/quick-start-no-db.yaml b/manifests/quick-start-no-db.yaml index ed7da9cbca8e..9d37c1187098 100644 --- a/manifests/quick-start-no-db.yaml +++ b/manifests/quick-start-no-db.yaml @@ -337,8 +337,8 @@ spec: path: / port: 2746 scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 30 + initialDelaySeconds: 10 + periodSeconds: 20 serviceAccountName: argo-server --- apiVersion: apps/v1 diff --git a/manifests/quick-start-postgres.yaml b/manifests/quick-start-postgres.yaml index ad390f20226e..d7246d3d7112 100644 --- a/manifests/quick-start-postgres.yaml +++ b/manifests/quick-start-postgres.yaml @@ -379,8 +379,8 @@ spec: path: / port: 2746 scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 30 + initialDelaySeconds: 10 + periodSeconds: 20 serviceAccountName: argo-server --- apiVersion: apps/v1 diff --git a/test/e2e/manifests/mysql.yaml b/test/e2e/manifests/mysql.yaml index b7906593b8bf..2013f5eb6a36 100644 --- a/test/e2e/manifests/mysql.yaml +++ b/test/e2e/manifests/mysql.yaml @@ -389,8 +389,8 @@ spec: path: / port: 2746 scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 30 + initialDelaySeconds: 10 + periodSeconds: 20 serviceAccountName: argo-server --- apiVersion: apps/v1 diff --git a/test/e2e/manifests/no-db.yaml b/test/e2e/manifests/no-db.yaml index a4d42ac86b20..eb332dfcb663 100644 --- a/test/e2e/manifests/no-db.yaml +++ b/test/e2e/manifests/no-db.yaml @@ -347,8 +347,8 @@ spec: path: / port: 2746 scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 30 + initialDelaySeconds: 10 + periodSeconds: 20 serviceAccountName: argo-server --- apiVersion: apps/v1 diff --git a/test/e2e/manifests/postgres.yaml b/test/e2e/manifests/postgres.yaml index dd612bf2df2e..9444b352191f 100644 --- a/test/e2e/manifests/postgres.yaml +++ b/test/e2e/manifests/postgres.yaml @@ -389,8 +389,8 @@ spec: path: / port: 2746 scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 30 + initialDelaySeconds: 10 + periodSeconds: 20 serviceAccountName: argo-server --- apiVersion: apps/v1 From 4ffd703a71e3be106d576c2941eb1352cd2bfe0f Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Tue, 28 Jan 2020 13:07:47 -0800 Subject: [PATCH 15/34] build: make cli before cli tests --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ce705d9e0711..fedf6dc7f7f4 100644 --- a/Makefile +++ b/Makefile @@ -381,7 +381,7 @@ test-api: test-images go test -timeout 3m -v -count 1 -p 1 -run ArgoServerSuite ./test/e2e .PHONY: test-cli -test-cli: test-images +test-cli: test-images cli # Run CLI tests go test -timeout 1m -v -count 1 -p 1 -run CliSuite ./test/e2e go test -timeout 1m -v -count 1 -p 1 -run CLIWithServerSuite ./test/e2e From 9135b3cf57e960447c180c9eac3aacf0f8f9cbaf Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Tue, 28 Jan 2020 13:08:04 -0800 Subject: [PATCH 16/34] build: make cli before tests --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fedf6dc7f7f4..38cf37e0df89 100644 --- a/Makefile +++ b/Makefile @@ -366,7 +366,7 @@ mysql-cli: kubectl exec -ti `kubectl get pod -l app=mysql -o name|cut -c 5-` -- mysql -u mysql -ppassword argo .PHONY: test-e2e -test-e2e: test-images +test-e2e: test-images cli # Run E2E tests go test -timeout 20m -v -count 1 -p 1 ./test/e2e/... From f9707ed7732df9671c6e2b8dbce2a946c109f0e3 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Tue, 28 Jan 2020 13:08:51 -0800 Subject: [PATCH 17/34] feat: introduce various components --- cmd/argo/commands/archive/delete.go | 10 +- cmd/argo/commands/archive/get.go | 8 +- cmd/argo/commands/archive/list.go | 16 +- cmd/argo/commands/client/conn.go | 32 ++- .../commands/client/v1/argo-api-client.go | 73 ------ cmd/argo/commands/client/v1/interface.go | 27 --- cmd/argo/commands/client/v1/kube-client.go | 121 ---------- cmd/argo/commands/get.go | 15 +- cmd/argo/commands/list.go | 21 +- cmd/argo/commands/submit.go | 26 ++- cmd/argo/commands/token.go | 9 +- pkg/apiclient/apiclient.go | 23 +- pkg/apiclient/argo-server-client.go | 51 ++++ pkg/apiclient/kube-client.go | 36 +++ pkg/apiclient/kube-workflow-service-client.go | 128 ++++++++++ server/apiserver/argoserver.go | 12 +- server/workflow/workflow_server.go | 4 + test/e2e/argo_server_test.go | 16 +- test/e2e/cli_test.go | 220 +++++++++++------- test/e2e/cli_with_server_test.go | 63 ++--- test/e2e/cron_test.go | 18 +- test/e2e/fixtures/e2e_suite.go | 4 +- test/e2e/functional_test.go | 10 +- test/e2e/smoke_test.go | 6 +- test/e2e/workflow_template_test.go | 2 +- 25 files changed, 532 insertions(+), 419 deletions(-) delete mode 100644 cmd/argo/commands/client/v1/argo-api-client.go delete mode 100644 cmd/argo/commands/client/v1/interface.go delete mode 100644 cmd/argo/commands/client/v1/kube-client.go create mode 100644 pkg/apiclient/argo-server-client.go create mode 100644 pkg/apiclient/kube-client.go create mode 100644 pkg/apiclient/kube-workflow-service-client.go diff --git a/cmd/argo/commands/archive/delete.go b/cmd/argo/commands/archive/delete.go index 89ce6c7dcc5e..90a95ab1fe60 100644 --- a/cmd/argo/commands/archive/delete.go +++ b/cmd/argo/commands/archive/delete.go @@ -6,17 +6,19 @@ import ( "github.com/argoproj/pkg/errors" "github.com/spf13/cobra" - v1 "github.com/argoproj/argo/cmd/argo/commands/client/v1" + client "github.com/argoproj/argo/cmd/argo/commands/client" + workflowarchivepkg "github.com/argoproj/argo/pkg/apiclient/workflowarchive" ) func NewDeleteCommand() *cobra.Command { var command = &cobra.Command{ Use: "delete UID...", Run: func(cmd *cobra.Command, args []string) { + ctx, apiClient := client.NewAPIClient() + serviceClient, err := apiClient.NewArchivedWorkflowServiceClient() + errors.CheckError(err) for _, uid := range args { - client, err := v1.GetClient() - errors.CheckError(err) - err = client.DeleteArchivedWorkflow(uid) + _, err = serviceClient.DeleteArchivedWorkflow(ctx, &workflowarchivepkg.DeleteArchivedWorkflowRequest{Uid: uid}) errors.CheckError(err) fmt.Printf("Archived workflow '%s' deleted\n", uid) } diff --git a/cmd/argo/commands/archive/get.go b/cmd/argo/commands/archive/get.go index 66260dfa5d29..22d7cad56e78 100644 --- a/cmd/argo/commands/archive/get.go +++ b/cmd/argo/commands/archive/get.go @@ -11,7 +11,8 @@ import ( "github.com/spf13/cobra" "sigs.k8s.io/yaml" - v1 "github.com/argoproj/argo/cmd/argo/commands/client/v1" + "github.com/argoproj/argo/cmd/argo/commands/client" + workflowarchivepkg "github.com/argoproj/argo/pkg/apiclient/workflowarchive" ) func NewGetCommand() *cobra.Command { @@ -27,9 +28,10 @@ func NewGetCommand() *cobra.Command { } uid := args[0] - client, err := v1.GetClient() + ctx, apiClient := client.NewAPIClient() + serviceClient, err := apiClient.NewArchivedWorkflowServiceClient() errors.CheckError(err) - wf, err := client.GetArchivedWorkflow(uid) + wf, err := serviceClient.GetArchivedWorkflow(ctx, &workflowarchivepkg.GetArchivedWorkflowRequest{Uid: uid}) errors.CheckError(err) switch output { case "json": diff --git a/cmd/argo/commands/archive/list.go b/cmd/argo/commands/archive/list.go index 87acbd74414d..0d1644f96228 100644 --- a/cmd/argo/commands/archive/list.go +++ b/cmd/argo/commands/archive/list.go @@ -9,9 +9,11 @@ import ( "github.com/argoproj/pkg/errors" "github.com/spf13/cobra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/yaml" - v1 "github.com/argoproj/argo/cmd/argo/commands/client/v1" + "github.com/argoproj/argo/cmd/argo/commands/client" + workflowarchivepkg "github.com/argoproj/argo/pkg/apiclient/workflowarchive" ) func NewListCommand() *cobra.Command { @@ -21,11 +23,15 @@ func NewListCommand() *cobra.Command { var command = &cobra.Command{ Use: "list", Run: func(cmd *cobra.Command, args []string) { - client, err := v1.GetClient() + ctx, apiClient := client.NewAPIClient() + serviceClient, err := apiClient.NewArchivedWorkflowServiceClient() errors.CheckError(err) - namespace, err := client.Namespace() - errors.CheckError(err) - resp, err := client.ListArchivedWorkflows(namespace) + namespace := client.Namespace() + resp, err := serviceClient.ListArchivedWorkflows(ctx, &workflowarchivepkg.ListArchivedWorkflowsRequest{ + ListOptions: &metav1.ListOptions{ + FieldSelector: "metadata.namespace=" + namespace, + }, + }) errors.CheckError(err) switch output { case "json": diff --git a/cmd/argo/commands/client/conn.go b/cmd/argo/commands/client/conn.go index 5dcca4f02868..c94005fd9998 100644 --- a/cmd/argo/commands/client/conn.go +++ b/cmd/argo/commands/client/conn.go @@ -7,16 +7,16 @@ import ( log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "google.golang.org/grpc" - "google.golang.org/grpc/metadata" "k8s.io/client-go/tools/clientcmd" + "github.com/argoproj/argo/pkg/apiclient" "github.com/argoproj/argo/util/kubeconfig" ) -// DEPRECATED should only be used by client/v1 package +// DEPRECATED var ArgoServer string -// DEPRECATED should only be used by client/v1 package +// DEPRECATED var Config clientcmd.ClientConfig func AddKubectlFlagsToCmd(cmd *cobra.Command) { @@ -34,22 +34,34 @@ func AddArgoServerFlagsToCmd(cmd *cobra.Command) { cmd.PersistentFlags().StringVar(&ArgoServer, "argo-server", os.Getenv("ARGO_SERVER"), "API server `host:port`. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.") } -// DEPRECATED should only be used by client/v1 package +// DEPRECATED func GetClientConn() *grpc.ClientConn { - conn, err := grpc.Dial(ArgoServer, grpc.WithInsecure()) + conn, err := apiclient.NewClientConn(ArgoServer) if err != nil { log.Fatal(err) } return conn } +func NewAPIClient() (context.Context, apiclient.Client) { + ctx, client, err := apiclient.NewClient(ArgoServer, GetBearerToken(), Config) + if err != nil { + log.Fatal(err) + } + return ctx, client +} + +func Namespace() string { + namespace, _, err := Config.Namespace() + if err != nil { + log.Fatal(err) + } + return namespace +} + // DEPRECATED should only be used by client/v1 package func GetContext() context.Context { - token := GetBearerToken() - if token == "" { - return context.Background() - } - return metadata.NewOutgoingContext(context.Background(), metadata.Pairs("authorization", "Bearer "+token)) + return apiclient.NewContext(GetBearerToken()) } func GetBearerToken() string { diff --git a/cmd/argo/commands/client/v1/argo-api-client.go b/cmd/argo/commands/client/v1/argo-api-client.go deleted file mode 100644 index 90d0bbbba6bb..000000000000 --- a/cmd/argo/commands/client/v1/argo-api-client.go +++ /dev/null @@ -1,73 +0,0 @@ -package v1 - -import ( - "google.golang.org/grpc" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "github.com/argoproj/argo/cmd/argo/commands/client" - workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" - workflowarchivepkg "github.com/argoproj/argo/pkg/apiclient/workflowarchive" - wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" -) - -// This client communicates with Argo using the Argo Server API. -// This supports all features, but requires you to install the Argo Server. -type argoAPIClient struct { - *grpc.ClientConn -} - -func newArgoAPIClient() Interface { - return &argoAPIClient{client.GetClientConn()} -} - -func (a *argoAPIClient) Namespace() (string, error) { - namespace, _, err := client.Config.Namespace() - return namespace, err -} - -func (a *argoAPIClient) ListArchivedWorkflows(namespace string) (*wfv1.WorkflowList, error) { - return workflowarchivepkg.NewArchivedWorkflowServiceClient(a.ClientConn).ListArchivedWorkflows(client.GetContext(), &workflowarchivepkg.ListArchivedWorkflowsRequest{ - ListOptions: &metav1.ListOptions{FieldSelector: "metadata.namespace=" + namespace}, - }) -} - -func (a *argoAPIClient) GetArchivedWorkflow(uid string) (*wfv1.Workflow, error) { - return workflowarchivepkg.NewArchivedWorkflowServiceClient(a.ClientConn).GetArchivedWorkflow(client.GetContext(), &workflowarchivepkg.GetArchivedWorkflowRequest{ - Uid: uid, - }) -} - -func (a *argoAPIClient) DeleteArchivedWorkflow(uid string) error { - _, err := workflowarchivepkg.NewArchivedWorkflowServiceClient(a.ClientConn).DeleteArchivedWorkflow(client.GetContext(), &workflowarchivepkg.DeleteArchivedWorkflowRequest{ - Uid: uid, - }) - return err -} -func (a *argoAPIClient) GetWorkflow(namespace, name string) (*wfv1.Workflow, error) { - return workflowpkg.NewWorkflowServiceClient(a.ClientConn).GetWorkflow(client.GetContext(), &workflowpkg.WorkflowGetRequest{ - Name: name, - Namespace: namespace, - }) -} - -func (a *argoAPIClient) ListWorkflows(namespace string, opts metav1.ListOptions) (*wfv1.WorkflowList, error) { - return workflowpkg.NewWorkflowServiceClient(a.ClientConn).ListWorkflows(client.GetContext(), &workflowpkg.WorkflowListRequest{ - Namespace: namespace, - ListOptions: &opts, - }) -} - -func (a *argoAPIClient) Submit(namespace string, wf *wfv1.Workflow, dryRun, serverDryRun bool) (*wfv1.Workflow, error) { - if dryRun { - return wf, nil - } - return workflowpkg.NewWorkflowServiceClient(a.ClientConn).CreateWorkflow(client.GetContext(), &workflowpkg.WorkflowCreateRequest{ - Namespace: namespace, - Workflow: wf, - ServerDryRun: serverDryRun, - }) -} - -func (a *argoAPIClient) Token() (string, error) { - return client.GetBearerToken(), nil -} diff --git a/cmd/argo/commands/client/v1/interface.go b/cmd/argo/commands/client/v1/interface.go deleted file mode 100644 index c6027dd20896..000000000000 --- a/cmd/argo/commands/client/v1/interface.go +++ /dev/null @@ -1,27 +0,0 @@ -package v1 - -import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "github.com/argoproj/argo/cmd/argo/commands/client" - wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" -) - -type Interface interface { - Submit(namespace string, wf *wfv1.Workflow, dryRun, serverDryRun bool) (*wfv1.Workflow, error) - ListWorkflows(namespace string, opts v1.ListOptions) (*wfv1.WorkflowList, error) - GetWorkflow(namespace, name string) (*wfv1.Workflow, error) - Token() (string, error) - DeleteArchivedWorkflow(uid string) error - GetArchivedWorkflow(uid string) (*wfv1.Workflow, error) - ListArchivedWorkflows(namespace string) (*wfv1.WorkflowList, error) - Namespace() (string, error) -} - -func GetClient() (Interface, error) { - if client.ArgoServer != "" { - return newArgoAPIClient(), nil - } else { - return newKubeClient() - } -} diff --git a/cmd/argo/commands/client/v1/kube-client.go b/cmd/argo/commands/client/v1/kube-client.go deleted file mode 100644 index 72f253548e05..000000000000 --- a/cmd/argo/commands/client/v1/kube-client.go +++ /dev/null @@ -1,121 +0,0 @@ -package v1 - -import ( - "fmt" - "strconv" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "github.com/argoproj/argo/cmd/argo/commands/client" - wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" - "github.com/argoproj/argo/pkg/client/clientset/versioned" - "github.com/argoproj/argo/workflow/packer" - "github.com/argoproj/argo/workflow/util" -) - -var misuseError = fmt.Errorf("this doesn't make sense unless you are using argo server, perhaps something like `export ARGO_SERVER=localhost:2746` would help") - -// This client communicates with Argo using the K8S API. -// This is useful if you to speak to a system that does not have the Argo Server, but does not -// support some features, such as offloading large workflows or the workflow archive. -type kubeClient struct { - versioned.Interface -} - -func (k *kubeClient) Namespace() (string, error) { - namespace, _, err := client.Config.Namespace() - return namespace, err -} - -func (k *kubeClient) ListArchivedWorkflows(_ string) (*wfv1.WorkflowList, error) { - return nil, misuseError -} - -func (k *kubeClient) GetArchivedWorkflow(_ string) (*wfv1.Workflow, error) { - return nil, misuseError -} - -func (k *kubeClient) DeleteArchivedWorkflow(_ string) error { - return misuseError -} - -func newKubeClient() (Interface, error) { - restConfig, err := client.Config.ClientConfig() - if err != nil { - return nil, err - } - wfClient, err := versioned.NewForConfig(restConfig) - if err != nil { - return nil, err - } - return &kubeClient{wfClient}, nil -} - -func (k *kubeClient) GetWorkflow(namespace, name string) (*wfv1.Workflow, error) { - wf, err := k.ArgoprojV1alpha1().Workflows(namespace).Get(name, metav1.GetOptions{}) - if err != nil { - return nil, err - } - err = packer.DecompressWorkflow(wf) - if err != nil { - return nil, err - } - return wf, nil -} - -func (k *kubeClient) ListWorkflows(namespace string, opts metav1.ListOptions) (*wfv1.WorkflowList, error) { - list, err := k.ArgoprojV1alpha1().Workflows(namespace).List(opts) - if err != nil { - return nil, err - } - for _, wf := range list.Items { - err = packer.DecompressWorkflow(&wf) - if err != nil { - return nil, err - } - } - return list, nil -} - -func (k *kubeClient) Submit(namespace string, wf *wfv1.Workflow, dryRun, serverDryRun bool) (*wfv1.Workflow, error) { - if dryRun { - return wf, nil - } - if serverDryRun { - ok, err := k.checkServerVersionForDryRun() - if err != nil { - return nil, err - } - if !ok { - return nil, fmt.Errorf("server-dry-run is not available for server api versions older than v1.12") - } - // kind of gross code, but find - return util.CreateServerDryRun(wf, k.Interface) - } - return k.ArgoprojV1alpha1().Workflows(namespace).Create(wf) -} - -func (k *kubeClient) Token() (string, error) { - return "", misuseError -} - -func (k *kubeClient) checkServerVersionForDryRun() (bool, error) { - serverVersion, err := k.Discovery().ServerVersion() - if err != nil { - return false, err - } - majorVersion, err := strconv.Atoi(serverVersion.Major) - if err != nil { - return false, err - } - minorVersion, err := strconv.Atoi(serverVersion.Minor) - if err != nil { - return false, err - } - if majorVersion < 1 { - return false, nil - } else if majorVersion == 1 && minorVersion < 12 { - return false, nil - } - return true, nil -} diff --git a/cmd/argo/commands/get.go b/cmd/argo/commands/get.go index 83a60a6f1925..3d17443392f9 100644 --- a/cmd/argo/commands/get.go +++ b/cmd/argo/commands/get.go @@ -14,7 +14,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/yaml" - v1 "github.com/argoproj/argo/cmd/argo/commands/client/v1" + "github.com/argoproj/argo/cmd/argo/commands/client" + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" ) @@ -38,12 +39,14 @@ func NewGetCommand() *cobra.Command { cmd.HelpFunc()(cmd, args) os.Exit(1) } - client, err := v1.GetClient() - errors.CheckError(err) - namespace, err := client.Namespace() - errors.CheckError(err) + ctx, apiClient := client.NewAPIClient() + serviceClient := apiClient.NewWorkflowServiceClient() + namespace := client.Namespace() for _, name := range args { - wf, err := client.GetWorkflow(namespace, name) + wf, err := serviceClient.GetWorkflow(ctx, &workflowpkg.WorkflowGetRequest{ + Name: name, + Namespace: namespace, + }) errors.CheckError(err) outputWorkflow(wf, getArgs) } diff --git a/cmd/argo/commands/list.go b/cmd/argo/commands/list.go index d0f228cbe25b..650217f9ecc4 100644 --- a/cmd/argo/commands/list.go +++ b/cmd/argo/commands/list.go @@ -17,7 +17,8 @@ import ( "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/selection" - v1 "github.com/argoproj/argo/cmd/argo/commands/client/v1" + "github.com/argoproj/argo/cmd/argo/commands/client" + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" "github.com/argoproj/argo/workflow/common" "github.com/argoproj/argo/workflow/util" @@ -65,22 +66,26 @@ func NewListCommand() *cobra.Command { listOpts.Limit = listArgs.chunkSize } - client, err := v1.GetClient() - errors.CheckError(err) - - namespace, err := client.Namespace() - errors.CheckError(err) + ctx, apiClient := client.NewAPIClient() + serviceClient := apiClient.NewWorkflowServiceClient() + namespace := client.Namespace() if listArgs.allNamespaces { namespace = "" } - wfList, err := client.ListWorkflows(namespace, listOpts) + wfList, err := serviceClient.ListWorkflows(ctx, &workflowpkg.WorkflowListRequest{ + Namespace: namespace, + ListOptions: &listOpts, + }) errors.CheckError(err) tmpWorkFlows := wfList.Items for wfList.ListMeta.Continue != "" { listOpts.Continue = wfList.ListMeta.Continue - wfList, err = client.ListWorkflows(namespace, listOpts) + wfList, err := serviceClient.ListWorkflows(ctx, &workflowpkg.WorkflowListRequest{ + Namespace: namespace, + ListOptions: &listOpts, + }) if err != nil { log.Fatal(err) } diff --git a/cmd/argo/commands/submit.go b/cmd/argo/commands/submit.go index bdff305bb2d2..580668ccbda4 100644 --- a/cmd/argo/commands/submit.go +++ b/cmd/argo/commands/submit.go @@ -7,8 +7,10 @@ import ( "github.com/argoproj/pkg/errors" argoJson "github.com/argoproj/pkg/json" "github.com/spf13/cobra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - v1 "github.com/argoproj/argo/cmd/argo/commands/client/v1" + "github.com/argoproj/argo/cmd/argo/commands/client" + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" "github.com/argoproj/argo/workflow/common" "github.com/argoproj/argo/workflow/util" @@ -75,11 +77,9 @@ func SubmitWorkflows(filePaths []string, submitOpts *util.SubmitOpts, cliOpts *c cliOpts = &cliSubmitOpts{} } - client, err := v1.GetClient() - errors.CheckError(err) - - defaultNS, err := client.Namespace() - errors.CheckError(err) + ctx, apiClient := client.NewAPIClient() + serviceClient := apiClient.NewWorkflowServiceClient() + namespace := client.Namespace() fileContents, err := util.ReadManifest(filePaths...) if err != nil { @@ -141,12 +141,22 @@ func SubmitWorkflows(filePaths []string, submitOpts *util.SubmitOpts, cliOpts *c for _, wf := range workflows { if wf.Namespace == "" { // This is here to avoid passing an empty namespace when using --server-dry-run - wf.Namespace = defaultNS + wf.Namespace = namespace } err := util.ApplySubmitOpts(&wf, submitOpts) errors.CheckError(err) wf.Spec.Priority = cliOpts.priority - created, err := client.Submit(wf.Namespace, &wf, submitOpts.DryRun, submitOpts.ServerDryRun) + options := &metav1.CreateOptions{} + if submitOpts.DryRun { + options.DryRun = []string{"All"} + } + created, err := serviceClient.CreateWorkflow(ctx, &workflowpkg.WorkflowCreateRequest{ + Namespace: wf.Namespace, + Workflow: &wf, + InstanceID: submitOpts.InstanceID, + ServerDryRun: submitOpts.ServerDryRun, + CreateOptions: options, + }) if err != nil { log.Fatalf("Failed to submit workflow: %v", err) } diff --git a/cmd/argo/commands/token.go b/cmd/argo/commands/token.go index 77f0bc3722e3..5ebb8f31c94b 100644 --- a/cmd/argo/commands/token.go +++ b/cmd/argo/commands/token.go @@ -4,10 +4,9 @@ import ( "fmt" "os" - "github.com/argoproj/pkg/errors" "github.com/spf13/cobra" - v1 "github.com/argoproj/argo/cmd/argo/commands/client/v1" + "github.com/argoproj/argo/cmd/argo/commands/client" ) func NewTokenCommand() *cobra.Command { @@ -19,11 +18,7 @@ func NewTokenCommand() *cobra.Command { cmd.HelpFunc()(cmd, args) os.Exit(1) } - client, err := v1.GetClient() - errors.CheckError(err) - token, err := client.Token() - errors.CheckError(err) - fmt.Print(token) + fmt.Print(client.GetBearerToken()) }, } } diff --git a/pkg/apiclient/apiclient.go b/pkg/apiclient/apiclient.go index 6f068077b98e..decb652ce921 100644 --- a/pkg/apiclient/apiclient.go +++ b/pkg/apiclient/apiclient.go @@ -1,6 +1,23 @@ package apiclient -const ( - // MaxGRPCMessageSize contains max grpc message size - MaxGRPCMessageSize = 100 * 1024 * 1024 +import ( + "context" + + "k8s.io/client-go/tools/clientcmd" + + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" + workflowarchivepkg "github.com/argoproj/argo/pkg/apiclient/workflowarchive" ) + +type Client interface { + NewArchivedWorkflowServiceClient() (workflowarchivepkg.ArchivedWorkflowServiceClient, error) + NewWorkflowServiceClient() workflowpkg.WorkflowServiceClient +} + +func NewClient(argoServer, token string, clientConfig clientcmd.ClientConfig) (context.Context, Client, error) { + if argoServer != "" { + return newArgoServerClient(argoServer, token) + } else { + return newKubeClient(clientConfig) + } +} diff --git a/pkg/apiclient/argo-server-client.go b/pkg/apiclient/argo-server-client.go new file mode 100644 index 000000000000..af4592fad53a --- /dev/null +++ b/pkg/apiclient/argo-server-client.go @@ -0,0 +1,51 @@ +package apiclient + +import ( + "context" + + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" + workflowarchivepkg "github.com/argoproj/argo/pkg/apiclient/workflowarchive" +) + +type argoServerClient struct { + *grpc.ClientConn +} + +func newArgoServerClient(argoServer, token string) (context.Context, Client, error) { + conn, err := NewClientConn(argoServer) + if err != nil { + return nil, nil, err + } + return newContext(token), &argoServerClient{conn}, nil +} + +func (a *argoServerClient) NewWorkflowServiceClient() workflowpkg.WorkflowServiceClient { + return workflowpkg.NewWorkflowServiceClient(a.ClientConn) +} + +func (a *argoServerClient) NewArchivedWorkflowServiceClient() (workflowarchivepkg.ArchivedWorkflowServiceClient, error) { + return workflowarchivepkg.NewArchivedWorkflowServiceClient(a.ClientConn), nil +} + +func NewClientConn(argoServer string) (*grpc.ClientConn, error) { + conn, err := grpc.Dial(argoServer, grpc.WithInsecure()) + if err != nil { + return nil, err + } + return conn, nil +} + +// DEPRECATED +func NewContext(token string) context.Context { + return newContext(token) +} + +func newContext(token string) context.Context { + if token == "" { + return context.Background() + } + return metadata.NewOutgoingContext(context.Background(), metadata.Pairs("authorization", "Bearer "+token)) +} diff --git a/pkg/apiclient/kube-client.go b/pkg/apiclient/kube-client.go new file mode 100644 index 000000000000..718793aaeea9 --- /dev/null +++ b/pkg/apiclient/kube-client.go @@ -0,0 +1,36 @@ +package apiclient + +import ( + "context" + "fmt" + + "k8s.io/client-go/tools/clientcmd" + + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" + workflowarchivepkg "github.com/argoproj/argo/pkg/apiclient/workflowarchive" + "github.com/argoproj/argo/pkg/client/clientset/versioned" +) + +type kubeClient struct { + versioned.Interface +} + +func newKubeClient(clientConfig clientcmd.ClientConfig) (context.Context, Client, error) { + restConfig, err := clientConfig.ClientConfig() + if err != nil { + return nil, nil, err + } + wfClient, err := versioned.NewForConfig(restConfig) + if err != nil { + return nil, nil, err + } + return context.Background(), &kubeClient{wfClient}, nil +} + +func (a *kubeClient) NewWorkflowServiceClient() workflowpkg.WorkflowServiceClient { + return &kubeWorkflowServiceClient{a.Interface} +} + +func (a *kubeClient) NewArchivedWorkflowServiceClient() (workflowarchivepkg.ArchivedWorkflowServiceClient, error) { + return nil, fmt.Errorf("it is impossible to interact with the archive if you are not using the Argo Server") +} diff --git a/pkg/apiclient/kube-workflow-service-client.go b/pkg/apiclient/kube-workflow-service-client.go new file mode 100644 index 000000000000..6d6ccee047ba --- /dev/null +++ b/pkg/apiclient/kube-workflow-service-client.go @@ -0,0 +1,128 @@ +package apiclient + +import ( + "context" + "fmt" + "strconv" + + "google.golang.org/grpc" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" + "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" + "github.com/argoproj/argo/pkg/client/clientset/versioned" + "github.com/argoproj/argo/workflow/packer" + "github.com/argoproj/argo/workflow/util" +) + +type kubeWorkflowServiceClient struct { + versioned.Interface +} + +func (k *kubeWorkflowServiceClient) CreateWorkflow(_ context.Context, in *workflowpkg.WorkflowCreateRequest, _ ...grpc.CallOption) (*v1alpha1.Workflow, error) { + wf := in.Workflow + dryRun := len(in.CreateOptions.DryRun) > 0 + serverDryRun := in.ServerDryRun + if dryRun { + return wf, nil + } + if serverDryRun { + ok, err := k.checkServerVersionForDryRun() + if err != nil { + return nil, err + } + if !ok { + return nil, fmt.Errorf("server-dry-run is not available for server api versions older than v1.12") + } + // kind of gross code, but fine + return util.CreateServerDryRun(wf, k) + } + return k.ArgoprojV1alpha1().Workflows(in.Namespace).Create(wf) +} + +func (k *kubeWorkflowServiceClient) checkServerVersionForDryRun() (bool, error) { + serverVersion, err := k.Discovery().ServerVersion() + if err != nil { + return false, err + } + majorVersion, err := strconv.Atoi(serverVersion.Major) + if err != nil { + return false, err + } + minorVersion, err := strconv.Atoi(serverVersion.Minor) + if err != nil { + return false, err + } + if majorVersion < 1 { + return false, nil + } else if majorVersion == 1 && minorVersion < 12 { + return false, nil + } + return true, nil +} + +func (k *kubeWorkflowServiceClient) GetWorkflow(_ context.Context, in *workflowpkg.WorkflowGetRequest, _ ...grpc.CallOption) (*v1alpha1.Workflow, error) { + options := metav1.GetOptions{} + if in.GetOptions != nil { + options = *in.GetOptions + } + wf, err := k.ArgoprojV1alpha1().Workflows(in.Namespace).Get(in.Name, options) + if err != nil { + return nil, err + } + err = packer.DecompressWorkflow(wf) + if err != nil { + return nil, err + } + return wf, nil +} + +func (k *kubeWorkflowServiceClient) ListWorkflows(_ context.Context, in *workflowpkg.WorkflowListRequest, _ ...grpc.CallOption) (*v1alpha1.WorkflowList, error) { + list, err := k.ArgoprojV1alpha1().Workflows(in.Namespace).List(*in.ListOptions) + if err != nil { + return nil, err + } + for _, wf := range list.Items { + err = packer.DecompressWorkflow(&wf) + if err != nil { + return nil, err + } + } + return list, nil +} + +func (k *kubeWorkflowServiceClient) WatchWorkflows(ctx context.Context, in *workflowpkg.WatchWorkflowsRequest, opts ...grpc.CallOption) (workflowpkg.WorkflowService_WatchWorkflowsClient, error) { + panic("implement me") +} + +func (k *kubeWorkflowServiceClient) DeleteWorkflow(ctx context.Context, in *workflowpkg.WorkflowDeleteRequest, opts ...grpc.CallOption) (*workflowpkg.WorkflowDeleteResponse, error) { + panic("implement me") +} + +func (k *kubeWorkflowServiceClient) RetryWorkflow(ctx context.Context, in *workflowpkg.WorkflowRetryRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { + panic("implement me") +} + +func (k *kubeWorkflowServiceClient) ResubmitWorkflow(ctx context.Context, in *workflowpkg.WorkflowResubmitRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { + panic("implement me") +} + +func (k *kubeWorkflowServiceClient) ResumeWorkflow(ctx context.Context, in *workflowpkg.WorkflowResumeRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { + panic("implement me") +} + +func (k *kubeWorkflowServiceClient) SuspendWorkflow(ctx context.Context, in *workflowpkg.WorkflowSuspendRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { + panic("implement me") +} + +func (k *kubeWorkflowServiceClient) TerminateWorkflow(ctx context.Context, in *workflowpkg.WorkflowTerminateRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { + panic("implement me") +} + +func (k *kubeWorkflowServiceClient) LintWorkflow(ctx context.Context, in *workflowpkg.WorkflowLintRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { + panic("implement me") +} + +func (k *kubeWorkflowServiceClient) PodLogs(ctx context.Context, in *workflowpkg.WorkflowLogRequest, opts ...grpc.CallOption) (workflowpkg.WorkflowService_PodLogsClient, error) { + panic("implement me") +} diff --git a/server/apiserver/argoserver.go b/server/apiserver/argoserver.go index 5a53b2b99e83..4c35b12c2e7e 100644 --- a/server/apiserver/argoserver.go +++ b/server/apiserver/argoserver.go @@ -35,7 +35,6 @@ import ( "github.com/argoproj/argo/errors" "github.com/argoproj/argo/persist/sqldb" - "github.com/argoproj/argo/pkg/apiclient" "github.com/argoproj/argo/pkg/client/clientset/versioned" grpcutil "github.com/argoproj/argo/util/grpc" "github.com/argoproj/argo/util/json" @@ -43,6 +42,11 @@ import ( "github.com/argoproj/argo/workflow/config" ) +const ( + // MaxGRPCMessageSize contains max grpc message size + MaxGRPCMessageSize = 100 * 1024 * 1024 +) + type argoServer struct { namespace string managedNamespace string @@ -161,8 +165,8 @@ func (as *argoServer) newGRPCServer(offloadNodeStatusRepo sqldb.OffloadNodeStatu // Set both the send and receive the bytes limit to be 100MB // The proper way to achieve high performance is to have pagination // while we work toward that, we can have high limit first - grpc.MaxRecvMsgSize(apiclient.MaxGRPCMessageSize), - grpc.MaxSendMsgSize(apiclient.MaxGRPCMessageSize), + grpc.MaxRecvMsgSize(MaxGRPCMessageSize), + grpc.MaxSendMsgSize(MaxGRPCMessageSize), grpc.ConnectionTimeout(300 * time.Second), grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer( grpc_logrus.UnaryServerInterceptor(serverLog), @@ -201,7 +205,7 @@ func (as *argoServer) newHTTPServer(ctx context.Context, port int, artifactServe Handler: mux, } var dialOpts []grpc.DialOption - dialOpts = append(dialOpts, grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(apiclient.MaxGRPCMessageSize))) + dialOpts = append(dialOpts, grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(MaxGRPCMessageSize))) //dialOpts = append(dialOpts, grpc.WithUserAgent(fmt.Sprintf("%s/%s", common.ArgoCDUserAgentName, argocd.GetVersion().Version))) dialOpts = append(dialOpts, grpc.WithInsecure()) diff --git a/server/workflow/workflow_server.go b/server/workflow/workflow_server.go index 958309f342a2..4dd0b45a65b1 100644 --- a/server/workflow/workflow_server.go +++ b/server/workflow/workflow_server.go @@ -56,6 +56,10 @@ func (s *workflowServer) CreateWorkflow(ctx context.Context, req *workflowpkg.Wo return nil, err } + // if we are doing a normal dryRun, just return the workflow un-altered + if req.CreateOptions != nil && len(req.CreateOptions.DryRun) > 0 { + return req.Workflow, nil + } if req.ServerDryRun { return util.CreateServerDryRun(req.Workflow, wfClient) } diff --git a/test/e2e/argo_server_test.go b/test/e2e/argo_server_test.go index 7b2d3bc73cf6..9f2cf8572e5e 100644 --- a/test/e2e/argo_server_test.go +++ b/test/e2e/argo_server_test.go @@ -263,7 +263,7 @@ func (s *ArgoServerSuite) TestPermission() { if s.Persistence.IsEnabled() { // Simply wait 10 seconds for the wf to be completed - s.Given(). + s.Given(s.T()). WorkflowName("test-wf-good"). When(). WaitForWorkflow(10 * time.Second) @@ -428,7 +428,7 @@ func (s *ArgoServerSuite) TestWorkflowService() { }) s.Run("List", func(t *testing.T) { - s.Given(). + s.Given(t). WorkflowName("test"). When(). WaitForWorkflowToStart(20 * time.Second) @@ -557,7 +557,7 @@ func (s *ArgoServerSuite) TestCronWorkflowService() { s.Run("List", func(t *testing.T) { // make sure list options work correctly - s.Given(). + s.Given(t). CronWorkflow("@testdata/basic.yaml") s.e(t).GET("/api/v1/cron-workflows/argo"). @@ -631,7 +631,7 @@ func (s *ArgoServerSuite) TestArtifactServer() { s.T().SkipNow() } var uid types.UID - s.Given(). + s.Given(s.T()). Workflow("@smoke/basic.yaml"). When(). SubmitWorkflow(). @@ -676,7 +676,7 @@ func (s *ArgoServerSuite) TestArtifactServer() { // do some basic testing on the stream methods func (s *ArgoServerSuite) TestWorkflowServiceStream() { - s.Given(). + s.Given(s.T()). Workflow("@smoke/basic.yaml"). When(). SubmitWorkflow(). @@ -761,7 +761,7 @@ func (s *ArgoServerSuite) TestArchivedWorkflowService() { s.T().SkipNow() } var uid types.UID - s.Given(). + s.Given(s.T()). Workflow("@smoke/basic.yaml"). When(). SubmitWorkflow(). @@ -771,7 +771,7 @@ func (s *ArgoServerSuite) TestArchivedWorkflowService() { uid = metadata.UID }) s.Run("List", func(t *testing.T) { - s.Given(). + s.Given(t). Workflow("@smoke/basic-2.yaml"). When(). SubmitWorkflow(). @@ -889,7 +889,7 @@ func (s *ArgoServerSuite) TestWorkflowTemplateService() { s.Run("List", func(t *testing.T) { // make sure list options work correctly - s.Given(). + s.Given(t). WorkflowTemplate("@smoke/workflow-template-whalesay-template.yaml") s.e(t).GET("/api/v1/workflow-templates/argo"). diff --git a/test/e2e/cli_test.go b/test/e2e/cli_test.go index 2575efc26f82..a71fd7b0a026 100644 --- a/test/e2e/cli_test.go +++ b/test/e2e/cli_test.go @@ -21,118 +21,168 @@ func (s *CLISuite) BeforeTest(suiteName, testName string) { } func (s *CLISuite) TestCompletion() { - s.Given().RunCli([]string{"completion", "bash"}, func(t *testing.T, output string, err error) { + s.Given(s.T()).RunCli([]string{"completion", "bash"}, func(t *testing.T, output string, err error) { assert.NoError(t, err) assert.Contains(t, output, "bash completion for argo") }) } +func (s *CLISuite) TestSubmitDryRun() { + s.Given(s.T()). + RunCli([]string{"submit", "smoke/basic.yaml", "--dry-run", "-o", "yaml"}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "name: basic") + // dry-run should never get a UID + assert.NotContains(t, output, "uid:") + } + }) +} + +func (s *CLISuite) TestSubmitServerDryRun() { + s.Given(s.T()). + RunCli([]string{"submit", "smoke/basic.yaml", "--server-dry-run", "-o", "yaml"}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "name: basic") + // server-dry-run should get a UID + assert.Contains(t, output, "uid:") + } + }) +} func (s *CLISuite) TestRoot() { - s.Given().RunCli([]string{"submit", "smoke/basic.yaml"}, func(t *testing.T, output string, err error) { - assert.NoError(t, err) - assert.Contains(t, output, "Namespace:") - assert.Contains(t, output, "ServiceAccount:") - assert.Contains(t, output, "Status:") - assert.Contains(t, output, "Created:") + s.Run("Submit", func(t *testing.T) { + s.Given(t).RunCli([]string{"submit", "smoke/basic.yaml"}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "Namespace:") + assert.Contains(t, output, "ServiceAccount:") + assert.Contains(t, output, "Status:") + assert.Contains(t, output, "Created:") + } + }) }) - s.Given().RunCli([]string{"list"}, func(t *testing.T, output string, err error) { - assert.NoError(t, err) - assert.Contains(t, output, "NAME") - assert.Contains(t, output, "STATUS") - assert.Contains(t, output, "AGE") - assert.Contains(t, output, "DURATION") - assert.Contains(t, output, "PRIORITY") + s.Run("List", func(t *testing.T) { + s.Given(t).RunCli([]string{"list"}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "NAME") + assert.Contains(t, output, "STATUS") + assert.Contains(t, output, "AGE") + assert.Contains(t, output, "DURATION") + assert.Contains(t, output, "PRIORITY") + } + }) }) - s.Given().RunCli([]string{"get", "basic"}, func(t *testing.T, output string, err error) { - assert.NoError(t, err) - assert.Contains(t, output, "Namespace:") - assert.Contains(t, output, "ServiceAccount:") - assert.Contains(t, output, "Status:") - assert.Contains(t, output, "Created:") + s.Run("Get", func(t *testing.T) { + s.Given(t).RunCli([]string{"get", "basic"}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "Namespace:") + assert.Contains(t, output, "ServiceAccount:") + assert.Contains(t, output, "Status:") + assert.Contains(t, output, "Created:") + } + }) }) - s.Given().RunCli([]string{"delete", "basic"}, func(t *testing.T, output string, err error) { - assert.NoError(t, err) - assert.Contains(t, output, "deleted") + s.Run("Delete", func(t *testing.T) { + s.Given(t).RunCli([]string{"delete", "basic"}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "deleted") + } + }) }) } func (s *CLISuite) TestTemplate() { + s.Run("Lint", func(t *testing.T) { + s.Given(t).RunCli([]string{"template", "lint", "smoke/workflow-template-whalesay-template.yaml"}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "validated") + } + }) - s.Given().RunCli([]string{"template", "lint", "smoke/workflow-template-whalesay-template.yaml"}, func(t *testing.T, output string, err error) { - assert.NoError(t, err) - assert.Contains(t, output, "validated") }) - - s.Given().RunCli([]string{"template", "create", "smoke/workflow-template-whalesay-template.yaml"}, func(t *testing.T, output string, err error) { - assert.NoError(t, err) - assert.Contains(t, output, "Name:") - assert.Contains(t, output, "Namespace:") - assert.Contains(t, output, "Created:") + s.Run("Create", func(t *testing.T) { + s.Given(t).RunCli([]string{"template", "create", "smoke/workflow-template-whalesay-template.yaml"}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "Name:") + assert.Contains(t, output, "Namespace:") + assert.Contains(t, output, "Created:") + } + }) }) - - s.Given().RunCli([]string{"template", "list"}, func(t *testing.T, output string, err error) { - assert.NoError(t, err) - assert.Contains(t, output, "NAME") + s.Run("List", func(t *testing.T) { + s.Given(t).RunCli([]string{"template", "list"}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "NAME") + } + }) }) - - s.Given().RunCli([]string{"template", "get", "not-found"}, func(t *testing.T, output string, err error) { - assert.Error(t, err, "exit status 1") - assert.Contains(t, output, `"not-found" not found`) - }).RunCli([]string{"template", "get", "workflow-template-whalesay-template"}, func(t *testing.T, output string, err error) { - if assert.NoError(t, err) { - assert.Contains(t, output, "Name:") - assert.Contains(t, output, "Namespace:") - assert.Contains(t, output, "Created:") - } + s.Run("Get", func(t *testing.T) { + s.Given(t).RunCli([]string{"template", "get", "not-found"}, func(t *testing.T, output string, err error) { + if assert.Error(t, err, "exit status 1") { + assert.Contains(t, output, `"not-found" not found`) + + } + }).RunCli([]string{"template", "get", "workflow-template-whalesay-template"}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "Name:") + assert.Contains(t, output, "Namespace:") + assert.Contains(t, output, "Created:") + } + }) }) - - s.Given().RunCli([]string{"template", "delete", "workflow-template-whalesay-template"}, func(t *testing.T, output string, err error) { - assert.NoError(t, err) + s.Run("Delete", func(t *testing.T) { + s.Given(t).RunCli([]string{"template", "delete", "workflow-template-whalesay-template"}, func(t *testing.T, output string, err error) { + assert.NoError(t, err) + }) }) } func (s *CLISuite) TestCron() { - - s.Given().RunCli([]string{"cron", "create", "testdata/basic.yaml"}, func(t *testing.T, output string, err error) { - assert.NoError(t, err) - assert.Contains(t, output, "Name:") - assert.Contains(t, output, "Namespace:") - assert.Contains(t, output, "Created:") - assert.Contains(t, output, "Schedule:") - assert.Contains(t, output, "Suspended:") - assert.Contains(t, output, "StartingDeadlineSeconds:") - assert.Contains(t, output, "ConcurrencyPolicy:") + s.Run("Create", func(t *testing.T) { + s.Given(t).RunCli([]string{"cron", "create", "testdata/basic.yaml"}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "Name:") + assert.Contains(t, output, "Namespace:") + assert.Contains(t, output, "Created:") + assert.Contains(t, output, "Schedule:") + assert.Contains(t, output, "Suspended:") + assert.Contains(t, output, "StartingDeadlineSeconds:") + assert.Contains(t, output, "ConcurrencyPolicy:") + } + }) }) - - s.Given().RunCli([]string{"cron", "list"}, func(t *testing.T, output string, err error) { - assert.NoError(t, err) - assert.Contains(t, output, "NAME") - assert.Contains(t, output, "AGE") - assert.Contains(t, output, "LAST RUN") - assert.Contains(t, output, "SCHEDULE") - assert.Contains(t, output, "SUSPENDED") + s.Run("List", func(t *testing.T) { + s.Given(t).RunCli([]string{"cron", "list"}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "NAME") + assert.Contains(t, output, "AGE") + assert.Contains(t, output, "LAST RUN") + assert.Contains(t, output, "SCHEDULE") + assert.Contains(t, output, "SUSPENDED") + } + }) }) - - s.Given().RunCli([]string{"cron", "get", "not-found"}, func(t *testing.T, output string, err error) { - assert.Error(t, err, "exit status 1") - assert.Contains(t, output, `"not-found" not found`) - }).RunCli([]string{"cron", "get", "test-cron-wf-basic"}, func(t *testing.T, output string, err error) { - if assert.NoError(t, err) { - assert.Contains(t, output, "Name:") - assert.Contains(t, output, "Namespace:") - assert.Contains(t, output, "Created:") - assert.Contains(t, output, "Schedule:") - assert.Contains(t, output, "Suspended:") - assert.Contains(t, output, "StartingDeadlineSeconds:") - assert.Contains(t, output, "ConcurrencyPolicy:") - } + s.Run("Get", func(t *testing.T) { + s.Given(t).RunCli([]string{"cron", "get", "not-found"}, func(t *testing.T, output string, err error) { + assert.Error(t, err, "exit status 1") + assert.Contains(t, output, `"not-found" not found`) + }).RunCli([]string{"cron", "get", "test-cron-wf-basic"}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "Name:") + assert.Contains(t, output, "Namespace:") + assert.Contains(t, output, "Created:") + assert.Contains(t, output, "Schedule:") + assert.Contains(t, output, "Suspended:") + assert.Contains(t, output, "StartingDeadlineSeconds:") + assert.Contains(t, output, "ConcurrencyPolicy:") + } + }) }) - - s.Given().RunCli([]string{"cron", "delete", "test-cron-wf-basic"}, func(t *testing.T, output string, err error) { - assert.NoError(t, err) + s.Run("Delete", func(t *testing.T) { + s.Given(t).RunCli([]string{"cron", "delete", "test-cron-wf-basic"}, func(t *testing.T, output string, err error) { + assert.NoError(t, err) + }) }) } -func TestCliSuite(t *testing.T) { +func TestCLISuite(t *testing.T) { suite.Run(t, new(CLISuite)) } diff --git a/test/e2e/cli_with_server_test.go b/test/e2e/cli_with_server_test.go index 97fc2b72cf05..f0f20efe6f08 100644 --- a/test/e2e/cli_with_server_test.go +++ b/test/e2e/cli_with_server_test.go @@ -34,7 +34,7 @@ func (s *CLIWithServerSuite) AfterTest(suiteName, testName string) { } func (s *CLIWithServerSuite) TestToken() { - s.Given(). + s.Given(s.T()). RunCli([]string{"token"}, func(t *testing.T, output string, err error) { assert.NoError(t, err) token, err := s.GetServiceAccountToken() @@ -48,39 +48,48 @@ func (s *CLIWithServerSuite) TestArchive() { s.T().SkipNow() } var uid types.UID - s.Given(). + s.Given(s.T()). Workflow("@smoke/basic.yaml"). When(). SubmitWorkflow(). - WaitForWorkflow(30*time.Second). + WaitForWorkflow(30 * time.Second). Then(). Expect(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) { uid = metadata.UID - }). - RunCli([]string{"archive", "list"}, func(t *testing.T, output string, err error) { - if assert.NoError(t, err) { - assert.Contains(t, output, "NAMESPACE NAME") - assert.Contains(t, output, "argo basic") - } - }). - RunCli([]string{"archive", "get", string(uid)}, func(t *testing.T, output string, err error) { - if assert.NoError(t, err) { - assert.Contains(t, output, "Name:") - assert.Contains(t, output, "Namespace:") - assert.Contains(t, output, "ServiceAccount:") - assert.Contains(t, output, "Status:") - assert.Contains(t, output, "Created:") - assert.Contains(t, output, "Started:") - assert.Contains(t, output, "Finished:") - assert.Contains(t, output, "Duration:") - } - }). - RunCli([]string{"archive", "delete", string(uid)}, func(t *testing.T, output string, err error) { - if assert.NoError(t, err) { - assert.Contains(t, output, "Archived workflow") - assert.Contains(t, output, "deleted") - } }) + s.Run("List", func(t *testing.T) { + s.Given(t). + RunCli([]string{"archive", "list"}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "NAMESPACE NAME") + assert.Contains(t, output, "argo basic") + } + }) + }) + s.Run("Get", func(t *testing.T) { + s.Given(t). + RunCli([]string{"archive", "get", string(uid)}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "Name:") + assert.Contains(t, output, "Namespace:") + assert.Contains(t, output, "ServiceAccount:") + assert.Contains(t, output, "Status:") + assert.Contains(t, output, "Created:") + assert.Contains(t, output, "Started:") + assert.Contains(t, output, "Finished:") + assert.Contains(t, output, "Duration:") + } + }) + }) + s.Run("Delete", func(t *testing.T) { + s.Given(t). + RunCli([]string{"archive", "delete", string(uid)}, func(t *testing.T, output string, err error) { + if assert.NoError(t, err) { + assert.Contains(t, output, "Archived workflow") + assert.Contains(t, output, "deleted") + } + }) + }) } func TestCLIWithServerSuite(t *testing.T) { diff --git a/test/e2e/cron_test.go b/test/e2e/cron_test.go index 6418339c4c5e..208d544d0011 100644 --- a/test/e2e/cron_test.go +++ b/test/e2e/cron_test.go @@ -25,7 +25,7 @@ type CronSuite struct { } func (s *CronSuite) TestBasic() { - s.Given(). + s.Given(s.T()). CronWorkflow("@testdata/basic.yaml"). When(). CreateCronWorkflow(). @@ -52,7 +52,7 @@ func (s *CronSuite) TestBasicTimezone() { hour = (hour + 1) % 24 } scheduleInTestTimezone := strconv.Itoa(min) + " " + strconv.Itoa(hour) + " * * *" - s.Given(). + s.Given(s.T()). CronWorkflow(fmt.Sprintf(` apiVersion: argoproj.io/v1alpha1 kind: CronWorkflow @@ -83,7 +83,7 @@ spec: } func (s *CronSuite) TestSuspend() { - s.Given(). + s.Given(s.T()). CronWorkflow("@testdata/basic.yaml"). When(). CreateCronWorkflow(). @@ -97,7 +97,7 @@ func (s *CronSuite) TestSuspend() { } func (s *CronSuite) TestResume() { - s.Given(). + s.Given(s.T()). CronWorkflow("@testdata/basic.yaml"). When(). CreateCronWorkflow(). @@ -111,7 +111,7 @@ func (s *CronSuite) TestResume() { } func (s *CronSuite) TestBasicForbid() { - s.Given(). + s.Given(s.T()). CronWorkflow("@testdata/basic-forbid.yaml"). When(). CreateCronWorkflow(). @@ -124,7 +124,7 @@ func (s *CronSuite) TestBasicForbid() { } func (s *CronSuite) TestBasicAllow() { - s.Given(). + s.Given(s.T()). CronWorkflow("@testdata/basic-allow.yaml"). When(). CreateCronWorkflow(). @@ -136,7 +136,7 @@ func (s *CronSuite) TestBasicAllow() { } func (s *CronSuite) TestBasicReplace() { - s.Given(). + s.Given(s.T()). CronWorkflow("@testdata/basic-replace.yaml"). When(). CreateCronWorkflow(). @@ -151,7 +151,7 @@ func (s *CronSuite) TestBasicReplace() { func (s *CronSuite) TestSuccessfulJobHistoryLimit() { var listOptions v1.ListOptions wfInformerListOptionsFunc(&listOptions, "test-cron-wf-succeed-1") - s.Given(). + s.Given(s.T()). CronWorkflow("@testdata/always-succeed-1.yaml"). When(). CreateCronWorkflow(). @@ -166,7 +166,7 @@ func (s *CronSuite) TestSuccessfulJobHistoryLimit() { func (s *CronSuite) TestFailedJobHistoryLimit() { var listOptions v1.ListOptions wfInformerListOptionsFunc(&listOptions, "test-cron-wf-fail-1") - s.Given(). + s.Given(s.T()). CronWorkflow("@testdata/always-fail-1.yaml"). When(). CreateCronWorkflow(). diff --git a/test/e2e/fixtures/e2e_suite.go b/test/e2e/fixtures/e2e_suite.go index 99df80c81376..03d40b9b5d81 100644 --- a/test/e2e/fixtures/e2e_suite.go +++ b/test/e2e/fixtures/e2e_suite.go @@ -244,9 +244,9 @@ func (s *E2ESuite) printPodLogs(logCtx *log.Entry, namespace, pod, container str fmt.Println("---") } -func (s *E2ESuite) Given() *Given { +func (s *E2ESuite) Given(t *testing.T) *Given { return &Given{ - t: s.T(), + t: t, diagnostics: s.Diagnostics, client: s.wfClient, wfTemplateClient: s.wfTemplateClient, diff --git a/test/e2e/functional_test.go b/test/e2e/functional_test.go index 69df23fcfc2f..78eadd98e76e 100644 --- a/test/e2e/functional_test.go +++ b/test/e2e/functional_test.go @@ -21,7 +21,7 @@ type FunctionalSuite struct { } func (s *FunctionalSuite) TestContinueOnFail() { - s.Given(). + s.Given(s.T()). Workflow(` apiVersion: argoproj.io/v1alpha1 kind: Workflow @@ -82,7 +82,7 @@ func (s *FunctionalSuite) TestFastFailOnPodTermination() { // TODO: Test fails due to using a service account with insufficient permissions, skipping for now // pods is forbidden: User "system:serviceaccount:argo:default" cannot list resource "pods" in API group "" in the namespace "argo" s.T().SkipNow() - s.Given(). + s.Given(s.T()). Workflow("@expectedfailures/pod-termination-failure.yaml"). When(). SubmitWorkflow(). @@ -99,7 +99,7 @@ func (s *FunctionalSuite) TestFastFailOnPodTermination() { func (s *FunctionalSuite) TestEventOnNodeFail() { // Test whether an WorkflowFailed event (with appropriate message) is emitted in case of node failure - s.Given(). + s.Given(s.T()). Workflow("@expectedfailures/failed-step-event.yaml"). When(). SubmitWorkflow(). @@ -121,7 +121,7 @@ func (s *FunctionalSuite) TestEventOnNodeFail() { func (s *FunctionalSuite) TestEventOnWorkflowSuccess() { // Test whether an WorkflowSuccess event is emitted in case of successfully completed workflow - s.Given(). + s.Given(s.T()). Workflow("@functional/success-event.yaml"). When(). SubmitWorkflow(). @@ -143,7 +143,7 @@ func (s *FunctionalSuite) TestEventOnWorkflowSuccess() { func (s *FunctionalSuite) TestEventOnPVCFail() { // Test whether an WorkflowFailed event (with appropriate message) is emitted in case of error in creating the PVC - s.Given(). + s.Given(s.T()). Workflow("@expectedfailures/volumes-pvc-fail-event.yaml"). When(). SubmitWorkflow(). diff --git a/test/e2e/smoke_test.go b/test/e2e/smoke_test.go index 637949ce82a6..094c02bf9016 100644 --- a/test/e2e/smoke_test.go +++ b/test/e2e/smoke_test.go @@ -17,7 +17,7 @@ type SmokeSuite struct { } func (s *SmokeSuite) TestBasicWorkflow() { - s.Given(). + s.Given(s.T()). Workflow("@smoke/basic.yaml"). When(). SubmitWorkflow(). @@ -30,7 +30,7 @@ func (s *SmokeSuite) TestBasicWorkflow() { } func (s *SmokeSuite) TestArtifactPassing() { - s.Given(). + s.Given(s.T()). Workflow("@smoke/artifact-passing.yaml"). When(). SubmitWorkflow(). @@ -42,7 +42,7 @@ func (s *SmokeSuite) TestArtifactPassing() { } func (s *SmokeSuite) TestWorkflowTemplateBasic() { - s.Given(). + s.Given(s.T()). WorkflowTemplate("@smoke/workflow-template-whalesay-template.yaml"). Workflow("@smoke/hello-world-workflow-tmpl.yaml"). When(). diff --git a/test/e2e/workflow_template_test.go b/test/e2e/workflow_template_test.go index e2a13e64e59e..b1c3b5050b5d 100644 --- a/test/e2e/workflow_template_test.go +++ b/test/e2e/workflow_template_test.go @@ -17,7 +17,7 @@ type WorkflowTemplateSuite struct { } func (w *WorkflowTemplateSuite) TestNestedWorkflowTemplate() { - w.Given().WorkflowTemplate("@smoke/workflow-template-whalesay-template.yaml"). + w.Given(w.T()).WorkflowTemplate("@smoke/workflow-template-whalesay-template.yaml"). WorkflowTemplate("@testdata/workflow-template-nested-template.yaml"). Workflow(`apiVersion: argoproj.io/v1alpha1 kind: Workflow From b27e305abf321e3dfdda1d6018d04ebed0574011 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Tue, 28 Jan 2020 13:09:00 -0800 Subject: [PATCH 18/34] tweak readinessProbe --- manifests/base/argo-server/argo-server-deployment.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/base/argo-server/argo-server-deployment.yaml b/manifests/base/argo-server/argo-server-deployment.yaml index 6a0f655b0cfa..ed673dd0321f 100644 --- a/manifests/base/argo-server/argo-server-deployment.yaml +++ b/manifests/base/argo-server/argo-server-deployment.yaml @@ -23,5 +23,5 @@ spec: port: 2746 scheme: HTTP path: / - initialDelaySeconds: 5 - periodSeconds: 30 \ No newline at end of file + initialDelaySeconds: 10 + periodSeconds: 20 \ No newline at end of file From b8bab0b3349a8f15b587f3090bfee481c4c153bf Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Tue, 28 Jan 2020 15:32:17 -0800 Subject: [PATCH 19/34] docs: updated docs --- docs/argo-server.md | 51 ++++++++++++++++++++++++++++++++++++++ docs/assets/ga.svg | 1 + docs/cli.md | 21 ++++++++++++++++ docs/managed-namespace.md | 9 +++++++ docs/rest-api.md | 6 +++++ docs/workflow-templates.md | 2 ++ 6 files changed, 90 insertions(+) create mode 100644 docs/argo-server.md create mode 100644 docs/assets/ga.svg create mode 100644 docs/cli.md create mode 100644 docs/managed-namespace.md diff --git a/docs/argo-server.md b/docs/argo-server.md new file mode 100644 index 000000000000..ee275774458b --- /dev/null +++ b/docs/argo-server.md @@ -0,0 +1,51 @@ +# Argo Server + +![alpha](assets/alpha.svg) + +> v2.5 and after + +The Argo Server is a server that exposes an API and UI for workflows. You'll need to use this if you want to use [offload large workflows](offloading-large-workflows.md) or the [workflow archive](workflow-archive.md). + +You can run this in either "hosted" or "local" mode. + +It replaces the Argo UI. + +## Hosted Mode + +Use this mode if: + +* You want a drop-in replacement for the Argo UI. +* If you need to prevent users from directly accessing the database. + +Hosted mode is provide as part of the standard [manifests](../manifests), [specifically in argo-server-deployment.yaml](../manifests/base/argo-server/argo-server-deployment.yaml) . + +## Local Mode + +Use this mode if: + +* You want something that does not require complex set-up. +* You do not need to run a database. + +To run locally: + +``` +argo server +``` + +This will start a server on port 2746 which you can view at [http://localhost:2746](http://localhost:2746]). + +## Options + +### Auth Mode + +You can choose which kube config the server uses: + +* "server" - in hosted mode, use the kube config of service account, in local mode, use your local kube config. +* "client" - requires client to provide their Kubernetes bearer token and use that. +* "hybrid" - use the client token if provided, fallback to the server token if note. + +By default, the server will start with auth mode of "client" (highest security). + +### Managed Namespace + +See [managed namespace](managed-namespace.md). \ No newline at end of file diff --git a/docs/assets/ga.svg b/docs/assets/ga.svg new file mode 100644 index 000000000000..3424357bace2 --- /dev/null +++ b/docs/assets/ga.svg @@ -0,0 +1 @@ + GAGA \ No newline at end of file diff --git a/docs/cli.md b/docs/cli.md new file mode 100644 index 000000000000..0cfca06e55b2 --- /dev/null +++ b/docs/cli.md @@ -0,0 +1,21 @@ +# CLI + +Most help topics are provide using built-in help + +``` +argo --help +``` + +# Argo Server + +![alpha](assets/alpha.svg) + +> v2.5 and after + +You'll need to configure your commands to use the Argo Server if you have [offloaded node status](offloading-large-workflows.md) or are trying to access your [workflow archive](workflow-archive.md). + +To do so, set the ARGO_SERVER environment variable, e.g.: + +``` +export ARGO_SERVER=localhost:2746 +``` \ No newline at end of file diff --git a/docs/managed-namespace.md b/docs/managed-namespace.md new file mode 100644 index 000000000000..c12633053b31 --- /dev/null +++ b/docs/managed-namespace.md @@ -0,0 +1,9 @@ +# Managed Namespace + +![alpha](assets/alpha.svg) + +> v2.5 and after + +You can install Argo in either cluster scoped or namespace scope configurations. This dictates if you must set-up cluster roles or normal roles. + +In namespace scope configuration, you must run both the Workflow Controller and Argo Server using `--namespaced`. \ No newline at end of file diff --git a/docs/rest-api.md b/docs/rest-api.md index 70ba641cd8d2..00fdce81be99 100644 --- a/docs/rest-api.md +++ b/docs/rest-api.md @@ -1,5 +1,7 @@ # REST API +## Argo Server API + ![alpha](assets/alpha.svg) > v2.5 and after @@ -21,6 +23,10 @@ To view the API: 2. ../server/workflowtemplate/workflow-template.swagger.json 1. ../server/workflowarchive/archived-workflows.swagger.json +## Classic API + +![ga](assets/ga.svg) + > v2.4 and before Argo is implemented as a kubernetes controller and Workflow [Custom Resource](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/). diff --git a/docs/workflow-templates.md b/docs/workflow-templates.md index e3485a471ece..1498040e48b7 100644 --- a/docs/workflow-templates.md +++ b/docs/workflow-templates.md @@ -1,5 +1,7 @@ # Workflow Templates +![GA](assets/ga.svg) + > v2.4 and after Workflow templates are reusable checks of YAML that you can use within your workflows. This allows you to have a library of templates. From 44371538467959eac92bd4753d332831b75a5c45 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Tue, 28 Jan 2020 15:32:38 -0800 Subject: [PATCH 20/34] renamed API classic --- cmd/argo/commands/root.go | 5 + cmd/argo/commands/server.go | 6 +- manifests/README.md | 3 + pkg/apiclient/apiclient.go | 2 +- pkg/apiclient/classic-client.go | 37 +++++ .../classic-workflow-service-client.go | 139 ++++++++++++++++++ pkg/apiclient/kube-client.go | 36 ----- pkg/apiclient/kube-workflow-service-client.go | 128 ---------------- util/help/topics.go | 7 + 9 files changed, 197 insertions(+), 166 deletions(-) create mode 100644 pkg/apiclient/classic-client.go create mode 100644 pkg/apiclient/classic-workflow-service-client.go delete mode 100644 pkg/apiclient/kube-client.go delete mode 100644 pkg/apiclient/kube-workflow-service-client.go create mode 100644 util/help/topics.go diff --git a/cmd/argo/commands/root.go b/cmd/argo/commands/root.go index 89d7ec00f374..4ff186abfbf2 100644 --- a/cmd/argo/commands/root.go +++ b/cmd/argo/commands/root.go @@ -1,9 +1,12 @@ package commands import ( + "fmt" + "github.com/spf13/cobra" "github.com/argoproj/argo/cmd/argo/commands/cron" + "github.com/argoproj/argo/util/help" "github.com/argoproj/argo/cmd/argo/commands/archive" "github.com/argoproj/argo/cmd/argo/commands/client" @@ -21,6 +24,8 @@ func NewCommand() *cobra.Command { var command = &cobra.Command{ Use: CLIName, Short: "argo is the command line interface to Argo", + Example: fmt.Sprintf(` +If you're using the Argo Server (e.g. because you need large workflow support or workflow archive), please read %s.`, help.CLI), Run: func(cmd *cobra.Command, args []string) { cmd.HelpFunc()(cmd, args) }, diff --git a/cmd/argo/commands/server.go b/cmd/argo/commands/server.go index 3f23cf960efc..236bca580d3a 100644 --- a/cmd/argo/commands/server.go +++ b/cmd/argo/commands/server.go @@ -1,6 +1,7 @@ package commands import ( + "fmt" "time" "github.com/argoproj/pkg/cli" @@ -14,6 +15,7 @@ import ( "github.com/argoproj/argo/cmd/argo/commands/client" wfclientset "github.com/argoproj/argo/pkg/client/clientset/versioned" "github.com/argoproj/argo/server/apiserver" + "github.com/argoproj/argo/util/help" ) func NewServerCommand() *cobra.Command { @@ -28,7 +30,9 @@ func NewServerCommand() *cobra.Command { var command = cobra.Command{ Use: "server", - Short: "Start the server", + Short: "Start the Argo Server", + Example: fmt.Sprintf(` +See %s`, help.ArgoSever), RunE: func(c *cobra.Command, args []string) error { cli.SetLogLevel(logLevel) stats.RegisterStackDumper() diff --git a/manifests/README.md b/manifests/README.md index 530d4046433e..9ef537cf5bc9 100644 --- a/manifests/README.md +++ b/manifests/README.md @@ -6,3 +6,6 @@ Two sets of manifests are provided: |------|-------------| | [install.yaml](install.yaml) | Standard argo cluster-wide installation. Controller operates on all namespaces | | [namespace-install.yaml](namespace-install.yaml) | Installation of argo which operates on a single namespace. Controller does not require to be run with clusterrole. Installs to `argo` namespace as an example. | +| [quick-start-mysql.yaml](quick-start-mysql.yaml) | Quick start including MinIO and MySQL. Suitable for testing. | +| [quick-start-no-db.yaml](quick-start-no-db.yaml) | Quick start including MinIO. Suitable for testing. | +| [quick-start-postgres.yaml](quick-start-postgres.yaml) | Quick start including MinIO and Postgres. Suitable for testing. | diff --git a/pkg/apiclient/apiclient.go b/pkg/apiclient/apiclient.go index decb652ce921..d164b15096c7 100644 --- a/pkg/apiclient/apiclient.go +++ b/pkg/apiclient/apiclient.go @@ -18,6 +18,6 @@ func NewClient(argoServer, token string, clientConfig clientcmd.ClientConfig) (c if argoServer != "" { return newArgoServerClient(argoServer, token) } else { - return newKubeClient(clientConfig) + return newClassicClient(clientConfig) } } diff --git a/pkg/apiclient/classic-client.go b/pkg/apiclient/classic-client.go new file mode 100644 index 000000000000..22efb6f85645 --- /dev/null +++ b/pkg/apiclient/classic-client.go @@ -0,0 +1,37 @@ +package apiclient + +import ( + "context" + "fmt" + + "k8s.io/client-go/tools/clientcmd" + + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" + workflowarchivepkg "github.com/argoproj/argo/pkg/apiclient/workflowarchive" + "github.com/argoproj/argo/pkg/client/clientset/versioned" + "github.com/argoproj/argo/util/help" +) + +type classicClient struct { + versioned.Interface +} + +func newClassicClient(clientConfig clientcmd.ClientConfig) (context.Context, Client, error) { + restConfig, err := clientConfig.ClientConfig() + if err != nil { + return nil, nil, err + } + wfClient, err := versioned.NewForConfig(restConfig) + if err != nil { + return nil, nil, err + } + return context.Background(), &classicClient{wfClient}, nil +} + +func (a *classicClient) NewWorkflowServiceClient() workflowpkg.WorkflowServiceClient { + return &classicWorkflowServiceClient{a.Interface} +} + +func (a *classicClient) NewArchivedWorkflowServiceClient() (workflowarchivepkg.ArchivedWorkflowServiceClient, error) { + return nil, fmt.Errorf("it is impossible to interact with the workflow archive if you are not using the Argo Server, see " + help.CLI) +} diff --git a/pkg/apiclient/classic-workflow-service-client.go b/pkg/apiclient/classic-workflow-service-client.go new file mode 100644 index 000000000000..ad15ef10b216 --- /dev/null +++ b/pkg/apiclient/classic-workflow-service-client.go @@ -0,0 +1,139 @@ +package apiclient + +import ( + "context" + "fmt" + "strconv" + + "google.golang.org/grpc" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" + "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" + "github.com/argoproj/argo/pkg/client/clientset/versioned" + "github.com/argoproj/argo/util/help" + "github.com/argoproj/argo/workflow/packer" + "github.com/argoproj/argo/workflow/util" +) + +var ( + offloadError = fmt.Errorf("you cannot use the classic client because you have offload node states, see %s", help.CLI) +) + +type classicWorkflowServiceClient struct { + versioned.Interface +} + +func (k *classicWorkflowServiceClient) CreateWorkflow(_ context.Context, in *workflowpkg.WorkflowCreateRequest, _ ...grpc.CallOption) (*v1alpha1.Workflow, error) { + wf := in.Workflow + dryRun := len(in.CreateOptions.DryRun) > 0 + serverDryRun := in.ServerDryRun + if dryRun { + return wf, nil + } + if serverDryRun { + ok, err := k.checkServerVersionForDryRun() + if err != nil { + return nil, err + } + if !ok { + return nil, fmt.Errorf("server-dry-run is not available for server api versions older than v1.12") + } + // kind of gross code, but fine + return util.CreateServerDryRun(wf, k) + } + return k.ArgoprojV1alpha1().Workflows(in.Namespace).Create(wf) +} + +func (k *classicWorkflowServiceClient) checkServerVersionForDryRun() (bool, error) { + serverVersion, err := k.Discovery().ServerVersion() + if err != nil { + return false, err + } + majorVersion, err := strconv.Atoi(serverVersion.Major) + if err != nil { + return false, err + } + minorVersion, err := strconv.Atoi(serverVersion.Minor) + if err != nil { + return false, err + } + if majorVersion < 1 { + return false, nil + } else if majorVersion == 1 && minorVersion < 12 { + return false, nil + } + return true, nil +} + +func (k *classicWorkflowServiceClient) GetWorkflow(_ context.Context, in *workflowpkg.WorkflowGetRequest, _ ...grpc.CallOption) (*v1alpha1.Workflow, error) { + options := metav1.GetOptions{} + if in.GetOptions != nil { + options = *in.GetOptions + } + wf, err := k.ArgoprojV1alpha1().Workflows(in.Namespace).Get(in.Name, options) + if err != nil { + return nil, err + } + err = packer.DecompressWorkflow(wf) + if err != nil { + return nil, err + } + if wf.Status.IsOffloadNodeStatus() { + return nil, offloadError + } + return wf, nil +} + +func (k *classicWorkflowServiceClient) ListWorkflows(_ context.Context, in *workflowpkg.WorkflowListRequest, _ ...grpc.CallOption) (*v1alpha1.WorkflowList, error) { + list, err := k.ArgoprojV1alpha1().Workflows(in.Namespace).List(*in.ListOptions) + if err != nil { + return nil, err + } + for _, wf := range list.Items { + err = packer.DecompressWorkflow(&wf) + if err != nil { + return nil, err + } + if wf.Status.IsOffloadNodeStatus() { + return nil, offloadError + } + } + return list, nil +} + +func (k *classicWorkflowServiceClient) WatchWorkflows(ctx context.Context, in *workflowpkg.WatchWorkflowsRequest, opts ...grpc.CallOption) (workflowpkg.WorkflowService_WatchWorkflowsClient, error) { + panic("implement me") +} + +func (k *classicWorkflowServiceClient) DeleteWorkflow(ctx context.Context, in *workflowpkg.WorkflowDeleteRequest, opts ...grpc.CallOption) (*workflowpkg.WorkflowDeleteResponse, error) { + panic("implement me") +} + +func (k *classicWorkflowServiceClient) RetryWorkflow(ctx context.Context, in *workflowpkg.WorkflowRetryRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { + panic("implement me") +} + +func (k *classicWorkflowServiceClient) ResubmitWorkflow(ctx context.Context, in *workflowpkg.WorkflowResubmitRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { + panic("implement me") +} + +func (k *classicWorkflowServiceClient) ResumeWorkflow(ctx context.Context, in *workflowpkg.WorkflowResumeRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { + panic("implement me") +} + +func (k *classicWorkflowServiceClient) SuspendWorkflow(ctx context.Context, in *workflowpkg.WorkflowSuspendRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { + panic("implement me") +} + +func (k *classicWorkflowServiceClient) TerminateWorkflow(ctx context.Context, in *workflowpkg.WorkflowTerminateRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { + panic("implement me") +} + +func (k *classicWorkflowServiceClient) LintWorkflow(ctx context.Context, in *workflowpkg.WorkflowLintRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { + panic("implement me") +} + +func (k *classicWorkflowServiceClient) PodLogs(ctx context.Context, in *workflowpkg.WorkflowLogRequest, opts ...grpc.CallOption) (workflowpkg.WorkflowService_PodLogsClient, error) { + panic("implement me") +} diff --git a/pkg/apiclient/kube-client.go b/pkg/apiclient/kube-client.go deleted file mode 100644 index 718793aaeea9..000000000000 --- a/pkg/apiclient/kube-client.go +++ /dev/null @@ -1,36 +0,0 @@ -package apiclient - -import ( - "context" - "fmt" - - "k8s.io/client-go/tools/clientcmd" - - workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" - workflowarchivepkg "github.com/argoproj/argo/pkg/apiclient/workflowarchive" - "github.com/argoproj/argo/pkg/client/clientset/versioned" -) - -type kubeClient struct { - versioned.Interface -} - -func newKubeClient(clientConfig clientcmd.ClientConfig) (context.Context, Client, error) { - restConfig, err := clientConfig.ClientConfig() - if err != nil { - return nil, nil, err - } - wfClient, err := versioned.NewForConfig(restConfig) - if err != nil { - return nil, nil, err - } - return context.Background(), &kubeClient{wfClient}, nil -} - -func (a *kubeClient) NewWorkflowServiceClient() workflowpkg.WorkflowServiceClient { - return &kubeWorkflowServiceClient{a.Interface} -} - -func (a *kubeClient) NewArchivedWorkflowServiceClient() (workflowarchivepkg.ArchivedWorkflowServiceClient, error) { - return nil, fmt.Errorf("it is impossible to interact with the archive if you are not using the Argo Server") -} diff --git a/pkg/apiclient/kube-workflow-service-client.go b/pkg/apiclient/kube-workflow-service-client.go deleted file mode 100644 index 6d6ccee047ba..000000000000 --- a/pkg/apiclient/kube-workflow-service-client.go +++ /dev/null @@ -1,128 +0,0 @@ -package apiclient - -import ( - "context" - "fmt" - "strconv" - - "google.golang.org/grpc" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow" - "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1" - "github.com/argoproj/argo/pkg/client/clientset/versioned" - "github.com/argoproj/argo/workflow/packer" - "github.com/argoproj/argo/workflow/util" -) - -type kubeWorkflowServiceClient struct { - versioned.Interface -} - -func (k *kubeWorkflowServiceClient) CreateWorkflow(_ context.Context, in *workflowpkg.WorkflowCreateRequest, _ ...grpc.CallOption) (*v1alpha1.Workflow, error) { - wf := in.Workflow - dryRun := len(in.CreateOptions.DryRun) > 0 - serverDryRun := in.ServerDryRun - if dryRun { - return wf, nil - } - if serverDryRun { - ok, err := k.checkServerVersionForDryRun() - if err != nil { - return nil, err - } - if !ok { - return nil, fmt.Errorf("server-dry-run is not available for server api versions older than v1.12") - } - // kind of gross code, but fine - return util.CreateServerDryRun(wf, k) - } - return k.ArgoprojV1alpha1().Workflows(in.Namespace).Create(wf) -} - -func (k *kubeWorkflowServiceClient) checkServerVersionForDryRun() (bool, error) { - serverVersion, err := k.Discovery().ServerVersion() - if err != nil { - return false, err - } - majorVersion, err := strconv.Atoi(serverVersion.Major) - if err != nil { - return false, err - } - minorVersion, err := strconv.Atoi(serverVersion.Minor) - if err != nil { - return false, err - } - if majorVersion < 1 { - return false, nil - } else if majorVersion == 1 && minorVersion < 12 { - return false, nil - } - return true, nil -} - -func (k *kubeWorkflowServiceClient) GetWorkflow(_ context.Context, in *workflowpkg.WorkflowGetRequest, _ ...grpc.CallOption) (*v1alpha1.Workflow, error) { - options := metav1.GetOptions{} - if in.GetOptions != nil { - options = *in.GetOptions - } - wf, err := k.ArgoprojV1alpha1().Workflows(in.Namespace).Get(in.Name, options) - if err != nil { - return nil, err - } - err = packer.DecompressWorkflow(wf) - if err != nil { - return nil, err - } - return wf, nil -} - -func (k *kubeWorkflowServiceClient) ListWorkflows(_ context.Context, in *workflowpkg.WorkflowListRequest, _ ...grpc.CallOption) (*v1alpha1.WorkflowList, error) { - list, err := k.ArgoprojV1alpha1().Workflows(in.Namespace).List(*in.ListOptions) - if err != nil { - return nil, err - } - for _, wf := range list.Items { - err = packer.DecompressWorkflow(&wf) - if err != nil { - return nil, err - } - } - return list, nil -} - -func (k *kubeWorkflowServiceClient) WatchWorkflows(ctx context.Context, in *workflowpkg.WatchWorkflowsRequest, opts ...grpc.CallOption) (workflowpkg.WorkflowService_WatchWorkflowsClient, error) { - panic("implement me") -} - -func (k *kubeWorkflowServiceClient) DeleteWorkflow(ctx context.Context, in *workflowpkg.WorkflowDeleteRequest, opts ...grpc.CallOption) (*workflowpkg.WorkflowDeleteResponse, error) { - panic("implement me") -} - -func (k *kubeWorkflowServiceClient) RetryWorkflow(ctx context.Context, in *workflowpkg.WorkflowRetryRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { - panic("implement me") -} - -func (k *kubeWorkflowServiceClient) ResubmitWorkflow(ctx context.Context, in *workflowpkg.WorkflowResubmitRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { - panic("implement me") -} - -func (k *kubeWorkflowServiceClient) ResumeWorkflow(ctx context.Context, in *workflowpkg.WorkflowResumeRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { - panic("implement me") -} - -func (k *kubeWorkflowServiceClient) SuspendWorkflow(ctx context.Context, in *workflowpkg.WorkflowSuspendRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { - panic("implement me") -} - -func (k *kubeWorkflowServiceClient) TerminateWorkflow(ctx context.Context, in *workflowpkg.WorkflowTerminateRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { - panic("implement me") -} - -func (k *kubeWorkflowServiceClient) LintWorkflow(ctx context.Context, in *workflowpkg.WorkflowLintRequest, opts ...grpc.CallOption) (*v1alpha1.Workflow, error) { - panic("implement me") -} - -func (k *kubeWorkflowServiceClient) PodLogs(ctx context.Context, in *workflowpkg.WorkflowLogRequest, opts ...grpc.CallOption) (workflowpkg.WorkflowService_PodLogsClient, error) { - panic("implement me") -} diff --git a/util/help/topics.go b/util/help/topics.go new file mode 100644 index 000000000000..bdaa69e3c9fa --- /dev/null +++ b/util/help/topics.go @@ -0,0 +1,7 @@ +package help + +const ( + root = "https://github.com/argoproj/argo/blob/master/docs" + ArgoSever = root + "/argo-server.md" + CLI = root + "/cli.md" +) From 22be4a165a16482198108ad41815da69f3aa0c52 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Tue, 28 Jan 2020 16:19:12 -0800 Subject: [PATCH 21/34] log warning --- pkg/apiclient/classic-workflow-service-client.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/apiclient/classic-workflow-service-client.go b/pkg/apiclient/classic-workflow-service-client.go index ad15ef10b216..82c64f30410e 100644 --- a/pkg/apiclient/classic-workflow-service-client.go +++ b/pkg/apiclient/classic-workflow-service-client.go @@ -5,6 +5,7 @@ import ( "fmt" "strconv" + log "github.com/sirupsen/logrus" "google.golang.org/grpc" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -17,7 +18,7 @@ import ( ) var ( - offloadError = fmt.Errorf("you cannot use the classic client because you have offload node states, see %s", help.CLI) + offloadNodeStatusNotSupportedWarning = fmt.Sprintf("offload node status is not supported, see %s", help.CLI) ) type classicWorkflowServiceClient struct { @@ -80,7 +81,7 @@ func (k *classicWorkflowServiceClient) GetWorkflow(_ context.Context, in *workfl return nil, err } if wf.Status.IsOffloadNodeStatus() { - return nil, offloadError + log.Warn(offloadNodeStatusNotSupportedWarning) } return wf, nil } @@ -96,7 +97,7 @@ func (k *classicWorkflowServiceClient) ListWorkflows(_ context.Context, in *work return nil, err } if wf.Status.IsOffloadNodeStatus() { - return nil, offloadError + log.Warn(offloadNodeStatusNotSupportedWarning) } } return list, nil From 4268930e6eb6d451aa33b5f1b3242b04f3cf6141 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Thu, 30 Jan 2020 11:28:52 -0800 Subject: [PATCH 22/34] Update docs/argo-server.md Co-Authored-By: Simon Behar --- docs/argo-server.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/argo-server.md b/docs/argo-server.md index ee275774458b..69c62a99eb0d 100644 --- a/docs/argo-server.md +++ b/docs/argo-server.md @@ -17,7 +17,7 @@ Use this mode if: * You want a drop-in replacement for the Argo UI. * If you need to prevent users from directly accessing the database. -Hosted mode is provide as part of the standard [manifests](../manifests), [specifically in argo-server-deployment.yaml](../manifests/base/argo-server/argo-server-deployment.yaml) . +Hosted mode is provided as part of the standard [manifests](../manifests), [specifically in argo-server-deployment.yaml](../manifests/base/argo-server/argo-server-deployment.yaml) . ## Local Mode @@ -48,4 +48,4 @@ By default, the server will start with auth mode of "client" (highest security). ### Managed Namespace -See [managed namespace](managed-namespace.md). \ No newline at end of file +See [managed namespace](managed-namespace.md). From 9d62b7e687867025626aa4328eb0a8c1e41616d5 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Thu, 30 Jan 2020 11:29:00 -0800 Subject: [PATCH 23/34] Update docs/cli.md Co-Authored-By: Simon Behar --- docs/cli.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/cli.md b/docs/cli.md index 0cfca06e55b2..69dca4f09ded 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -1,6 +1,6 @@ # CLI -Most help topics are provide using built-in help +Most help topics are provided using built-in help ``` argo --help @@ -18,4 +18,4 @@ To do so, set the ARGO_SERVER environment variable, e.g.: ``` export ARGO_SERVER=localhost:2746 -``` \ No newline at end of file +``` From acd97d8fd214b6cedeb42d8fadc4a383fd9d1271 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Thu, 30 Jan 2020 11:29:10 -0800 Subject: [PATCH 24/34] Update docs/argo-server.md Co-Authored-By: Simon Behar --- docs/argo-server.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/argo-server.md b/docs/argo-server.md index 69c62a99eb0d..4f7319811033 100644 --- a/docs/argo-server.md +++ b/docs/argo-server.md @@ -4,7 +4,7 @@ > v2.5 and after -The Argo Server is a server that exposes an API and UI for workflows. You'll need to use this if you want to use [offload large workflows](offloading-large-workflows.md) or the [workflow archive](workflow-archive.md). +The Argo Server is a server that exposes an API and UI for workflows. You'll need to use this if you want to [offload large workflows](offloading-large-workflows.md) or the [workflow archive](workflow-archive.md). You can run this in either "hosted" or "local" mode. From 3bd37f40b38dbf4861924a029eaba21c9b91decc Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Thu, 30 Jan 2020 12:12:34 -0800 Subject: [PATCH 25/34] renamed to CLISuite --- Makefile | 2 +- test/e2e/cli_test.go | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 1ad2e7d55a0a..8e7c018af03b 100644 --- a/Makefile +++ b/Makefile @@ -393,7 +393,7 @@ test-api: test-images .PHONY: test-cli test-cli: test-images cli # Run CLI tests - go test -timeout 1m -v -count 1 -p 1 -run CliSuite ./test/e2e + go test -timeout 1m -v -count 1 -p 1 -run CLISuite ./test/e2e go test -timeout 1m -v -count 1 -p 1 -run CLIWithServerSuite ./test/e2e # clean diff --git a/test/e2e/cli_test.go b/test/e2e/cli_test.go index 57ed129c26d4..94245d7e39ab 100644 --- a/test/e2e/cli_test.go +++ b/test/e2e/cli_test.go @@ -52,8 +52,10 @@ func (s *CLISuite) TestTokenArg() { if os.Getenv("CI") != "true" { s.T().SkipNow() } - s.Given().RunCli([]string{"list", "--user", "fake_token_user", "--token", "badtoken"}, func(t *testing.T, output string, err error) { - assert.Error(t, err) + s.Run("ListWithBadToken", func(t *testing.T) { + s.Given(t).RunCli([]string{"list", "--user", "fake_token_user", "--token", "badtoken"}, func(t *testing.T, output string, err error) { + assert.Error(t, err) + }) }) var goodToken string @@ -62,11 +64,12 @@ func (s *CLISuite) TestTokenArg() { assert.NoError(t, err) goodToken = token }) - - s.Given().RunCli([]string{"list", "--user", "fake_token_user", "--token", goodToken}, func(t *testing.T, output string, err error) { - assert.NoError(t, err) - assert.Contains(t, output, "NAME") - assert.Contains(t, output, "STATUS") + s.Run("ListWithGoodToken", func(t *testing.T) { + s.Given(t).RunCli([]string{"list", "--user", "fake_token_user", "--token", goodToken}, func(t *testing.T, output string, err error) { + assert.NoError(t, err) + assert.Contains(t, output, "NAME") + assert.Contains(t, output, "STATUS") + }) }) } From 1246586d0c263be0c585d99eae19cc67f478cd81 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Thu, 30 Jan 2020 12:27:00 -0800 Subject: [PATCH 26/34] fix: deal with missing bearer token --- cmd/argo/commands/client/conn.go | 4 +++- pkg/apiclient/apiclient.go | 4 ++-- util/kubeconfig/kubeconfig.go | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/argo/commands/client/conn.go b/cmd/argo/commands/client/conn.go index c94005fd9998..c5ea6b247d18 100644 --- a/cmd/argo/commands/client/conn.go +++ b/cmd/argo/commands/client/conn.go @@ -44,7 +44,9 @@ func GetClientConn() *grpc.ClientConn { } func NewAPIClient() (context.Context, apiclient.Client) { - ctx, client, err := apiclient.NewClient(ArgoServer, GetBearerToken(), Config) + ctx, client, err := apiclient.NewClient(ArgoServer, func() string { + return GetBearerToken() + }, Config) if err != nil { log.Fatal(err) } diff --git a/pkg/apiclient/apiclient.go b/pkg/apiclient/apiclient.go index d164b15096c7..4008ac28665f 100644 --- a/pkg/apiclient/apiclient.go +++ b/pkg/apiclient/apiclient.go @@ -14,9 +14,9 @@ type Client interface { NewWorkflowServiceClient() workflowpkg.WorkflowServiceClient } -func NewClient(argoServer, token string, clientConfig clientcmd.ClientConfig) (context.Context, Client, error) { +func NewClient(argoServer string, tokenSupplier func() string, clientConfig clientcmd.ClientConfig) (context.Context, Client, error) { if argoServer != "" { - return newArgoServerClient(argoServer, token) + return newArgoServerClient(argoServer, tokenSupplier()) } else { return newClassicClient(clientConfig) } diff --git a/util/kubeconfig/kubeconfig.go b/util/kubeconfig/kubeconfig.go index 3a23abce2f35..4c246fd78a06 100644 --- a/util/kubeconfig/kubeconfig.go +++ b/util/kubeconfig/kubeconfig.go @@ -100,7 +100,7 @@ func GetBearerToken(in *restclient.Config) (string, error) { return strings.TrimPrefix(token, "Bearer "), nil } } - return "", errors.Errorf("Can not find a token") + return "", errors.Errorf("could not find a token") } // Get the Auth token from environment variable From 443b2bd91654f03708543f45bbd075f73cc7af23 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Thu, 30 Jan 2020 13:23:50 -0800 Subject: [PATCH 27/34] feat: no longer query live workflows if we do not need to --- workflow/controller/controller.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/workflow/controller/controller.go b/workflow/controller/controller.go index 39e83df6b59c..1e2fb4066c65 100644 --- a/workflow/controller/controller.go +++ b/workflow/controller/controller.go @@ -263,6 +263,10 @@ func (wfc *WorkflowController) periodicWorkflowGarbageCollector(stopCh <-chan st if err != nil { log.WithField("err", err).Error("Failed to list offloaded nodes") } + if len(oldUIDs) == 0 { + log.Info("Zero old UIDs, nothing to do") + return + } list, err := util.NewWorkflowLister(wfc.wfInformer).List() if err != nil { log.WithField("err", err).Error("Failed to list workflows") @@ -271,11 +275,11 @@ func (wfc *WorkflowController) periodicWorkflowGarbageCollector(stopCh <-chan st for _, wf := range list { wfs[wf.UID] = true } - log.WithFields(log.Fields{"len_wfs": len(wfs), "len_old_uids": len(oldUIDs)}).Info("Comparing live workflows with old UIDs") + log.WithFields(log.Fields{"len_wfs": len(wfs), "len_old_uids": len(oldUIDs)}).Info("Deleting old UIDs that are not live") for _, uid := range oldUIDs { _, ok := wfs[types.UID(uid)] if !ok { - err := wfc.offloadNodeStatusRepo.Delete(string(uid)) + err := wfc.offloadNodeStatusRepo.Delete(uid) if err != nil { log.WithField("err", err).Error("Failed to delete offloaded nodes") } From 2d013fb75785c611899a903ddc7934851b66fe60 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Thu, 30 Jan 2020 14:22:58 -0800 Subject: [PATCH 28/34] merge --- cmd/argo/commands/client/conn.go | 4 ++-- pkg/apiclient/apiclient.go | 4 ++-- pkg/apiclient/argo-server-client.go | 14 +++++++------- test/e2e/cli_test.go | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cmd/argo/commands/client/conn.go b/cmd/argo/commands/client/conn.go index 4ebc4be3705a..0cb963bfd763 100644 --- a/cmd/argo/commands/client/conn.go +++ b/cmd/argo/commands/client/conn.go @@ -45,7 +45,7 @@ func GetClientConn() *grpc.ClientConn { func NewAPIClient() (context.Context, apiclient.Client) { ctx, client, err := apiclient.NewClient(ArgoServer, func() string { - return GetBearerToken() + return GetAuthString() }, Config) if err != nil { log.Fatal(err) @@ -63,7 +63,7 @@ func Namespace() string { // DEPRECATED should only be used by client/v1 package func GetContext() context.Context { - return apiclient.NewContext(GetAuthToken()) + return apiclient.NewContext(GetAuthString()) } func GetAuthString() string { diff --git a/pkg/apiclient/apiclient.go b/pkg/apiclient/apiclient.go index 4008ac28665f..2835a4377fff 100644 --- a/pkg/apiclient/apiclient.go +++ b/pkg/apiclient/apiclient.go @@ -14,9 +14,9 @@ type Client interface { NewWorkflowServiceClient() workflowpkg.WorkflowServiceClient } -func NewClient(argoServer string, tokenSupplier func() string, clientConfig clientcmd.ClientConfig) (context.Context, Client, error) { +func NewClient(argoServer string, authSupplier func() string, clientConfig clientcmd.ClientConfig) (context.Context, Client, error) { if argoServer != "" { - return newArgoServerClient(argoServer, tokenSupplier()) + return newArgoServerClient(argoServer, authSupplier()) } else { return newClassicClient(clientConfig) } diff --git a/pkg/apiclient/argo-server-client.go b/pkg/apiclient/argo-server-client.go index af4592fad53a..afff9b1f417d 100644 --- a/pkg/apiclient/argo-server-client.go +++ b/pkg/apiclient/argo-server-client.go @@ -14,12 +14,12 @@ type argoServerClient struct { *grpc.ClientConn } -func newArgoServerClient(argoServer, token string) (context.Context, Client, error) { +func newArgoServerClient(argoServer, auth string) (context.Context, Client, error) { conn, err := NewClientConn(argoServer) if err != nil { return nil, nil, err } - return newContext(token), &argoServerClient{conn}, nil + return newContext(auth), &argoServerClient{conn}, nil } func (a *argoServerClient) NewWorkflowServiceClient() workflowpkg.WorkflowServiceClient { @@ -39,13 +39,13 @@ func NewClientConn(argoServer string) (*grpc.ClientConn, error) { } // DEPRECATED -func NewContext(token string) context.Context { - return newContext(token) +func NewContext(auth string) context.Context { + return newContext(auth) } -func newContext(token string) context.Context { - if token == "" { +func newContext(auth string) context.Context { + if auth == "" { return context.Background() } - return metadata.NewOutgoingContext(context.Background(), metadata.Pairs("authorization", "Bearer "+token)) + return metadata.NewOutgoingContext(context.Background(), metadata.Pairs("authorization", auth)) } diff --git a/test/e2e/cli_test.go b/test/e2e/cli_test.go index 90fda7407cb5..d42b406470b0 100644 --- a/test/e2e/cli_test.go +++ b/test/e2e/cli_test.go @@ -61,7 +61,7 @@ func (s *CLISuite) TestToken() { authString = "Basic " + token } assert.Equal(t, authString, output) - }) + }) } func (s *CLISuite) TestTokenArg() { From ce50880aac78e55509fe1713ba15501488a43211 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Thu, 30 Jan 2020 16:05:28 -0800 Subject: [PATCH 29/34] fix tests --- test/e2e/cli_test.go | 16 ---------------- test/e2e/cli_with_server_test.go | 20 +++++++++++++------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/test/e2e/cli_test.go b/test/e2e/cli_test.go index d42b406470b0..94245d7e39ab 100644 --- a/test/e2e/cli_test.go +++ b/test/e2e/cli_test.go @@ -48,22 +48,6 @@ func (s *CLISuite) TestSubmitServerDryRun() { }) } -func (s *CLISuite) TestToken() { - s.Given(s.T()).RunCli([]string{"token"}, func(t *testing.T, output string, err error) { - assert.NoError(t, err) - var authString, token string - token = s.GetBasicAuthToken() - if token == "" { - token, err = s.GetServiceAccountToken() - assert.NoError(t, err) - authString = "Bearer " + token - } else { - authString = "Basic " + token - } - assert.Equal(t, authString, output) - }) -} - func (s *CLISuite) TestTokenArg() { if os.Getenv("CI") != "true" { s.T().SkipNow() diff --git a/test/e2e/cli_with_server_test.go b/test/e2e/cli_with_server_test.go index f0f20efe6f08..be101b65c30a 100644 --- a/test/e2e/cli_with_server_test.go +++ b/test/e2e/cli_with_server_test.go @@ -33,14 +33,20 @@ func (s *CLIWithServerSuite) AfterTest(suiteName, testName string) { _ = os.Unsetenv("ARGO_TOKEN") } -func (s *CLIWithServerSuite) TestToken() { - s.Given(s.T()). - RunCli([]string{"token"}, func(t *testing.T, output string, err error) { - assert.NoError(t, err) - token, err := s.GetServiceAccountToken() +func (s *CLISuite) TestToken() { + s.Given(s.T()).RunCli([]string{"token"}, func(t *testing.T, output string, err error) { + assert.NoError(t, err) + var authString, token string + token = s.GetBasicAuthToken() + if token == "" { + token, err = s.GetServiceAccountToken() assert.NoError(t, err) - assert.Equal(t, token, output) - }) + authString = "Bearer " + token + } else { + authString = "Basic " + token + } + assert.Equal(t, authString, output) + }) } func (s *CLIWithServerSuite) TestArchive() { From d2510e49b7a5c41e9f7af2cfed96dee9465e834d Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Thu, 30 Jan 2020 17:03:37 -0800 Subject: [PATCH 30/34] remove loggig --- server/static/response-rewriter.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/server/static/response-rewriter.go b/server/static/response-rewriter.go index 63570517bd83..b824143ff7a7 100644 --- a/server/static/response-rewriter.go +++ b/server/static/response-rewriter.go @@ -4,8 +4,6 @@ import ( "bytes" "net/http" "strconv" - - log "github.com/sirupsen/logrus" ) type responseRewriter struct { @@ -18,6 +16,5 @@ func (w *responseRewriter) Write(a []byte) (int, error) { b := bytes.Replace(a, w.old, w.new, 1) // status code and headers are printed out when we write data w.Header().Set("Content-Length", strconv.Itoa(len(b))) - log.WithFields(log.Fields{"a": string(a), "b": string(b)}).Info() return w.ResponseWriter.Write(b) } From d940ecb2d76dcf28a0d3f65d59e5a8f3446ae93a Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Thu, 30 Jan 2020 17:03:49 -0800 Subject: [PATCH 31/34] find empty url bug --- cmd/argo/commands/server.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/argo/commands/server.go b/cmd/argo/commands/server.go index 82771586c5fa..6a35f1bd51e4 100644 --- a/cmd/argo/commands/server.go +++ b/cmd/argo/commands/server.go @@ -92,11 +92,11 @@ See %s`, help.ArgoSever), } command.Flags().IntVarP(&port, "port", "p", 2746, "Port to listen on") - baseHref, ok := os.LookupEnv("BASE_HREF") - if !ok { - baseHRef = "/" + defaultBaseHRef := os.Getenv("BASE_HREF") + if defaultBaseHRef == "" { + defaultBaseHRef = "/" } - command.Flags().StringVar(&baseHRef, "basehref", baseHref, "Value for base href in index.html. Used if the server is running behind reverse proxy under subpath different from /. Defaults to the environment variable BASE_HREF.") + command.Flags().StringVar(&baseHRef, "basehref", defaultBaseHRef, "Value for base href in index.html. Used if the server is running behind reverse proxy under subpath different from /. Defaults to the environment variable BASE_HREF.") command.Flags().StringVar(&authMode, "auth-mode", "server", "API server authentication mode. One of: client|server|hybrid") command.Flags().StringVar(&configMap, "configmap", "workflow-controller-configmap", "Name of K8s configmap to retrieve workflow controller configuration") command.Flags().StringVar(&logLevel, "loglevel", "info", "Set the logging level. One of: debug|info|warn|error") From bee619d6ea1b437eeec159e2dd5b8ae07bb4076f Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Thu, 30 Jan 2020 17:17:46 -0800 Subject: [PATCH 32/34] ci: re-order --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 300f4c1bd6bd..dc3bf197a43a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -81,13 +81,13 @@ commands: name: Establish port forward command: make pf background: true + - run: + name: Sleep for short while + command: sleep 10s - run: name: Watch Kubernetes events, to help diagnose failures command: kubectl -n argo get events --watch background: true - - run: - name: Sleep for short while - command: sleep 10s - run: name: Follow logs, to help diagnose failures command: make logs From 405f776a19682f4e65b3556559ae904cf0b44b68 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Thu, 30 Jan 2020 17:34:13 -0800 Subject: [PATCH 33/34] diagnostics --- test/e2e/fixtures/e2e_suite.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/e2e/fixtures/e2e_suite.go b/test/e2e/fixtures/e2e_suite.go index 5344aab56703..71b81f0a79ac 100644 --- a/test/e2e/fixtures/e2e_suite.go +++ b/test/e2e/fixtures/e2e_suite.go @@ -118,6 +118,17 @@ func (s *E2ESuite) BeforeTest(_, _ string) { time.Sleep(3 * time.Second) } } + { + wfs, err := s.wfClient.List(metav1.ListOptions{}) + if err != nil { + panic(err) + } + pods, err := s.KubeClient.CoreV1().Pods(Namespace).List(metav1.ListOptions{LabelSelector: "workflows.argoproj.io/workflow"}) + if err != nil { + panic(err) + } + log.WithFields(log.Fields{"wfs": len(wfs.Items), "pods": len(pods.Items)}).Debug("TOD ALEX DIAGNOSTICS ") + } // delete all workflow templates wfTmpl, err := s.wfTemplateClient.List(metav1.ListOptions{LabelSelector: label}) if err != nil { From 8a6d5ad4233e2df05212d46faed801bd6d1e70c9 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Thu, 30 Jan 2020 17:58:11 -0800 Subject: [PATCH 34/34] add pod GC --- Makefile | 13 +++++++++++++ test/e2e/cron_test.go | 8 ++++++++ .../expectedfailures/failed-step-event.yaml | 10 ++++++---- test/e2e/expectedfailures/failed-step.yaml | 18 ++++++++++-------- .../pod-termination-failure.yaml | 18 ++++++++++-------- .../volumes-pvc-fail-event.yaml | 16 +++++++++------- test/e2e/fixtures/e2e_suite.go | 11 ----------- test/e2e/functional/continue-on-failed.yaml | 2 ++ test/e2e/functional/success-event.yaml | 8 +++++--- test/e2e/smoke/artifact-passing.yaml | 2 ++ test/e2e/smoke/basic-2.yaml | 2 ++ test/e2e/smoke/basic.yaml | 2 ++ test/e2e/smoke/hello-world-workflow-tmpl.yaml | 2 ++ test/e2e/testdata/always-fail-1.yaml | 2 ++ test/e2e/testdata/always-fail-2.yaml | 2 ++ test/e2e/testdata/always-succeed-1.yaml | 2 ++ test/e2e/testdata/basic-allow.yaml | 2 ++ test/e2e/testdata/basic-forbid.yaml | 2 ++ test/e2e/testdata/basic-replace.yaml | 2 ++ test/e2e/testdata/basic.yaml | 2 ++ 20 files changed, 85 insertions(+), 41 deletions(-) diff --git a/Makefile b/Makefile index 8e7c018af03b..cdd9cd87dd18 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,19 @@ DB ?= postgres K3D := $(shell if [ "`kubectl config current-context`" = "k3s-default" ]; then echo true; else echo false; fi) ARGO_TOKEN = $(shell kubectl -n argo get secret -o name | grep argo-server | xargs kubectl -n argo get -o jsonpath='{.data.token}' | base64 --decode) +# test flags +export SKIP_CRON_SUITE=true +# if we are on any branch with "master", "release", or "cron" in the name we should run cron tests +ifneq ($(findstring cron,$(GIT_BRANCH)),) +export SKIP_CRON_SUITE=false +endif +ifneq ($(findstring master,$(GIT_BRANCH)),) +export SKIP_CRON_SUITE=false +endif +ifneq ($(findstring release,$(GIT_BRANCH)),) +export SKIP_CRON_SUITE=false +endif + override LDFLAGS += \ -X ${PACKAGE}.version=$(VERSION) \ -X ${PACKAGE}.buildDate=${BUILD_DATE} \ diff --git a/test/e2e/cron_test.go b/test/e2e/cron_test.go index 208d544d0011..888da15e4cf7 100644 --- a/test/e2e/cron_test.go +++ b/test/e2e/cron_test.go @@ -2,6 +2,7 @@ package e2e import ( "fmt" + "os" "strconv" "testing" "time" @@ -24,6 +25,13 @@ type CronSuite struct { fixtures.E2ESuite } +func (s *CronSuite) SetupSuite() { + if os.Getenv("SKIP_CRON_SUITE") == "true" { + s.T().SkipNow() + } + s.E2ESuite.SetupSuite() +} + func (s *CronSuite) TestBasic() { s.Given(s.T()). CronWorkflow("@testdata/basic.yaml"). diff --git a/test/e2e/expectedfailures/failed-step-event.yaml b/test/e2e/expectedfailures/failed-step-event.yaml index af1d6615a8ba..0337ea265125 100644 --- a/test/e2e/expectedfailures/failed-step-event.yaml +++ b/test/e2e/expectedfailures/failed-step-event.yaml @@ -8,9 +8,11 @@ metadata: labels: argo-e2e: true spec: + podGC: + strategy: OnPodCompletion entrypoint: exit templates: - - name: exit - container: - image: cowsay:v1 - command: [sh, -c, exit 1] + - name: exit + container: + image: cowsay:v1 + command: [sh, -c, exit 1] diff --git a/test/e2e/expectedfailures/failed-step.yaml b/test/e2e/expectedfailures/failed-step.yaml index a01747a86625..d1d9fc24fff1 100644 --- a/test/e2e/expectedfailures/failed-step.yaml +++ b/test/e2e/expectedfailures/failed-step.yaml @@ -8,16 +8,18 @@ metadata: labels: argo-e2e: true spec: + podGC: + strategy: OnPodCompletion entrypoint: failed-step templates: - - name: failed-step - steps: - - - name: exit - template: exit - arguments: - parameters: - - name: code - value: "{{item}}" + - name: failed-step + steps: + - - name: exit + template: exit + arguments: + parameters: + - name: code + value: "{{item}}" withItems: - 0 - 1 diff --git a/test/e2e/expectedfailures/pod-termination-failure.yaml b/test/e2e/expectedfailures/pod-termination-failure.yaml index d5d4040384c5..2b14a6df8a1c 100644 --- a/test/e2e/expectedfailures/pod-termination-failure.yaml +++ b/test/e2e/expectedfailures/pod-termination-failure.yaml @@ -8,16 +8,18 @@ metadata: labels: argo-e2e: true spec: + podGC: + strategy: OnPodCompletion entrypoint: entry templates: - - name: entry - dag: - tasks: - - name: sleep - template: sleep-n-sec - arguments: - parameters: - - name: seconds + - name: entry + dag: + tasks: + - name: sleep + template: sleep-n-sec + arguments: + parameters: + - name: seconds value: 1200 - name: check-running template: check-status diff --git a/test/e2e/expectedfailures/volumes-pvc-fail-event.yaml b/test/e2e/expectedfailures/volumes-pvc-fail-event.yaml index f78ad374a433..da04eb1e1aa9 100644 --- a/test/e2e/expectedfailures/volumes-pvc-fail-event.yaml +++ b/test/e2e/expectedfailures/volumes-pvc-fail-event.yaml @@ -7,15 +7,17 @@ metadata: labels: argo-e2e: true spec: + podGC: + strategy: OnPodCompletion entrypoint: volumes-pvc-example volumeClaimTemplates: - - metadata: - name: workdir - spec: - accessModes: [ "InvalidAccessMode" ] - resources: - requests: - storage: 1Gi + - metadata: + name: workdir + spec: + accessModes: [ "InvalidAccessMode" ] + resources: + requests: + storage: 1Gi templates: - name: volumes-pvc-example diff --git a/test/e2e/fixtures/e2e_suite.go b/test/e2e/fixtures/e2e_suite.go index 71b81f0a79ac..5344aab56703 100644 --- a/test/e2e/fixtures/e2e_suite.go +++ b/test/e2e/fixtures/e2e_suite.go @@ -118,17 +118,6 @@ func (s *E2ESuite) BeforeTest(_, _ string) { time.Sleep(3 * time.Second) } } - { - wfs, err := s.wfClient.List(metav1.ListOptions{}) - if err != nil { - panic(err) - } - pods, err := s.KubeClient.CoreV1().Pods(Namespace).List(metav1.ListOptions{LabelSelector: "workflows.argoproj.io/workflow"}) - if err != nil { - panic(err) - } - log.WithFields(log.Fields{"wfs": len(wfs.Items), "pods": len(pods.Items)}).Debug("TOD ALEX DIAGNOSTICS ") - } // delete all workflow templates wfTmpl, err := s.wfTemplateClient.List(metav1.ListOptions{LabelSelector: label}) if err != nil { diff --git a/test/e2e/functional/continue-on-failed.yaml b/test/e2e/functional/continue-on-failed.yaml index 7eeb7fc0a77f..15c560363240 100644 --- a/test/e2e/functional/continue-on-failed.yaml +++ b/test/e2e/functional/continue-on-failed.yaml @@ -5,6 +5,8 @@ metadata: labels: argo-e2e: true spec: + podGC: + strategy: OnPodCompletion entrypoint: workflow-ignore parallelism: 2 templates: diff --git a/test/e2e/functional/success-event.yaml b/test/e2e/functional/success-event.yaml index 434212880ba7..d25fb6618088 100644 --- a/test/e2e/functional/success-event.yaml +++ b/test/e2e/functional/success-event.yaml @@ -8,8 +8,10 @@ metadata: labels: argo-e2e: true spec: + podGC: + strategy: OnPodCompletion entrypoint: exit templates: - - name: exit - container: - image: cowsay:v1 + - name: exit + container: + image: cowsay:v1 diff --git a/test/e2e/smoke/artifact-passing.yaml b/test/e2e/smoke/artifact-passing.yaml index e850eb16f238..c8aeab52f253 100644 --- a/test/e2e/smoke/artifact-passing.yaml +++ b/test/e2e/smoke/artifact-passing.yaml @@ -5,6 +5,8 @@ metadata: labels: argo-e2e: true spec: + podGC: + strategy: OnPodCompletion entrypoint: artifact-example templates: - name: artifact-example diff --git a/test/e2e/smoke/basic-2.yaml b/test/e2e/smoke/basic-2.yaml index d4a0a43d92c0..e6a89e000acb 100644 --- a/test/e2e/smoke/basic-2.yaml +++ b/test/e2e/smoke/basic-2.yaml @@ -5,6 +5,8 @@ metadata: labels: argo-e2e: true spec: + podGC: + strategy: OnPodCompletion entrypoint: run-workflow templates: - name: run-workflow diff --git a/test/e2e/smoke/basic.yaml b/test/e2e/smoke/basic.yaml index 16037cc6be06..6e52ee683cd0 100644 --- a/test/e2e/smoke/basic.yaml +++ b/test/e2e/smoke/basic.yaml @@ -5,6 +5,8 @@ metadata: labels: argo-e2e: true spec: + podGC: + strategy: OnPodCompletion entrypoint: run-workflow templates: - name: run-workflow diff --git a/test/e2e/smoke/hello-world-workflow-tmpl.yaml b/test/e2e/smoke/hello-world-workflow-tmpl.yaml index bf67292a1f3a..c3bc77a7b1e0 100644 --- a/test/e2e/smoke/hello-world-workflow-tmpl.yaml +++ b/test/e2e/smoke/hello-world-workflow-tmpl.yaml @@ -5,6 +5,8 @@ metadata: labels: argo-e2e: true spec: + podGC: + strategy: OnPodCompletion entrypoint: whalesay templates: - name: whalesay diff --git a/test/e2e/testdata/always-fail-1.yaml b/test/e2e/testdata/always-fail-1.yaml index 1b0e6e7608a1..165ba1a1c2a2 100644 --- a/test/e2e/testdata/always-fail-1.yaml +++ b/test/e2e/testdata/always-fail-1.yaml @@ -11,6 +11,8 @@ spec: successfulJobsHistoryLimit: 4 failedJobsHistoryLimit: 1 workflowSpec: + podGC: + strategy: OnPodCompletion entrypoint: whalesay templates: - name: whalesay diff --git a/test/e2e/testdata/always-fail-2.yaml b/test/e2e/testdata/always-fail-2.yaml index 14f03faee847..e78e0c88a12b 100644 --- a/test/e2e/testdata/always-fail-2.yaml +++ b/test/e2e/testdata/always-fail-2.yaml @@ -11,6 +11,8 @@ spec: successfulJobsHistoryLimit: 4 failedJobsHistoryLimit: 1 workflowSpec: + podGC: + strategy: OnPodCompletion entrypoint: whalesay templates: - name: whalesay diff --git a/test/e2e/testdata/always-succeed-1.yaml b/test/e2e/testdata/always-succeed-1.yaml index 388dbdfb8d5e..9ab9123d85c5 100644 --- a/test/e2e/testdata/always-succeed-1.yaml +++ b/test/e2e/testdata/always-succeed-1.yaml @@ -11,6 +11,8 @@ spec: successfulJobsHistoryLimit: 1 failedJobsHistoryLimit: 1 workflowSpec: + podGC: + strategy: OnPodCompletion entrypoint: whalesay templates: - name: whalesay diff --git a/test/e2e/testdata/basic-allow.yaml b/test/e2e/testdata/basic-allow.yaml index a441af4df4ee..d4be99fd0926 100644 --- a/test/e2e/testdata/basic-allow.yaml +++ b/test/e2e/testdata/basic-allow.yaml @@ -11,6 +11,8 @@ spec: successfulJobsHistoryLimit: 4 failedJobsHistoryLimit: 2 workflowSpec: + podGC: + strategy: OnPodCompletion entrypoint: whalesay templates: - name: whalesay diff --git a/test/e2e/testdata/basic-forbid.yaml b/test/e2e/testdata/basic-forbid.yaml index 21172a8e902f..ff63de3a2a88 100644 --- a/test/e2e/testdata/basic-forbid.yaml +++ b/test/e2e/testdata/basic-forbid.yaml @@ -11,6 +11,8 @@ spec: successfulJobsHistoryLimit: 4 failedJobsHistoryLimit: 2 workflowSpec: + podGC: + strategy: OnPodCompletion entrypoint: whalesay templates: - name: whalesay diff --git a/test/e2e/testdata/basic-replace.yaml b/test/e2e/testdata/basic-replace.yaml index 6eb6598b1c37..8d14c0367d74 100644 --- a/test/e2e/testdata/basic-replace.yaml +++ b/test/e2e/testdata/basic-replace.yaml @@ -11,6 +11,8 @@ spec: successfulJobsHistoryLimit: 4 failedJobsHistoryLimit: 2 workflowSpec: + podGC: + strategy: OnPodCompletion entrypoint: whalesay templates: - name: whalesay diff --git a/test/e2e/testdata/basic.yaml b/test/e2e/testdata/basic.yaml index a125c9cbdec0..2b7b24a3d03e 100644 --- a/test/e2e/testdata/basic.yaml +++ b/test/e2e/testdata/basic.yaml @@ -11,6 +11,8 @@ spec: successfulJobsHistoryLimit: 4 failedJobsHistoryLimit: 2 workflowSpec: + podGC: + strategy: OnPodCompletion entrypoint: whalesay templates: - name: whalesay