removed the returned value from the callRemoteExecution method, all the resp handling is done inside it
This commit is contained in:
parent
a46708842b
commit
722a42e36d
@ -265,14 +265,49 @@ func (b *ArgoBuilder) addS3annotations(art *Artifact, template *Template, rw gra
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func (b *ArgoBuilder) addAuthInformation(storage *resources.StorageResource, namespace string, art *Artifact) {
|
||||||
|
|
||||||
|
sel := storage.GetSelectedInstance()
|
||||||
|
|
||||||
|
tool, err := tools2.NewService(conf.GetConfig().Mode)
|
||||||
|
if err != nil || tool == nil {
|
||||||
|
logger.Fatal().Msg("Could not create the access secret :" + err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
secretName, err := b.SetupS3Credentials(storage, namespace, tool) // this method return should be updated once we have decided how to retrieve credentials
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
art.S3.AccessKeySecret = &Secret{
|
||||||
|
Name: secretName,
|
||||||
|
Key: "access-key",
|
||||||
|
}
|
||||||
|
art.S3.SecretKeySecret = &Secret{
|
||||||
|
Name: secretName,
|
||||||
|
Key: "secret-key",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
art.S3.Key = strings.ReplaceAll(art.S3.Key, sel.(*resources.StorageResourceInstance).Source+"/", "")
|
||||||
|
art.S3.Key = strings.ReplaceAll(art.S3.Key, sel.(*resources.StorageResourceInstance).Source, "")
|
||||||
|
splits := strings.Split(art.S3.EndPoint, "/")
|
||||||
|
if len(splits) > 1 {
|
||||||
|
art.S3.Bucket = splits[0]
|
||||||
|
art.S3.EndPoint = strings.Join(splits[1:], "/")
|
||||||
|
} else {
|
||||||
|
art.S3.Bucket = splits[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (b *ArgoBuilder) SetupS3Credentials(storage *resources.StorageResource, namespace string, tool tools2.Tool) (string, error) {
|
func (b *ArgoBuilder) SetupS3Credentials(storage *resources.StorageResource, namespace string, tool tools2.Tool) (string, error) {
|
||||||
s := tool.GetS3Secret(storage.UUID, namespace)
|
s := tool.GetS3Secret(storage.UUID, namespace)
|
||||||
// var s *v1.Secret
|
// var s *v1.Secret
|
||||||
|
accessKey, secretKey := retrieveMinioCredential("peer",namespace)
|
||||||
|
|
||||||
if s == nil {
|
if s == nil {
|
||||||
id, err := tool.CreateAccessSecret(
|
id, err := tool.CreateAccessSecret(
|
||||||
"hF9wRGog75JuMdshWeEZ",
|
accessKey,
|
||||||
"OwXXJkVQyb5l1aVPdOegKOtDJGoP1dJYeo8O7mDW",
|
secretKey,
|
||||||
storage.UUID,
|
storage.UUID,
|
||||||
namespace,
|
namespace,
|
||||||
)
|
)
|
||||||
@ -289,45 +324,15 @@ func (b *ArgoBuilder) SetupS3Credentials(storage *resources.StorageResource, nam
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *ArgoBuilder) addAuthInformation(storage *resources.StorageResource, namespace string, art *Artifact) {
|
// This method needs to evolve to an API call to the peer passed as a parameter
|
||||||
|
func retrieveMinioCredential(peer string, namespace string) (string,string) {
|
||||||
sel := storage.GetSelectedInstance()
|
return "hF9wRGog75JuMdshWeEZ", "OwXXJkVQyb5l1aVPdOegKOtDJGoP1dJYeo8O7mDW"
|
||||||
|
|
||||||
tool, err := tools2.NewService(conf.GetConfig().Mode)
|
|
||||||
if err != nil || tool == nil {
|
|
||||||
logger.Fatal().Msg("Could not create the access secret :" + err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
secretName, err := b.SetupS3Credentials(storage, namespace, tool) // this method return should be updated once we have decided how to retrieve credentials
|
|
||||||
|
|
||||||
if err == nil {
|
|
||||||
art.S3.AccessKeySecret = &Secret{
|
|
||||||
Name: secretName,
|
|
||||||
Key: "access-key",
|
|
||||||
}
|
|
||||||
art.S3.SecretKeySecret = &Secret{
|
|
||||||
Name: secretName,
|
|
||||||
Key: "secret-key",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
art.S3.Key = strings.ReplaceAll(art.S3.Key, sel.(*resources.StorageResourceInstance).Source+"/", "")
|
|
||||||
art.S3.Key = strings.ReplaceAll(art.S3.Key, sel.(*resources.StorageResourceInstance).Source, "")
|
|
||||||
splits := strings.Split(art.S3.EndPoint, "/")
|
|
||||||
if len(splits) > 1 {
|
|
||||||
art.S3.Bucket = splits[0]
|
|
||||||
art.S3.EndPoint = strings.Join(splits[1:], "/")
|
|
||||||
} else {
|
|
||||||
art.S3.Bucket = splits[0]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func (b *ArgoBuilder) addTaskToArgo(dag *Dag, graphItemID string, processing *resources.ProcessingResource,
|
func (b *ArgoBuilder) addTaskToArgo(dag *Dag, graphItemID string, processing *resources.ProcessingResource,
|
||||||
firstItems []string, lastItems []string) (*Dag, []string, []string) {
|
firstItems []string, lastItems []string) (*Dag, []string, []string) {
|
||||||
unique_name := getArgoName(processing.GetName(), graphItemID)
|
unique_name := getArgoName(processing.GetName(), graphItemID)
|
||||||
step := Task{Name: unique_name, Template: unique_name}
|
step := Task{Name: unique_name, Template: unique_name}
|
||||||
instance := processing.GetSelectedInstance()
|
instance := processing.GetSelectedInstance()
|
||||||
if instance != nil {
|
if instance != nil {
|
||||||
for _, value := range instance.(*resources.ProcessingInstance).Env {
|
for _, value := range instance.(*resources.ProcessingInstance).Env {
|
||||||
@ -485,21 +490,21 @@ func (b *ArgoBuilder) retrieveProcessingCompute(graphID string) *resources.Compu
|
|||||||
// Execute the last actions once the YAML file for the Argo Workflow is created
|
// Execute the last actions once the YAML file for the Argo Workflow is created
|
||||||
func (b *ArgoBuilder) CompleteBuild(executionsId string) (string, error) {
|
func (b *ArgoBuilder) CompleteBuild(executionsId string) (string, error) {
|
||||||
logger.Info().Msg(fmt.Sprint("DEV :: Completing build"))
|
logger.Info().Msg(fmt.Sprint("DEV :: Completing build"))
|
||||||
setter := AdmiraltySetter{Id: executionsId}
|
// setter := AdmiraltySetter{Id: executionsId}
|
||||||
// Setup admiralty for each node
|
// // Setup admiralty for each node
|
||||||
for _, peer := range b.RemotePeers {
|
// for _, peer := range b.RemotePeers {
|
||||||
logger.Info().Msg(fmt.Sprint("DEV :: Launching Admiralty Setup for ", peer))
|
// logger.Info().Msg(fmt.Sprint("DEV :: Launching Admiralty Setup for ", peer))
|
||||||
setter.InitializeAdmiralty(conf.GetConfig().PeerID,peer)
|
// setter.InitializeAdmiralty(conf.GetConfig().PeerID,peer)
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Update the name of the admiralty node to use
|
// // Update the name of the admiralty node to use
|
||||||
for _, template := range b.Workflow.Spec.Templates {
|
// for _, template := range b.Workflow.Spec.Templates {
|
||||||
if len(template.Metadata.Annotations) > 0 {
|
// if len(template.Metadata.Annotations) > 0 {
|
||||||
if peerId, ok := template.Metadata.Annotations["multicluster.admiralty.io/clustername"]; ok {
|
// if peerId, ok := template.Metadata.Annotations["multicluster.admiralty.io/clustername"]; ok {
|
||||||
template.Metadata.Annotations["multicluster.admiralty.io/clustername"] = "target-" + peerId + "-" + conf.GetConfig().ExecutionID
|
// template.Metadata.Annotations["multicluster.admiralty.io/clustername"] = "target-" + peerId + "-" + conf.GetConfig().ExecutionID
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Generate the YAML file
|
// Generate the YAML file
|
||||||
random_name := fakelish.GenerateFakeWord(5, 8) + "-" + fakelish.GenerateFakeWord(5, 8)
|
random_name := fakelish.GenerateFakeWord(5, 8) + "-" + fakelish.GenerateFakeWord(5, 8)
|
||||||
|
Loading…
Reference in New Issue
Block a user