MCPcopy Create free account
hub / github.com/eth-easl/dirigent / Deployservice

Function Deployservice

async/fire.go:47–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45)
46
47func Deployservice() {
48 cpApi, err := common.NewControlPlaneConnection([]string{"127.0.0.1:9090"})
49 if err != nil {
50 logrus.Fatalf("Failed to start control plane connection (error %s)", err.Error())
51 }
52
53 ctx, cancel := context.WithTimeout(context.Background(), utils.GRPCFunctionTimeout)
54 defer cancel()
55
56 autoscalingConfig := autoscaling.NewDefaultAutoscalingMetadata(false)
57 autoscalingConfig.ScalingUpperBound = 1
58
59 resp, err := cpApi.RegisterService(ctx, &proto2.ServiceInfo{
60 Name: "test",
61 Image: "docker.io/cvetkovic/dirigent_empty_function:latest",
62 PortForwarding: &proto2.PortMapping{
63 GuestPort: 80,
64 Protocol: proto2.L4Protocol_TCP,
65 },
66 AutoscalingConfig: autoscalingConfig,
67 })
68
69 if err != nil || !resp.Success {
70 logrus.Errorf("Failed to deploy service")
71 }
72}
73
74var counter int32 = 0
75

Callers 1

mainFunction · 0.85

Calls 2

RegisterServiceMethod · 0.65

Tested by

no test coverage detected