added calls to remote peer to setup admiralty
This commit is contained in:
parent
3fa2cd3336
commit
3f533a1bfb
@ -15,6 +15,7 @@ import (
|
||||
"cloud.o-forge.io/core/oc-lib/models/common/enum"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources"
|
||||
w "cloud.o-forge.io/core/oc-lib/models/workflow"
|
||||
"cloud.o-forge.io/core/oc-lib/tools"
|
||||
"github.com/nwtgck/go-fakelish"
|
||||
"github.com/rs/zerolog"
|
||||
"gopkg.in/yaml.v3"
|
||||
@ -338,7 +339,6 @@ func getArgoName(raw_name string, component_id string) (formatedName string) {
|
||||
// Verify if a processing resource is attached to another Compute than the one hosting
|
||||
// the current Open Cloud instance. If true return the URL to contact the remote instance
|
||||
// kube API
|
||||
|
||||
func (b *ArgoBuilder) isProcessingReparted(processing resources.ProcessingResource) (bool,string) {
|
||||
processCreator := processing.CreatorID
|
||||
// Creates an accessor srtictly for Peer Collection
|
||||
@ -360,17 +360,46 @@ func (b *ArgoBuilder) isProcessingReparted(processing resources.ProcessingResour
|
||||
fmt.Print("TODO : handle error when converting PeerID")
|
||||
}
|
||||
|
||||
isReparted, _ := peer.IsMySelf()
|
||||
if isReparted {
|
||||
remoteCompute := b.retrieveProcessingCompute(processing)
|
||||
computeInstance := remoteCompute.GetSelectedInstance()
|
||||
if computeInstance == nil {
|
||||
fmt.Println("TODO: handle when retrieving instance")
|
||||
return false, ""
|
||||
}
|
||||
isNotReparted, _ := peer.IsMySelf()
|
||||
if !isNotReparted {
|
||||
// remoteCompute := b.retrieveProcessingCompute(processing)
|
||||
// computeInstance := remoteCompute.GetSelectedInstance()
|
||||
// if computeInstance == nil {
|
||||
// fmt.Println("TODO: handle when retrieving instance")
|
||||
// return false, ""
|
||||
// }
|
||||
|
||||
instance := computeInstance.(*resources.ComputeResourceInstance)
|
||||
return true, instance.Source
|
||||
// instance := computeInstance.(*resources.ComputeResourceInstance)
|
||||
// return true, instance.Source
|
||||
//dataID == executionID
|
||||
caller := tools.NewHTTPCaller(
|
||||
map[tools.DataType]map[tools.METHOD]string{
|
||||
tools.ADMIRALTY_SOURCE: map[tools.METHOD]string{
|
||||
tools.POST : "/:id",
|
||||
},
|
||||
tools.ADMIRALTY_KUBECONFIG: map[tools.METHOD]string{
|
||||
tools.POST: "/:id",
|
||||
},
|
||||
tools.ADMIRALTY_SECRET: map[tools.METHOD]string{
|
||||
tools.POST: "/:id",
|
||||
},
|
||||
tools.ADMIRALTY_TARGET: map[tools.METHOD]string{
|
||||
tools.POST: "/:id",
|
||||
},
|
||||
tools.ADMIRALTY_NODES: map[tools.METHOD]string{
|
||||
tools.GET: "/id",
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
res, err := peer.LaunchPeerExecution(peer.UUID,"toto-5",tools.ADMIRALTY_SOURCE,tools.POST,nil,caller)
|
||||
if err != nil {
|
||||
fmt.Println("Error contacting remote peer")
|
||||
fmt.Println(err)
|
||||
panic(0)
|
||||
}
|
||||
fmt.Println(res)
|
||||
// peer.LaunchPeerExecution(peer.UUID,"toto-5",ADMIRALTY_TOKEN,tools.GET,nil,caller)
|
||||
}
|
||||
|
||||
return false, ""
|
||||
|
Loading…
Reference in New Issue
Block a user