feat: update argo to 2.12.4 (WIP)

This commit is contained in:
Andrey Melnikov
2021-01-12 15:58:49 -08:00
parent 8799a79643
commit 5a66c278e4
6 changed files with 449 additions and 230 deletions

27
go.mod
View File

@@ -7,18 +7,17 @@ require (
github.com/Azure/go-autorest v14.0.0+incompatible // indirect
github.com/Azure/go-autorest/autorest/adal v0.8.2 // indirect
github.com/Masterminds/squirrel v1.1.0
github.com/argoproj/argo v0.0.0-20200331233432-4d1175eb68f6
github.com/argoproj/pkg v0.0.0-20200318225345-d3be5f29b1a8
github.com/argoproj/argo v0.0.0-20210112203504-f97bef5d0036
github.com/argoproj/pkg v0.2.0
github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535
github.com/elazarl/goproxy v0.0.0-20191011121108-aa519ddbe484 // indirect
github.com/evanphx/json-patch v4.5.0+incompatible // indirect
github.com/ghodss/yaml v1.0.0
github.com/go-sql-driver/mysql v1.5.0 // indirect
github.com/golang/protobuf v1.4.3
github.com/google/uuid v1.1.2
github.com/gorilla/handlers v1.4.2
github.com/grpc-ecosystem/go-grpc-middleware v1.2.0
github.com/grpc-ecosystem/grpc-gateway v1.14.4
github.com/grpc-ecosystem/grpc-gateway v1.14.6
github.com/grpc-ecosystem/grpc-gateway/v2 v2.0.1
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
@@ -28,11 +27,10 @@ require (
github.com/minio/minio-go/v6 v6.0.45
github.com/pkg/errors v0.9.1
github.com/pressly/goose v2.6.0+incompatible
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cobra v0.0.5 // indirect
github.com/stretchr/testify v1.4.0
github.com/sirupsen/logrus v1.6.0
github.com/stretchr/testify v1.6.1
github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc
golang.org/x/net v0.0.0-20200822124328-c89045814202
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43
google.golang.org/api v0.30.0
google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154
@@ -41,8 +39,15 @@ require (
gopkg.in/yaml.v2 v2.2.8
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
istio.io/api v0.0.0-20200107183329-ed4b507c54e1
k8s.io/api v0.16.4
k8s.io/apimachinery v0.16.7-beta.0
k8s.io/client-go v0.16.4
k8s.io/api v0.18.2
k8s.io/apimachinery v0.18.2
k8s.io/client-go v0.18.2
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e // indirect
sigs.k8s.io/yaml v1.2.0
)
replace (
k8s.io/api => k8s.io/api v0.17.8
k8s.io/apimachinery => k8s.io/apimachinery v0.17.8
k8s.io/client-go => k8s.io/client-go v0.17.8
)

600
go.sum

File diff suppressed because it is too large Load Diff

View File

@@ -354,7 +354,7 @@ func (c *Client) buildCronWorkflowDefinition(namespace string, workflowTemplateI
for _, param := range opts.Parameters {
newParams = append(newParams, wfv1.Parameter{
Name: param.Name,
Value: param.Value,
Value: wfv1.AnyStringPtr(*param.Value),
})
passedParams[param.Name] = true
}

View File

@@ -8,6 +8,8 @@ import (
"errors"
"fmt"
sq "github.com/Masterminds/squirrel"
"github.com/argoproj/argo/persist/sqldb"
"github.com/argoproj/argo/workflow/hydrator"
"github.com/google/uuid"
"github.com/onepanelio/core/pkg/util/gcs"
"github.com/onepanelio/core/pkg/util/label"
@@ -442,7 +444,7 @@ func (c *Client) createWorkflow(namespace string, workflowTemplateID uint64, wor
for _, param := range opts.Parameters {
newParams = append(newParams, wfv1.Parameter{
Name: param.Name,
Value: param.Value,
Value: wfv1.AnyStringPtr(*param.Value),
})
passedParams[param.Name] = true
}
@@ -467,7 +469,7 @@ func (c *Client) createWorkflow(namespace string, workflowTemplateID uint64, wor
for i := range wf.Spec.Arguments.Parameters {
param := wf.Spec.Arguments.Parameters[i]
if param.Name == "sys-name" {
uid, err := GenerateWorkspaceUID(*param.Value)
uid, err := GenerateWorkspaceUID(param.Value.String())
if err != nil {
return nil, err
}
@@ -482,7 +484,7 @@ func (c *Client) createWorkflow(namespace string, workflowTemplateID uint64, wor
if reErr != nil {
return nil, reErr
}
value := re.ReplaceAllString(*param.Value, namespace)
value := re.ReplaceAllString(param.Value.String(), namespace)
if workspaceUID != "" {
reWorkspaceUID, reErr := regexp.Compile(`{{\s*workspace.uid\s*}}`)
@@ -491,8 +493,7 @@ func (c *Client) createWorkflow(namespace string, workflowTemplateID uint64, wor
}
value = reWorkspaceUID.ReplaceAllString(value, workspaceUID)
}
param.Value = &value
param.Value = wfv1.AnyStringPtr(value)
}
newParameters = append(newParameters, param)
@@ -659,7 +660,10 @@ func (c *Client) injectAccessForSidecars(namespace string, wf *wfv1.Workflow) ([
virtualServiceNameUUID := "vs-" + uuid.New().String()
hosts := []string{serviceName}
wf.Spec.Templates[tIdx].Outputs.Parameters = append(wf.Spec.Templates[tIdx].Outputs.Parameters,
wfv1.Parameter{Name: "sys-sidecar-url--" + s.Name, Value: &serviceName},
wfv1.Parameter{
Name: "sys-sidecar-url--" + s.Name,
Value: wfv1.AnyStringPtr(serviceName),
},
)
virtualService := map[string]interface{}{
"apiVersion": "networking.istio.io/v1alpha3",
@@ -813,11 +817,12 @@ func (c *Client) ValidateWorkflowExecution(namespace string, manifest []byte) (e
}
wftmplGetter := templateresolution.WrapWorkflowTemplateInterface(c.ArgoprojV1alpha1().WorkflowTemplates(namespace))
clusterWftmplGetter := templateresolution.WrapClusterWorkflowTemplateInterface(c.ArgoprojV1alpha1().ClusterWorkflowTemplates())
for _, wf := range workflows {
if err = c.injectAutomatedFields(namespace, &wf, &WorkflowExecutionOptions{}); err != nil {
return err
}
_, err = validate.ValidateWorkflow(wftmplGetter, &wf, validate.ValidateOpts{})
_, err = validate.ValidateWorkflow(wftmplGetter, clusterWftmplGetter, &wf, validate.ValidateOpts{})
if err != nil {
return
}
@@ -1547,7 +1552,9 @@ func (c *Client) RetryWorkflowExecution(namespace, uid string) (workflow *Workfl
return
}
wf, err = argoutil.RetryWorkflow(c, c.ArgoprojV1alpha1().Workflows(namespace), wf)
hy := hydrator.New(sqldb.ExplosiveOffloadNodeStatusRepo)
wf, err = argoutil.RetryWorkflow(c, hy, c.ArgoprojV1alpha1().Workflows(namespace), uid, true, "")
workflow = typeWorkflow(wf)
@@ -1565,7 +1572,7 @@ func (c *Client) ResubmitWorkflowExecution(namespace, uid string) (workflow *Wor
return
}
wf, err = argoutil.SubmitWorkflow(c.ArgoprojV1alpha1().Workflows(namespace), c, namespace, wf, &argoutil.SubmitOpts{})
wf, err = argoutil.SubmitWorkflow(c.ArgoprojV1alpha1().Workflows(namespace), c, namespace, wf, &wfv1.SubmitOpts{})
if err != nil {
return
}
@@ -1576,7 +1583,8 @@ func (c *Client) ResubmitWorkflowExecution(namespace, uid string) (workflow *Wor
}
func (c *Client) ResumeWorkflowExecution(namespace, uid string) (workflow *WorkflowExecution, err error) {
err = argoutil.ResumeWorkflow(c.ArgoprojV1alpha1().Workflows(namespace), uid, "")
hy := hydrator.New(sqldb.ExplosiveOffloadNodeStatusRepo)
err = argoutil.ResumeWorkflow(c.ArgoprojV1alpha1().Workflows(namespace), hy, uid, "")
if err != nil {
return
}
@@ -1610,7 +1618,8 @@ func (c *Client) TerminateWorkflowExecution(namespace, uid string) (err error) {
return err
}
err = argoutil.StopWorkflow(c.ArgoprojV1alpha1().Workflows(namespace), uid, "", "")
hy := hydrator.New(sqldb.ExplosiveOffloadNodeStatusRepo)
err = argoutil.StopWorkflow(c.ArgoprojV1alpha1().Workflows(namespace), hy, uid, "", "")
return
}

View File

@@ -220,7 +220,7 @@ func (c *Client) createWorkspace(namespace string, parameters []byte, workspace
for i, p := range argoTemplate.Spec.Arguments.Parameters {
value := runtimeParametersMap[p.Name]
if value != nil {
argoTemplate.Spec.Arguments.Parameters[i].Value = value
argoTemplate.Spec.Arguments.Parameters[i].Value = wfv1.AnyStringPtr(*value)
}
}
@@ -428,7 +428,7 @@ func (c *Client) startWorkspace(namespace string, parameters []byte, workspace *
for i, p := range argoTemplate.Spec.Arguments.Parameters {
value := runtimeParametersMap[p.Name]
if value != nil {
argoTemplate.Spec.Arguments.Parameters[i].Value = value
argoTemplate.Spec.Arguments.Parameters[i].Value = wfv1.AnyStringPtr(*value)
}
}

View File

@@ -522,7 +522,10 @@ func unmarshalWorkflowTemplate(spec *WorkspaceSpec, serviceManifest, virtualServ
continue
}
volumeClaimItems = append(volumeClaimItems, wfv1.Item{Type: wfv1.String, StrVal: v.Name})
item := wfv1.Item{
Value: []byte(v.Name),
}
volumeClaimItems = append(volumeClaimItems, item)
volumeClaimsMapped[v.Name] = true
}
@@ -580,7 +583,7 @@ metadata:
Parameters: []wfv1.Parameter{
{
Name: "update-revision",
Value: ptr.String("{{tasks.create-stateful-set.outputs.parameters.update-revision}}"),
Value: wfv1.AnyStringPtr("{{tasks.create-stateful-set.outputs.parameters.update-revision}}"),
},
},
},
@@ -611,7 +614,7 @@ metadata:
Parameters: []wfv1.Parameter{
{
Name: "sys-pvc-name",
Value: ptr.String("{{item}}"),
Value: wfv1.AnyStringPtr("{{item}}"),
},
},
},
@@ -626,7 +629,7 @@ metadata:
Parameters: []wfv1.Parameter{
{
Name: "sys-workspace-phase",
Value: ptr.String(string(WorkspaceRunning)),
Value: wfv1.AnyStringPtr(WorkspaceRunning),
},
},
},
@@ -640,7 +643,7 @@ metadata:
Parameters: []wfv1.Parameter{
{
Name: "sys-workspace-phase",
Value: ptr.String(string(WorkspacePaused)),
Value: wfv1.AnyStringPtr(WorkspacePaused),
},
},
},
@@ -654,7 +657,7 @@ metadata:
Parameters: []wfv1.Parameter{
{
Name: "sys-workspace-phase",
Value: ptr.String(string(WorkspaceTerminated)),
Value: wfv1.AnyStringPtr(WorkspaceTerminated),
},
},
},