Skip to content

Commit 23cd1fe

Browse files
committed
Revert "use insecure.NewCredentials"
This reverts commit f57b6fe. Signed-off-by: Dmitrii Ustiugov <dmitrii.ustiugov@ed.ac.uk>
1 parent 52d02a3 commit 23cd1fe

File tree

7 files changed

+46
-21
lines changed

7 files changed

+46
-21
lines changed

cri/cri_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import (
3737
hpb "github.com/vhive-serverless/vhive/examples/protobuf/helloworld"
3838
"golang.org/x/net/context"
3939
"google.golang.org/grpc"
40-
"google.golang.org/grpc/credentials/insecure"
4140
)
4241

4342
var (
@@ -186,7 +185,7 @@ func parallelInvoke(t *testing.T, functionURL string) {
186185
}
187186

188187
func getClient(functionURL string) (hpb.GreeterClient, *grpc.ClientConn, error) {
189-
conn, err := grpc.Dial(functionURL, grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials()))
188+
conn, err := grpc.Dial(functionURL, grpc.WithBlock(), grpc.WithInsecure())
190189
if err != nil {
191190
return nil, nil, err
192191
}

cri/stock_client.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"time"
2929

3030
"google.golang.org/grpc"
31-
"google.golang.org/grpc/credentials/insecure"
3231
criapi "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
3332
)
3433

@@ -70,7 +69,7 @@ func dialer(ctx context.Context, addr string) (net.Conn, error) {
7069

7170
func getDialOpts() []grpc.DialOption {
7271
return []grpc.DialOption{
73-
grpc.WithTransportCredentials(insecure.NewCredentials()),
72+
grpc.WithInsecure(),
7473
grpc.WithContextDialer(dialer),
7574
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize)),
7675
}

examples/invoker/client.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import (
3838
"github.com/google/uuid"
3939
log "github.com/sirupsen/logrus"
4040
"google.golang.org/grpc"
41-
"google.golang.org/grpc/credentials/insecure"
4241

4342
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
4443

@@ -156,7 +155,7 @@ loop:
156155
}
157156

158157
func SayHello(address, workflowID string) {
159-
dialOptions := []grpc.DialOption{grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials())}
158+
dialOptions := []grpc.DialOption{grpc.WithBlock(), grpc.WithInsecure()}
160159
if *withTracing {
161160
dialOptions = append(dialOptions, grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor()))
162161
}

examples/invoker/measure.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
log "github.com/sirupsen/logrus"
1010
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
1111
"google.golang.org/grpc"
12-
"google.golang.org/grpc/credentials/insecure"
1312

1413
"github.com/vhive-serverless/vhive/utils/benchmarking/eventing/proto"
1514

@@ -53,7 +52,7 @@ func Start(tdbAddr string, endpoints []*endpoint.Endpoint, workflowIDs map[*endp
5352
}
5453
}
5554

56-
dialOptions := []grpc.DialOption{grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials())}
55+
dialOptions := []grpc.DialOption{grpc.WithBlock(), grpc.WithInsecure()}
5756
if *withTracing {
5857
dialOptions = append(dialOptions, grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor()))
5958
}

function-images/tests/save_load_minio/client/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import (
3333

3434
pb "github.com/vhive-serverless/vhive/function-images/tests/save_load_minio/proto"
3535
"google.golang.org/grpc"
36-
"google.golang.org/grpc/credentials/insecure"
3736
)
3837

