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/common/enum"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/resources"
|
"cloud.o-forge.io/core/oc-lib/models/resources"
|
||||||
w "cloud.o-forge.io/core/oc-lib/models/workflow"
|
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/nwtgck/go-fakelish"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"gopkg.in/yaml.v3"
|
"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
|
// 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
|
// the current Open Cloud instance. If true return the URL to contact the remote instance
|
||||||
// kube API
|
// kube API
|
||||||
|
|
||||||
func (b *ArgoBuilder) isProcessingReparted(processing resources.ProcessingResource) (bool,string) {
|
func (b *ArgoBuilder) isProcessingReparted(processing resources.ProcessingResource) (bool,string) {
|
||||||
processCreator := processing.CreatorID
|
processCreator := processing.CreatorID
|
||||||
// Creates an accessor srtictly for Peer Collection
|
// 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")
|
fmt.Print("TODO : handle error when converting PeerID")
|
||||||
}
|
}
|
||||||
|
|
||||||
isReparted, _ := peer.IsMySelf()
|
isNotReparted, _ := peer.IsMySelf()
|
||||||
if isReparted {
|
if !isNotReparted {
|
||||||
remoteCompute := b.retrieveProcessingCompute(processing)
|
// remoteCompute := b.retrieveProcessingCompute(processing)
|
||||||
computeInstance := remoteCompute.GetSelectedInstance()
|
// computeInstance := remoteCompute.GetSelectedInstance()
|
||||||
if computeInstance == nil {
|
// if computeInstance == nil {
|
||||||
fmt.Println("TODO: handle when retrieving instance")
|
// fmt.Println("TODO: handle when retrieving instance")
|
||||||
return false, ""
|
// return false, ""
|
||||||
}
|
// }
|
||||||
|
|
||||||
instance := computeInstance.(*resources.ComputeResourceInstance)
|
// instance := computeInstance.(*resources.ComputeResourceInstance)
|
||||||
return true, instance.Source
|
// 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, ""
|
return false, ""
|
||||||
|
Loading…
Reference in New Issue
Block a user