-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from kumarabd/kumarabd/feature/smi-grpc
added grpc and docker for smi-conformance
- Loading branch information
Showing
12 changed files
with
1,420 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM golang:1.14-alpine3.11 as build-img | ||
LABEL maintainer "Layer5.io" | ||
|
||
ENV GO111MODULE=off | ||
|
||
RUN apk update && apk add --no-cache git libc-dev gcc pkgconf && mkdir /home/meshery | ||
COPY ${PWD} /go/src/github.com/layer5io/learn-layer5/smi-conformance/ | ||
WORKDIR /go/src/github.com/layer5io/learn-layer5/smi-conformance/ | ||
# RUN git rev-parse HEAD > /home/meshery/version | ||
# RUN git describe --tags `git rev-list --tags --max-count=1` >> /home/com/version | ||
|
||
RUN go mod vendor && go build -a -ldflags "-s -w" -o /home/meshery/smi_conformance main.go | ||
|
||
FROM alpine:latest | ||
|
||
RUN apk --no-cache add ca-certificates | ||
COPY --from=build-img /home/meshery/** /home/ | ||
WORKDIR /home/ | ||
EXPOSE 10008 | ||
CMD ["sh","-c","./smi_conformance"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package conformance | ||
|
||
import ( | ||
context "context" | ||
|
||
"github.com/sirupsen/logrus" | ||
"google.golang.org/grpc" | ||
) | ||
|
||
// ConformanceClient represents a gRPC adapter client | ||
type ConformanceClient struct { | ||
CClient ConformanceTestingClient | ||
conn *grpc.ClientConn | ||
} | ||
|
||
// CreateClient creates a ConformanceClient for the given params | ||
func CreateClient(ctx context.Context, conformanceLocationURL string) (*ConformanceClient, error) { | ||
var opts []grpc.DialOption | ||
// creds, err := credentials.NewClientTLSFromFile(*caFile, *serverHostOverride) | ||
// if err != nil { | ||
// logrus.Errorf("Failed to create TLS credentials %v", err) | ||
// } | ||
// opts = append(opts, grpc.WithTransportCredentials(creds)) | ||
// } else { | ||
opts = append(opts, grpc.WithInsecure()) | ||
// } | ||
conn, err := grpc.Dial(conformanceLocationURL, opts...) | ||
if err != nil { | ||
logrus.Errorf("fail to dial: %v", err) | ||
} | ||
|
||
cClient := NewConformanceTestingClient(conn) | ||
|
||
return &ConformanceClient{ | ||
conn: conn, | ||
CClient: cClient, | ||
}, nil | ||
} | ||
|
||
// Close closes the ConformanceClient | ||
func (c *ConformanceClient) Close() error { | ||
if c.conn != nil { | ||
return c.conn.Close() | ||
} | ||
return nil | ||
} |
Oops, something went wrong.