mirror of
				https://github.com/onepanelio/onepanel.git
				synced 2025-10-31 16:56:19 +08:00 
			
		
		
		
	Compare commits
	
		
			3 Commits
		
	
	
		
			fix/contri
			...
			test-argo-
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | ccc90892c6 | ||
|   | c9588e7eb3 | ||
|   | 66b5e55e83 | 
							
								
								
									
										27
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								go.mod
									
									
									
									
									
								
							| @@ -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 | ||||
| ) | ||||
|   | ||||
| @@ -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 | ||||
| 		} | ||||
|   | ||||
| @@ -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) | ||||
| @@ -663,7 +664,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", | ||||
| @@ -817,11 +821,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 | ||||
| 		} | ||||
| @@ -1551,7 +1556,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) | ||||
|  | ||||
| @@ -1569,7 +1576,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 | ||||
| 	} | ||||
| @@ -1580,7 +1587,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 | ||||
| 	} | ||||
| @@ -1614,7 +1622,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 | ||||
| } | ||||
| @@ -1778,7 +1787,7 @@ func filterOutCustomTypesFromManifest(manifest []byte) (result []byte, err error | ||||
| 		return manifest, nil | ||||
| 	} | ||||
|  | ||||
| 	specMap, ok := spec.(map[string]interface{}) | ||||
| 	specMap, ok := spec.(map[interface{}]interface{}) | ||||
| 	if !ok { | ||||
| 		return manifest, nil | ||||
| 	} | ||||
| @@ -1788,7 +1797,7 @@ func filterOutCustomTypesFromManifest(manifest []byte) (result []byte, err error | ||||
| 		return manifest, nil | ||||
| 	} | ||||
|  | ||||
| 	argumentsMap, ok := arguments.(map[string]interface{}) | ||||
| 	argumentsMap, ok := arguments.(map[interface{}]interface{}) | ||||
| 	if !ok { | ||||
| 		return manifest, nil | ||||
| 	} | ||||
| @@ -1807,7 +1816,7 @@ func filterOutCustomTypesFromManifest(manifest []byte) (result []byte, err error | ||||
| 	parametersToKeep := make([]interface{}, 0) | ||||
|  | ||||
| 	for _, parameter := range parametersList { | ||||
| 		paramMap, ok := parameter.(map[string]interface{}) | ||||
| 		paramMap, ok := parameter.(map[interface{}]interface{}) | ||||
| 		if !ok { | ||||
| 			continue | ||||
| 		} | ||||
| @@ -1819,7 +1828,7 @@ func filterOutCustomTypesFromManifest(manifest []byte) (result []byte, err error | ||||
|  | ||||
| 		parametersToKeep = append(parametersToKeep, parameter) | ||||
|  | ||||
| 		keysToDelete := make([]string, 0) | ||||
| 		keysToDelete := make([]interface{}, 0) | ||||
| 		for key := range paramMap { | ||||
| 			if key != "name" && key != "value" { | ||||
| 				keysToDelete = append(keysToDelete, key) | ||||
|   | ||||
| @@ -224,7 +224,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) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| @@ -427,7 +427,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) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -522,8 +522,11 @@ func unmarshalWorkflowTemplate(spec *WorkspaceSpec, serviceManifest, virtualServ | ||||
| 				continue | ||||
| 			} | ||||
|  | ||||
| 			volumeClaimItems = append(volumeClaimItems, wfv1.Item{Type: wfv1.String, StrVal: v.Name}) | ||||
|  | ||||
| 			item, err := wfv1.ParseItem(fmt.Sprintf(`"%v"`, v.Name)) | ||||
| 			if err != nil { | ||||
| 				return "", err | ||||
| 			} | ||||
| 			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), | ||||
| 								}, | ||||
| 							}, | ||||
| 						}, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user