3938
func main() {
@@ -58,7 +57,7 @@ func main() {
5857
log.SetLevel(log.InfoLevel)
5958
}
6059

61-
conn, err := grpc.Dial(*address, insecure.NewCredentials(), grpc.WithBlock())
60+
conn, err := grpc.Dial(*address, grpc.WithInsecure(), grpc.WithBlock())
6261
if err != nil {
6362
log.Fatalf("did not connect: %v", err)
6463
}

functions.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,12 @@ import (
3838
"google.golang.org/grpc"
3939
"google.golang.org/grpc/backoff"
4040
"google.golang.org/grpc/codes"
41-
"google.golang.org/grpc/credentials/insecure"
4241
"google.golang.org/grpc/status"
4342

44-
"github.com/pkg/errors"
45-
log "github.com/sirupsen/logrus"
4643
hpb "github.com/vhive-serverless/vhive/examples/protobuf/helloworld"
4744
"github.com/vhive-serverless/vhive/metrics"
45+
"github.com/pkg/errors"
46+
log "github.com/sirupsen/logrus"
4847
)
4948

5049
var isTestMode bool // set with a call to NewFuncPool
@@ -222,13 +221,13 @@ func NewFunction(fID, imageName string, Stats *Stats, servedTh uint64, isToPin b
222221
// function instances when necessary.
223222
//
224223
// Synchronization description:
225-
// 1. Function needs to start an instance (with a unique vmID) if there are none: goroutines are synchronized with do.Once
226-
// 2. Function (that is not pinned) can serve only up to servedTh requests (controlled by a WeightedSemaphore)
227-
// a. The last goroutine needs to trigger the function's instance shutdown, then reset the semaphore,
228-
// allowing new goroutines to serve their requests.
229-
// b. The last goroutine is determined by the atomic counter: the goroutine with syncID==0 shuts down
230-
// the instance.
231-
// c. Instance shutdown is performed asynchronously because all instances have unique IDs.
224+
// 1. Function needs to start an instance (with a unique vmID) if there are none: goroutines are synchronized with do.Once
225+
// 2. Function (that is not pinned) can serve only up to servedTh requests (controlled by a WeightedSemaphore)
226+
// a. The last goroutine needs to trigger the function's instance shutdown, then reset the semaphore,
227+
// allowing new goroutines to serve their requests.
228+
// b. The last goroutine is determined by the atomic counter: the goroutine with syncID==0 shuts down
229+
// the instance.
230+
// c. Instance shutdown is performed asynchronously because all instances have unique IDs.
232231
func (f *Function) Serve(ctx context.Context, fID, imageName, reqPayload string) (*hpb.FwdHelloResp, *metrics.Metric, error) {
233232
var (
234233
serveMetric *metrics.Metric = metrics.NewMetric()
@@ -529,7 +528,7 @@ func (f *Function) getFuncClient() (hpb.GreeterClient, error) {
529528

530529
gopts := []grpc.DialOption{
531530
grpc.WithBlock(),
532-
grpc.WithTransportCredentials(insecure.NewCredentials()),
531+
grpc.WithInsecure(),
533532
grpc.FailOnNonTempDialError(true),
534533
grpc.WithConnectParams(connParams),
535534
grpc.WithContextDialer(contextDialer),

go.sum

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,10 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
12041204
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
12051205
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
12061206
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
1207+
<<<<<<< HEAD
1208+
=======
1209+
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
1210+
>>>>>>> parent of f57b6fe (use insecure.NewCredentials)
12071211
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
12081212
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
12091213
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -1219,8 +1223,11 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
12191223
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
12201224
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
12211225
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
1226+
<<<<<<< HEAD
12221227
golang.org/x/exp v0.0.0-20221031165847-c99f073a8326 h1:QfTh0HpN6hlw6D3vu8DAwC8pBIwikq0AI1evdm+FksE=
12231228
golang.org/x/exp v0.0.0-20221031165847-c99f073a8326/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
1229+
=======
1230+
>>>>>>> parent of f57b6fe (use insecure.NewCredentials)
12241231
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
12251232
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
12261233
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
@@ -1307,8 +1314,14 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
13071314
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
13081315
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
13091316
golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
1317+
<<<<<<< HEAD
13101318
golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU=
13111319
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
1320+
=======
1321+
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f h1:hEYJvxw1lSnWIl8X9ofsYMklzaDs90JI2az5YMd4fPM=
1322+
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
1323+
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
1324+
>>>>>>> parent of f57b6fe (use insecure.NewCredentials)
13121325
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
13131326
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
13141327
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -1328,8 +1341,11 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
13281341
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
13291342
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
13301343
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
1344+
<<<<<<< HEAD
13311345
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
13321346
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
1347+
=======
1348+
>>>>>>> parent of f57b6fe (use insecure.NewCredentials)
13331349
golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
13341350
golang.org/x/sys v0.0.0-20171026204733-164713f0dfce/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
13351351
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -1426,11 +1442,19 @@ golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBc
14261442
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
14271443
golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
14281444
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1445+
<<<<<<< HEAD
14291446
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
14301447
golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
14311448
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
14321449
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
14331450
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
1451+
=======
1452+
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
1453+
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1454+
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
1455+
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
1456+
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
1457+
>>>>>>> parent of f57b6fe (use insecure.NewCredentials)
14341458
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
14351459
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
14361460
golang.org/x/text v0.0.0-20170915090833-1cbadb444a80/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -1441,8 +1465,11 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
14411465
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
14421466
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
14431467
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
1468+
<<<<<<< HEAD
14441469
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
14451470
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
1471+
=======
1472+
>>>>>>> parent of f57b6fe (use insecure.NewCredentials)
14461473
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
14471474
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
14481475
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -1523,6 +1550,10 @@ golang.org/x/tools v0.0.0-20201204162204-73cf035baebf/go.mod h1:emZCQorbCU4vsT4f
15231550
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
15241551
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
15251552
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
1553+
<<<<<<< HEAD
1554+
=======
1555+
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
1556+
>>>>>>> parent of f57b6fe (use insecure.NewCredentials)
15261557
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
15271558
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
15281559
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

0 commit comments

Comments
 (0)