Skip to content

Commit

Permalink
Revert "use insecure.NewCredentials"
Browse files Browse the repository at this point in the history
This reverts commit f57b6fe.

Signed-off-by: Dmitrii Ustiugov <[email protected]>
  • Loading branch information
ustiugov committed Apr 18, 2023
1 parent 52d02a3 commit c943da8
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 167 deletions.
3 changes: 1 addition & 2 deletions cri/cri_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
hpb "github.com/vhive-serverless/vhive/examples/protobuf/helloworld"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)

var (
Expand Down Expand Up @@ -186,7 +185,7 @@ func parallelInvoke(t *testing.T, functionURL string) {
}

func getClient(functionURL string) (hpb.GreeterClient, *grpc.ClientConn, error) {
conn, err := grpc.Dial(functionURL, grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := grpc.Dial(functionURL, grpc.WithBlock(), grpc.WithInsecure())
if err != nil {
return nil, nil, err
}
Expand Down
3 changes: 1 addition & 2 deletions cri/stock_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"time"

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

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

func getDialOpts() []grpc.DialOption {
return []grpc.DialOption{
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithInsecure(),
grpc.WithContextDialer(dialer),
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize)),
}
Expand Down
3 changes: 1 addition & 2 deletions examples/invoker/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

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

Expand Down Expand Up @@ -156,7 +155,7 @@ loop:
}

func SayHello(address, workflowID string) {
dialOptions := []grpc.DialOption{grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials())}
dialOptions := []grpc.DialOption{grpc.WithBlock(), grpc.WithInsecure()}
if *withTracing {
dialOptions = append(dialOptions, grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor()))
}
Expand Down
3 changes: 1 addition & 2 deletions examples/invoker/measure.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
log "github.com/sirupsen/logrus"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

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

Expand Down Expand Up @@ -53,7 +52,7 @@ func Start(tdbAddr string, endpoints []*endpoint.Endpoint, workflowIDs map[*endp
}
}

dialOptions := []grpc.DialOption{grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials())}
dialOptions := []grpc.DialOption{grpc.WithBlock(), grpc.WithInsecure()}
if *withTracing {
dialOptions = append(dialOptions, grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor()))
}
Expand Down
3 changes: 1 addition & 2 deletions function-images/tests/save_load_minio/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (

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

func main() {
Expand All @@ -58,7 +57,7 @@ func main() {
log.SetLevel(log.InfoLevel)
}

conn, err := grpc.Dial(*address, insecure.NewCredentials(), grpc.WithBlock())
conn, err := grpc.Dial(*address, grpc.WithInsecure(), grpc.WithBlock())
if err != nil {
log.Fatalf("did not connect: %v", err)
}
Expand Down
21 changes: 10 additions & 11 deletions functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/backoff"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/status"

"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
hpb "github.com/vhive-serverless/vhive/examples/protobuf/helloworld"
"github.com/vhive-serverless/vhive/metrics"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)

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

gopts := []grpc.DialOption{
grpc.WithBlock(),
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithInsecure(),
grpc.FailOnNonTempDialError(true),
grpc.WithConnectParams(connParams),
grpc.WithContextDialer(contextDialer),
Expand Down
44 changes: 42 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ replace (
)

require (
github.com/blend/go-sdk v1.20211025.3 // indirect
github.com/containerd/containerd v1.5.2
github.com/containerd/go-cni v1.1.4
github.com/davecgh/go-spew v1.1.1
Expand All @@ -62,7 +61,6 @@ require (
github.com/vhive-serverless/vhive/examples/protobuf/helloworld v0.0.0-00010101000000-000000000000
github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852
github.com/wcharczuk/go-chart v2.0.1+incompatible
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb // indirect
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8
Expand All @@ -71,3 +69,45 @@ require (
google.golang.org/grpc v1.34.0
k8s.io/cri-api v0.20.6
)

require (
github.com/Microsoft/go-winio v0.4.17 // indirect
github.com/Microsoft/hcsshim v0.8.16 // indirect
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af // indirect
github.com/blend/go-sdk v1.20211025.3 // indirect
github.com/containerd/cgroups v1.0.1 // indirect
github.com/containerd/continuity v0.1.0 // indirect
github.com/containerd/fifo v1.0.0 // indirect
github.com/containerd/ttrpc v1.0.2 // indirect
github.com/containerd/typeurl v1.0.2 // indirect
github.com/containernetworking/cni v1.0.1 // indirect
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
github.com/fogleman/gg v1.3.0 // indirect
github.com/go-fonts/liberation v0.1.1 // indirect
github.com/go-latex/latex v0.0.0-20210118124228-b3d85cf34e07 // indirect
github.com/gogo/googleapis v1.4.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/klauspost/compress v1.11.13 // indirect
github.com/koneu/natend v0.0.0-20150829182554-ec0926ea948d // indirect
github.com/mdlayher/netlink v0.0.0-20191009155606-de872b0d824b // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/sys/mountinfo v0.4.1 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/opencontainers/runc v1.0.0-rc93 // indirect
github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d // indirect
github.com/opencontainers/selinux v1.8.0 // indirect
github.com/phpdave11/gofpdf v1.4.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae // indirect
github.com/willf/bitset v1.1.11 // indirect
go.opencensus.io v0.22.4 // indirect
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 // indirect
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb // indirect
golang.org/x/text v0.3.5 // indirect
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit c943da8

Please sign in to comment.