()
| 45 | ) |
| 46 | |
| 47 | func 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 | |
| 74 | var counter int32 = 0 |
| 75 |
no test coverage detected