This commit is contained in:
mr 2024-11-12 09:10:33 +01:00
parent 5c64ed3549
commit 0331727bfd

View File

@ -13,7 +13,6 @@ import (
"time"
oclib "cloud.o-forge.io/core/oc-lib"
"cloud.o-forge.io/core/oc-lib/models/resources/compute"
"cloud.o-forge.io/core/oc-lib/models/resources/processing"
"cloud.o-forge.io/core/oc-lib/models/resources/workflow/graph"
w "cloud.o-forge.io/core/oc-lib/models/workflow"
@ -181,18 +180,6 @@ func (b *ArgoBuilder) createTemplates() ([]string, []string, []VolumeMount) {
return firstItems, lastItems, volumes
}
func (b *ArgoBuilder) getAllComputeFromProcessing(p *processing.ProcessingResource) []*compute.ComputeResource {
computeResources := []*compute.ComputeResource{}
for _, link := range b.OriginWorkflow.Graph.Links {
if link.Source.ID == p.GetID() && b.OriginWorkflow.Graph.Items[link.Destination.ID].Compute != nil {
computeResources = append(computeResources, b.OriginWorkflow.Graph.Items[link.Destination.ID].Compute)
} else if link.Destination.ID == p.GetID() && b.OriginWorkflow.Graph.Items[link.Source.ID].Compute != nil {
computeResources = append(computeResources, b.OriginWorkflow.Graph.Items[link.Source.ID].Compute)
}
}
return computeResources
}
func (b *ArgoBuilder) createArgoTemplates(id string,
processing *processing.ProcessingResource,
volumes []VolumeMount,
@ -202,11 +189,10 @@ func (b *ArgoBuilder) createArgoTemplates(id string,
template := &Template{Name: getArgoName(processing.GetName(), id)}
template.CreateContainer(processing, b.Workflow.getDag())
// get datacenter from the processing
computes := b.getAllComputeFromProcessing(processing)
for _, compute := range computes {
if processing.IsService {
b.CreateService(id, processing)
template.Metadata.Labels = make(map[string]string)
template.Metadata.Labels["app"] = "oc-service-" + processing.GetName() + "-" + compute.GetName() // Construct the template for the k8s service and add a link in graph between k8s service and processing
template.Metadata.Labels["app"] = "oc-service-" + processing.GetName() // Construct the template for the k8s service and add a link in graph between k8s service and processing
}
storages := b.OriginWorkflow.GetStoragesByRelatedProcessing(id)
for _, storage := range storages {