feat(client): changed instance naming conventions
Some checks failed
Go Tests / go-tests (push) Failing after 1m29s
Some checks failed
Go Tests / go-tests (push) Failing after 1m29s
This commit is contained in:
parent
90ceb69a18
commit
2145cec970
2 changed files with 29 additions and 22 deletions
28
lala/lala.go
28
lala/lala.go
|
|
@ -3,10 +3,9 @@ package main
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"edp.buildth.ing/DevFW-CICD/garm-provider-edge-connect/internal/client"
|
||||
"edp.buildth.ing/DevFW-CICD/garm-provider-edge-connect/provider"
|
||||
"github.com/cloudbase/garm-provider-common/params"
|
||||
)
|
||||
|
||||
var testManifest = `
|
||||
|
|
@ -53,14 +52,14 @@ spec:
|
|||
|
||||
func main() {
|
||||
ctx := context.TODO()
|
||||
e := client.EdgeConnect{
|
||||
/*e := client.EdgeConnect{
|
||||
BaseURL: "https://hub.apps.edge.platform.mg3.mdb.osc.live",
|
||||
HttpClient: &http.Client{},
|
||||
Credentials: client.Credentials{
|
||||
Username: os.Getenv("EDGEXR_USERNAME"),
|
||||
Password: os.Getenv("EDGEXR_PASSWORD"),
|
||||
},
|
||||
}
|
||||
}*/
|
||||
|
||||
/*e.DeleteAppInstance(ctx, client.AppInstanceKey{
|
||||
Organization: "edp-developer-framework",
|
||||
|
|
@ -145,18 +144,21 @@ func main() {
|
|||
fmt.Printf("appinst: %v\n", appinst)
|
||||
fmt.Printf("Error: %v\n", err)*/
|
||||
|
||||
//edgeprovider, err := provider.NewEdgeConnectProvider("/home/chris/ipcei/projects/garm-provider-edge-connect/config/config.toml", "lalacontroller")
|
||||
edgeprovider, _ := provider.NewEdgeConnectProvider("/home/chris/ipcei/projects/garm-provider-edge-connect/config/config.toml", "lalacontroller")
|
||||
//providerinst, err := edgeprovider.GetInstance(ctx, appinst.Key.Name)
|
||||
/*providerinst, err := edgeprovider.CreateInstance(ctx, params.BootstrapInstance{
|
||||
Name: "bootstrapparams",
|
||||
})*/
|
||||
|
||||
//err = edgeprovider.DeleteInstance(ctx, "Bootstrapparams")
|
||||
result, _ := e.ShowApps(ctx, client.AppKey{
|
||||
_, err := edgeprovider.CreateInstance(ctx, params.BootstrapInstance{
|
||||
Name: "bootstrapparams-2",
|
||||
PoolID: "123456",
|
||||
})
|
||||
|
||||
lists, err := edgeprovider.ListInstances(ctx, "123456")
|
||||
/*result, _ := e.ShowApps(ctx, client.AppKey{
|
||||
Organization: "edp-developer-framework",
|
||||
}, "EU")
|
||||
}, "EU")*/
|
||||
|
||||
fmt.Printf("%v", result)
|
||||
fmt.Printf("Lists: %v", lists)
|
||||
fmt.Printf("Error: %v", err)
|
||||
//ShowApps
|
||||
|
||||
//fmt.Printf("provider: %v\n", providerinst)
|
||||
|
|
|
|||
|
|
@ -65,14 +65,17 @@ type edgeConnectProvider struct {
|
|||
|
||||
// CreateInstance creates a new compute instance in the provider.
|
||||
func (a *edgeConnectProvider) CreateInstance(ctx context.Context, bootstrapParams params.BootstrapInstance) (params.ProviderInstance, error) {
|
||||
|
||||
instancename := fmt.Sprintf("garm-%v-%v", bootstrapParams.PoolID, bootstrapParams.Name)
|
||||
|
||||
podv1 := corev1.Pod{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "Pod",
|
||||
APIVersion: "v1",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: bootstrapParams.Name,
|
||||
Labels: map[string]string{"run": bootstrapParams.Name},
|
||||
Name: instancename,
|
||||
Labels: map[string]string{"run": instancename},
|
||||
},
|
||||
Spec: corev1.PodSpec{
|
||||
Containers: []corev1.Container{
|
||||
|
|
@ -98,7 +101,7 @@ func (a *edgeConnectProvider) CreateInstance(ctx context.Context, bootstrapParam
|
|||
APIVersion: "v1",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: bootstrapParams.Name,
|
||||
Name: instancename,
|
||||
},
|
||||
Spec: corev1.ServiceSpec{
|
||||
Type: corev1.ServiceTypeLoadBalancer,
|
||||
|
|
@ -110,7 +113,7 @@ func (a *edgeConnectProvider) CreateInstance(ctx context.Context, bootstrapParam
|
|||
TargetPort: intstr.FromInt(80),
|
||||
},
|
||||
},
|
||||
Selector: map[string]string{"run": bootstrapParams.Name},
|
||||
Selector: map[string]string{"run": instancename},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +134,7 @@ func (a *edgeConnectProvider) CreateInstance(ctx context.Context, bootstrapParam
|
|||
App: client.App{
|
||||
Key: client.AppKey{
|
||||
Organization: a.cfg.Organization,
|
||||
Name: bootstrapParams.Name,
|
||||
Name: instancename,
|
||||
Version: "0.0.1",
|
||||
},
|
||||
Deployment: "kubernetes",
|
||||
|
|
@ -155,12 +158,12 @@ func (a *edgeConnectProvider) CreateInstance(ctx context.Context, bootstrapParam
|
|||
AppInst: client.AppInstance{
|
||||
Key: client.AppInstanceKey{
|
||||
Organization: a.cfg.Organization,
|
||||
Name: bootstrapParams.Name,
|
||||
Name: instancename,
|
||||
CloudletKey: client.CloudletKey(a.cfg.CloudletKey),
|
||||
},
|
||||
AppKey: client.AppKey{
|
||||
Organization: a.cfg.Organization,
|
||||
Name: bootstrapParams.Name,
|
||||
Name: instancename,
|
||||
Version: "0.0.1",
|
||||
},
|
||||
Flavor: client.Flavor{
|
||||
|
|
@ -174,7 +177,7 @@ func (a *edgeConnectProvider) CreateInstance(ctx context.Context, bootstrapParam
|
|||
|
||||
instance := params.ProviderInstance{
|
||||
ProviderID: a.controllerID,
|
||||
Name: bootstrapParams.Name,
|
||||
Name: instancename,
|
||||
OSType: params.Linux,
|
||||
OSArch: params.Amd64,
|
||||
OSName: "lala",
|
||||
|
|
@ -259,7 +262,9 @@ func (a *edgeConnectProvider) ListInstances(ctx context.Context, poolID string)
|
|||
return nil, err
|
||||
}
|
||||
|
||||
myappintances := filter(apps, func(app client.AppInstance) bool { return strings.HasPrefix(app.Key.Name, poolID) })
|
||||
myappintances := filter(apps, func(app client.AppInstance) bool {
|
||||
return strings.HasPrefix(app.Key.Name, fmt.Sprintf("garm-%v", poolID))
|
||||
})
|
||||
|
||||
providerinstances := []params.ProviderInstance{}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue