Refactor + Multi admiralty test
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package models
|
||||
|
||||
import "gopkg.in/yaml.v3"
|
||||
|
||||
type ServiceResource struct {
|
||||
Action string `yaml:"action,omitempty"`
|
||||
SuccessCondition string `yaml:"successCondition,omitempty"`
|
||||
@@ -15,6 +17,24 @@ type Service struct {
|
||||
Spec ServiceSpec `yaml:"spec"`
|
||||
}
|
||||
|
||||
func (s *Service) BindToArgo(workflow *Workflow) error {
|
||||
service_manifest, err := yaml.Marshal(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
service_template := Template{Name: "workflow-service-pod",
|
||||
Resource: ServiceResource{
|
||||
Action: "create",
|
||||
SuccessCondition: "status.succeeded > 0",
|
||||
FailureCondition: "status.failed > 3",
|
||||
SetOwnerReference: true,
|
||||
Manifest: string(service_manifest),
|
||||
},
|
||||
}
|
||||
workflow.Spec.Templates = append(workflow.Spec.Templates, service_template)
|
||||
return nil
|
||||
}
|
||||
|
||||
type Metadata struct {
|
||||
Name string `yaml:"name"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user