From b8f8005c7c01baf690eb5513b2a5b0c727ccb272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Sol=C3=A9?= Date: Thu, 15 Nov 2018 14:15:35 +0100 Subject: [PATCH] Removes the Flexvolume API. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc Solé --- Makefile | 13 - api/flexvolume/flexvolume.go | 159 --------- cmd/osd/main.go | 5 - hack/git-add-proto-generated.sh | 2 - pkg/flexvolume/api_server.go | 60 ---- pkg/flexvolume/client.go | 109 ------- pkg/flexvolume/cmd/flexvolume/main.go | 106 ------ pkg/flexvolume/flexvolume.go | 55 ---- pkg/flexvolume/flexvolume.pb.go | 443 -------------------------- pkg/flexvolume/flexvolume.pb.gw.go | 305 ------------------ pkg/flexvolume/flexvolume.proto | 57 ---- pkg/flexvolume/local_api_client.go | 35 -- vendor/vendor.json | 12 - 13 files changed, 1361 deletions(-) delete mode 100644 api/flexvolume/flexvolume.go delete mode 100644 pkg/flexvolume/api_server.go delete mode 100644 pkg/flexvolume/client.go delete mode 100644 pkg/flexvolume/cmd/flexvolume/main.go delete mode 100644 pkg/flexvolume/flexvolume.go delete mode 100644 pkg/flexvolume/flexvolume.pb.go delete mode 100644 pkg/flexvolume/flexvolume.pb.gw.go delete mode 100644 pkg/flexvolume/flexvolume.proto delete mode 100644 pkg/flexvolume/local_api_client.go diff --git a/Makefile b/Makefile index 51b8544ed..6096604e4 100644 --- a/Makefile +++ b/Makefile @@ -147,9 +147,6 @@ endif -I $(PROTOS_PATH)/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --swagger_out=logtostderr=true:$(PROTOSRC_PATH)/api/server/sdk \ $(PROTOSRC_PATH)/api/api.proto - @echo "Generating grpc protobuf definitions from pkg/flexvolume/flexvolume.proto" - $(PROTOC) -I/usr/local/include -I$(PROTOSRC_PATH) -I$(PROTOS_PATH)/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --go_out=plugins=grpc:. $(PROTOSRC_PATH)/pkg/flexvolume/flexvolume.proto - $(PROTOC) -I/usr/local/include -I$(PROTOSRC_PATH) -I$(PROTOS_PATH)/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --grpc-gateway_out=logtostderr=true:. $(PROTOSRC_PATH)/pkg/flexvolume/flexvolume.proto @echo "Generating protobuf definitions from pkg/jsonpb/testing/testing.proto" $(PROTOC) -I $(PROTOSRC_PATH) $(PROTOSRC_PATH)/pkg/jsonpb/testing/testing.proto --go_out=plugins=grpc:. @echo "Updating SDK versions" @@ -293,15 +290,6 @@ launch-local-btrfs: install sudo bash -x etc/btrfs/init.sh sudo $(shell which osd) -d -f etc/config/config_btrfs.yaml -install-flexvolume: - go install -a -tags "$(TAGS)" github.com/libopenstorage/openstorage/pkg/flexvolume github.com/libopenstorage/openstorage/pkg/flexvolume/cmd/flexvolume - -install-flexvolume-plugin: install-flexvolume - sudo rm -rf /usr/libexec/kubernetes/kubelet/volume/exec-plugins/openstorage~openstorage - sudo mkdir -p /usr/libexec/kubernetes/kubelet/volume/exec-plugins/openstorage~openstorage - sudo chmod 777 /usr/libexec/kubernetes/kubelet/volume/exec-plugins/openstorage~openstorage - cp $(GOPATH)/bin/flexvolume /usr/libexec/kubernetes/kubelet/volume/exec-plugins/openstorage~openstorage/openstorage - clean: $(OSDSANITY)-clean go clean -i $(PKGS) packr clean @@ -331,7 +319,6 @@ clean: $(OSDSANITY)-clean docker-build-osd \ launch \ launch-local-btrfs \ - install-flexvolume-plugin \ $(OSDSANITY)-install \ $(OSDSANITY)-clean \ clean \ diff --git a/api/flexvolume/flexvolume.go b/api/flexvolume/flexvolume.go deleted file mode 100644 index 656aaed69..000000000 --- a/api/flexvolume/flexvolume.go +++ /dev/null @@ -1,159 +0,0 @@ -package flexvolume - -import ( - "errors" - "fmt" - "math" - "net" - - "google.golang.org/grpc" - - "github.com/libopenstorage/openstorage/pkg/flexvolume" - "github.com/libopenstorage/openstorage/pkg/mount" - "github.com/libopenstorage/openstorage/volume" - "github.com/libopenstorage/openstorage/volume/drivers" - - "github.com/sirupsen/logrus" -) - -const ( - osdDriverKey = "osdDriver" - volumeIDKey = "volumeID" -) - -var ( - // ErrInvalidSpecDriver is returned when incorrect or no OSD driver is specified in spec file - ErrInvalidSpecDriver = errors.New("Invalid kubernetes spec file : No OSD driver specified in flexvolume") - // ErrInvalidSpecVolumeID is returned when incorrect or no volumeID is specified in spec file - ErrInvalidSpecVolumeID = errors.New("Invalid kubernetes spec file : No volumeID specified in flexvolume") - // ErrNoMountInfo is returned when flexvolume is unable to read from proc/self/mountinfo - ErrNoMountInfo = errors.New("Could not read mountpoints from /proc/self/mountinfo. ") - // ErrMissingMountPath is returned when no mountPath specified in mount call - ErrMissingMountPath = errors.New("Missing target mount path") - deviceDriverMap = make(map[string]string) -) - -type flexVolumeClient struct { - defaultDriver string -} - -func (c *flexVolumeClient) Init() error { - return nil -} - -func (c *flexVolumeClient) Attach(jsonOptions map[string]string) error { - driverName, ok := jsonOptions[osdDriverKey] - if !ok { - return ErrInvalidSpecDriver - } - driver, err := c.getVolumeDriver(driverName) - if err != nil { - return err - } - mountDevice, ok := jsonOptions[volumeIDKey] - if !ok { - return ErrInvalidSpecVolumeID - } - if _, err := driver.Attach(mountDevice, nil); err != nil { - return err - } - return nil -} - -func (c *flexVolumeClient) Detach(mountDevice string, options map[string]string) error { - driverName, ok := deviceDriverMap[mountDevice] - if !ok { - logrus.Infof("Could not find driver for (%v). Resorting to default driver ", mountDevice) - driverName = c.defaultDriver - } - driver, err := c.getVolumeDriver(driverName) - if err != nil { - return err - } - if err := driver.Detach(mountDevice, options); err != nil { - return err - } - return nil -} - -func (c *flexVolumeClient) Mount(targetMountDir string, mountDevice string, - jsonOptions map[string]string) error { - - driverName, ok := jsonOptions[osdDriverKey] - if !ok { - return ErrInvalidSpecDriver - } - driver, err := c.getVolumeDriver(driverName) - if err != nil { - return err - } - if targetMountDir == "" { - return ErrMissingMountPath - } - if err := driver.Mount(mountDevice, targetMountDir, jsonOptions); err != nil { - return err - } - // Update the deviceDriverMap - mountManager, err := mount.New(mount.DeviceMount, nil, []string{""}, nil, []string{}, "") - if err != nil { - logrus.Infof("Could not read mountpoints from /proc/self/mountinfo. Device - Driver mapping not saved!") - return nil - } - sourcePath, err := mountManager.GetSourcePath(targetMountDir) - if err != nil { - return fmt.Errorf("Mount Failed. Could not find mountpoint in /proc/self/mountinfo") - } - deviceDriverMap[sourcePath] = driverName - return nil -} - -func (c *flexVolumeClient) Unmount(mountDir string, options map[string]string) error { - // Get the mountDevice from mount manager - mountManager, err := mount.New(mount.DeviceMount, nil, []string{""}, nil, []string{}, "") - if err != nil { - return ErrNoMountInfo - } - mountDevice, err := mountManager.GetSourcePath(mountDir) - if err != nil { - return fmt.Errorf("Invalid mountDir (%v). No device mounted on this path", mountDir) - } - driverName, ok := deviceDriverMap[mountDevice] - if !ok { - logrus.Infof("Could not find driver for (%v). Resorting to default driver. ", mountDevice) - driverName = c.defaultDriver - } - driver, err := c.getVolumeDriver(driverName) - if err != nil { - return err - } - if err := driver.Unmount(mountDevice, mountDir, options); err != nil { - return err - } - return nil -} - -func newFlexVolumeClient(defaultDriver string) *flexVolumeClient { - return &flexVolumeClient{ - defaultDriver: defaultDriver, - } -} - -func (c *flexVolumeClient) getVolumeDriver(driverName string) (volume.VolumeDriver, error) { - return volumedrivers.Get(driverName) -} - -// StartFlexVolumeAPI starts the flexvolume API on the given port. -func StartFlexVolumeAPI(port uint16, defaultDriver string) error { - grpcServer := grpc.NewServer(grpc.MaxConcurrentStreams(math.MaxUint32)) - flexvolume.RegisterAPIServer(grpcServer, flexvolume.NewAPIServer(newFlexVolumeClient(defaultDriver))) - listener, err := net.Listen("tcp", fmt.Sprintf(":%d", port)) - if err != nil { - return err - } - go func() { - if err := grpcServer.Serve(listener); err != nil { - logrus.Errorln(err.Error()) - } - }() - return nil -} diff --git a/cmd/osd/main.go b/cmd/osd/main.go index ea348c8e0..5706a7b29 100644 --- a/cmd/osd/main.go +++ b/cmd/osd/main.go @@ -36,7 +36,6 @@ import ( "github.com/codegangsta/cli" "github.com/docker/docker/pkg/reexec" "github.com/libopenstorage/openstorage/api" - "github.com/libopenstorage/openstorage/api/flexvolume" "github.com/libopenstorage/openstorage/api/server" "github.com/libopenstorage/openstorage/api/server/sdk" osdcli "github.com/libopenstorage/openstorage/cli" @@ -354,10 +353,6 @@ func start(c *cli.Context) error { return fmt.Errorf("Invalid OSD config file: Default Driver specified but driver not initialized") } - if err := flexvolume.StartFlexVolumeAPI(config.FlexVolumePort, cfg.Osd.ClusterConfig.DefaultDriver); err != nil { - return fmt.Errorf("Unable to start flexvolume API: %v", err) - } - // Start the graph drivers. for d := range cfg.Osd.GraphDrivers { logrus.Infof("Starting graph driver: %v", d) diff --git a/hack/git-add-proto-generated.sh b/hack/git-add-proto-generated.sh index 6fe066878..a1ae997c4 100755 --- a/hack/git-add-proto-generated.sh +++ b/hack/git-add-proto-generated.sh @@ -2,6 +2,4 @@ # Simple script to add generated files from api.proto into their own commit git add api/api.pb.g* \ api/server/sdk/api/api.swagger.json \ - pkg/flexvolume/flexvolume.pb.go \ - pkg/flexvolume/flexvolume.pb.gw.go \ pkg/jsonpb/testing/testing.pb.go diff --git a/pkg/flexvolume/api_server.go b/pkg/flexvolume/api_server.go deleted file mode 100644 index a6c21bd92..000000000 --- a/pkg/flexvolume/api_server.go +++ /dev/null @@ -1,60 +0,0 @@ -package flexvolume - -import ( - "time" - - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/empty" - "github.com/sirupsen/logrus" - "golang.org/x/net/context" -) - -type apiServer struct { - client Client -} - -func newAPIServer(client Client) *apiServer { - return &apiServer{client} -} - -func (a *apiServer) Init(_ context.Context, _ *empty.Empty) (_ *empty.Empty, err error) { - defer func(start time.Time) { log("Init", nil, nil, err, time.Since(start)) }(time.Now()) - return checkClientError(a.client.Init()) -} - -func (a *apiServer) Attach(_ context.Context, request *AttachRequest) (_ *empty.Empty, err error) { - defer func(start time.Time) { log("Attach", request, nil, err, time.Since(start)) }(time.Now()) - return checkClientError(a.client.Attach(request.JsonOptions)) -} - -func (a *apiServer) Detach(_ context.Context, request *DetachRequest) (_ *empty.Empty, err error) { - defer func(start time.Time) { log("Detach", request, nil, err, time.Since(start)) }(time.Now()) - return checkClientError(a.client.Detach(request.MountDevice, nil)) -} - -func (a *apiServer) Mount(_ context.Context, request *MountRequest) (_ *empty.Empty, err error) { - defer func(start time.Time) { log("Mount", request, nil, err, time.Since(start)) }(time.Now()) - return checkClientError(a.client.Mount(request.TargetMountDir, request.MountDevice, request.JsonOptions)) -} - -func (a *apiServer) Unmount(_ context.Context, request *UnmountRequest) (_ *empty.Empty, err error) { - defer func(start time.Time) { log("Unmount", request, nil, err, time.Since(start)) }(time.Now()) - return checkClientError(a.client.Unmount(request.MountDir, nil)) -} - -func checkClientError(err error) (*empty.Empty, error) { - if err != nil { - return nil, err - } - return &empty.Empty{}, nil -} - -func log(methodName string, request proto.Message, response proto.Message, err error, duration time.Duration) { - if err != nil { - logrus.Errorf("Method: %v Request: %v Response: %v Error: %v Duration: %v", - methodName, request.String(), response.String(), err.Error(), duration.String()) - } else { - logrus.Infof("Method: %v Request: %v Response: %v Error: %v Duration: %v", - methodName, request.String(), response.String(), err.Error(), duration.String()) - } -} diff --git a/pkg/flexvolume/client.go b/pkg/flexvolume/client.go deleted file mode 100644 index 558c9482a..000000000 --- a/pkg/flexvolume/client.go +++ /dev/null @@ -1,109 +0,0 @@ -package flexvolume - -import ( - "fmt" - "os" - - "github.com/golang/protobuf/ptypes/empty" - "github.com/sirupsen/logrus" - "golang.org/x/net/context" -) - -type client struct { - apiClient APIClient -} - -const ( - volumeIDKey = "volumeID" -) - -var ( - successBytes = []byte(`{"Status":"Success"}`) -) - -func newClient(apiClient APIClient) *client { - return &client{apiClient} -} - -func (c *client) Init() error { - _, err := c.apiClient.Init( - context.Background(), - &empty.Empty{}, - ) - return err -} - -func (c *client) Attach(jsonOptions map[string]string) error { - _, err := c.apiClient.Attach( - context.Background(), - &AttachRequest{ - JsonOptions: jsonOptions, - }, - ) - if err == nil { - writeOutput(newAttachSuccessOutput(jsonOptions[volumeIDKey])) - } else { - writeOutput(newFailureBytes(err)) - } - return err -} - -func (c *client) Detach(mountDevice string, options map[string]string) error { - _, err := c.apiClient.Detach( - context.Background(), - &DetachRequest{ - MountDevice: mountDevice, - }, - ) - writeOutput(newOutput(err)) - return err -} - -func (c *client) Mount(targetMountDir string, mountDevice string, jsonOptions map[string]string) error { - if err := os.MkdirAll(targetMountDir, os.ModeDir); err != nil { - writeOutput(newOutput(err)) - return err - } - _, err := c.apiClient.Mount( - context.Background(), - &MountRequest{ - TargetMountDir: targetMountDir, - MountDevice: mountDevice, - JsonOptions: jsonOptions, - }, - ) - writeOutput(newOutput(err)) - return err -} - -func (c *client) Unmount(mountDir string, options map[string]string) error { - _, err := c.apiClient.Unmount( - context.Background(), - &UnmountRequest{ - MountDir: mountDir, - }, - ) - writeOutput(newOutput(err)) - return err -} - -func newFailureBytes(err error) []byte { - return []byte(fmt.Sprintf(`{"Status":"Failure", "Message":"%s"}`, err.Error())) -} - -func newOutput(err error) []byte { - if err != nil { - return newFailureBytes(err) - } - return successBytes -} - -func newAttachSuccessOutput(deviceID string) []byte { - return []byte(fmt.Sprintf(`{"Status":"Success", "Device":"%s"}`, deviceID)) -} - -func writeOutput(output []byte) { - if _, err := os.Stdout.Write(output); err != nil { - logrus.Warnf("Unable to write output to stdout : %s", err.Error()) - } -} diff --git a/pkg/flexvolume/cmd/flexvolume/main.go b/pkg/flexvolume/cmd/flexvolume/main.go deleted file mode 100644 index 50c8e4a32..000000000 --- a/pkg/flexvolume/cmd/flexvolume/main.go +++ /dev/null @@ -1,106 +0,0 @@ -package main - -import ( - "github.com/libopenstorage/openstorage/pkg/flexvolume" - "github.com/spf13/cobra" - "go.pedge.io/env" - "go.pedge.io/lion/env" - "go.pedge.io/pkg/cobra" - "google.golang.org/grpc" -) - -type appEnv struct { - OpenstorageAddress string `env:"OPENSTORAGE_ADDRESS,default=0.0.0.0:9005"` -} - -func main() { - env.Main(do, &appEnv{}) -} - -func do(appEnvObj interface{}) error { - appEnv := appEnvObj.(*appEnv) - if err := envlion.Setup(); err != nil { - return err - } - - initCmd := &cobra.Command{ - Use: "init", - Run: pkgcobra.RunFixedArgs(0, func(args []string) error { - client, err := getClient(appEnv) - if err != nil { - return err - } - return client.Init() - }), - } - - attachCmd := &cobra.Command{ - Use: "attach jsonOptions", - Run: pkgcobra.RunFixedArgs(1, func(args []string) error { - jsonOptions, err := flexvolume.BytesToJSONOptions([]byte(args[0])) - if err != nil { - return err - } - client, err := getClient(appEnv) - if err != nil { - return err - } - return client.Attach(jsonOptions) - }), - } - - detachCmd := &cobra.Command{ - Use: "detach mountDevice", - Run: pkgcobra.RunFixedArgs(1, func(args []string) error { - client, err := getClient(appEnv) - if err != nil { - return err - } - return client.Detach(args[0], nil) - }), - } - - mountCmd := &cobra.Command{ - Use: "mount targetMountDir mountDevice jsonOptions", - Run: pkgcobra.RunFixedArgs(3, func(args []string) error { - jsonOptions, err := flexvolume.BytesToJSONOptions([]byte(args[2])) - if err != nil { - return err - } - client, err := getClient(appEnv) - if err != nil { - return err - } - return client.Mount(args[0], args[1], jsonOptions) - }), - } - - unmountCmd := &cobra.Command{ - Use: "unmount mountDir", - Run: pkgcobra.RunFixedArgs(1, func(args []string) error { - client, err := getClient(appEnv) - if err != nil { - return err - } - return client.Unmount(args[0], nil) - }), - } - - rootCmd := &cobra.Command{ - Use: "app", - } - rootCmd.AddCommand(initCmd) - rootCmd.AddCommand(attachCmd) - rootCmd.AddCommand(detachCmd) - rootCmd.AddCommand(mountCmd) - rootCmd.AddCommand(unmountCmd) - return rootCmd.Execute() -} - -func getClient(appEnv *appEnv) (flexvolume.Client, error) { - clientConn, err := grpc.Dial(appEnv.OpenstorageAddress, grpc.WithInsecure()) - if err != nil { - return nil, err - } - return flexvolume.NewClient(flexvolume.NewAPIClient(clientConn)), nil -} diff --git a/pkg/flexvolume/flexvolume.go b/pkg/flexvolume/flexvolume.go deleted file mode 100644 index 974181f92..000000000 --- a/pkg/flexvolume/flexvolume.go +++ /dev/null @@ -1,55 +0,0 @@ -/* -Package flexvolume implements utility code for Kubernetes flexvolumes. - -https://github.com/kubernetes/kubernetes/pull/13840 -https://github.com/kubernetes/kubernetes/tree/master/examples/flexvolume -*/ -package flexvolume - -import "encoding/json" - -// Client is the client for a flexvolume implementation. -// -// It is both called from the wrapper cli tool, and implemented by a given implementation. -type Client interface { - Init() error - Attach(jsonOptions map[string]string) error - Detach(mountDevice string, options map[string]string) error - Mount(targetMountDir string, mountDevice string, jsonOptions map[string]string) error - Unmount(mountDir string, options map[string]string) error -} - -// NewClient returns a new Client for the given APIClient. -func NewClient(apiClient APIClient) Client { - return newClient(apiClient) -} - -// NewLocalAPIClient returns a new APIClient for the given APIServer. -func NewLocalAPIClient(apiServer APIServer) APIClient { - return newLocalAPIClient(apiServer) -} - -// NewAPIServer returns a new APIServer for the given Client. -func NewAPIServer(client Client) APIServer { - return newAPIServer(client) -} - -// BytesToJSONOptions converts a JSON string to a map of JSON options. -func BytesToJSONOptions(value []byte) (map[string]string, error) { - if value == nil || len(value) == 0 { - return nil, nil - } - m := make(map[string]string) - if err := json.Unmarshal(value, &m); err != nil { - return nil, err - } - return m, nil -} - -// JSONOptionsToBytes converts a map of JSON Options to a JSON string. -func JSONOptionsToBytes(jsonOptions map[string]string) ([]byte, error) { - if jsonOptions == nil || len(jsonOptions) == 0 { - return nil, nil - } - return json.Marshal(jsonOptions) -} diff --git a/pkg/flexvolume/flexvolume.pb.go b/pkg/flexvolume/flexvolume.pb.go deleted file mode 100644 index 021fb4893..000000000 --- a/pkg/flexvolume/flexvolume.pb.go +++ /dev/null @@ -1,443 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: pkg/flexvolume/flexvolume.proto - -package flexvolume - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import empty "github.com/golang/protobuf/ptypes/empty" -import _ "google.golang.org/genproto/googleapis/api/annotations" - -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type AttachRequest struct { - JsonOptions map[string]string `protobuf:"bytes,1,rep,name=json_options,json=jsonOptions" json:"json_options,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AttachRequest) Reset() { *m = AttachRequest{} } -func (m *AttachRequest) String() string { return proto.CompactTextString(m) } -func (*AttachRequest) ProtoMessage() {} -func (*AttachRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_flexvolume_503b7911b4b4c52f, []int{0} -} -func (m *AttachRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AttachRequest.Unmarshal(m, b) -} -func (m *AttachRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AttachRequest.Marshal(b, m, deterministic) -} -func (dst *AttachRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AttachRequest.Merge(dst, src) -} -func (m *AttachRequest) XXX_Size() int { - return xxx_messageInfo_AttachRequest.Size(m) -} -func (m *AttachRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AttachRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_AttachRequest proto.InternalMessageInfo - -func (m *AttachRequest) GetJsonOptions() map[string]string { - if m != nil { - return m.JsonOptions - } - return nil -} - -type DetachRequest struct { - MountDevice string `protobuf:"bytes,1,opt,name=mount_device,json=mountDevice" json:"mount_device,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DetachRequest) Reset() { *m = DetachRequest{} } -func (m *DetachRequest) String() string { return proto.CompactTextString(m) } -func (*DetachRequest) ProtoMessage() {} -func (*DetachRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_flexvolume_503b7911b4b4c52f, []int{1} -} -func (m *DetachRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DetachRequest.Unmarshal(m, b) -} -func (m *DetachRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DetachRequest.Marshal(b, m, deterministic) -} -func (dst *DetachRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DetachRequest.Merge(dst, src) -} -func (m *DetachRequest) XXX_Size() int { - return xxx_messageInfo_DetachRequest.Size(m) -} -func (m *DetachRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DetachRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DetachRequest proto.InternalMessageInfo - -func (m *DetachRequest) GetMountDevice() string { - if m != nil { - return m.MountDevice - } - return "" -} - -type MountRequest struct { - TargetMountDir string `protobuf:"bytes,1,opt,name=target_mount_dir,json=targetMountDir" json:"target_mount_dir,omitempty"` - MountDevice string `protobuf:"bytes,2,opt,name=mount_device,json=mountDevice" json:"mount_device,omitempty"` - JsonOptions map[string]string `protobuf:"bytes,3,rep,name=json_options,json=jsonOptions" json:"json_options,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MountRequest) Reset() { *m = MountRequest{} } -func (m *MountRequest) String() string { return proto.CompactTextString(m) } -func (*MountRequest) ProtoMessage() {} -func (*MountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_flexvolume_503b7911b4b4c52f, []int{2} -} -func (m *MountRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MountRequest.Unmarshal(m, b) -} -func (m *MountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MountRequest.Marshal(b, m, deterministic) -} -func (dst *MountRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_MountRequest.Merge(dst, src) -} -func (m *MountRequest) XXX_Size() int { - return xxx_messageInfo_MountRequest.Size(m) -} -func (m *MountRequest) XXX_DiscardUnknown() { - xxx_messageInfo_MountRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_MountRequest proto.InternalMessageInfo - -func (m *MountRequest) GetTargetMountDir() string { - if m != nil { - return m.TargetMountDir - } - return "" -} - -func (m *MountRequest) GetMountDevice() string { - if m != nil { - return m.MountDevice - } - return "" -} - -func (m *MountRequest) GetJsonOptions() map[string]string { - if m != nil { - return m.JsonOptions - } - return nil -} - -type UnmountRequest struct { - MountDir string `protobuf:"bytes,1,opt,name=mount_dir,json=mountDir" json:"mount_dir,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UnmountRequest) Reset() { *m = UnmountRequest{} } -func (m *UnmountRequest) String() string { return proto.CompactTextString(m) } -func (*UnmountRequest) ProtoMessage() {} -func (*UnmountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_flexvolume_503b7911b4b4c52f, []int{3} -} -func (m *UnmountRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UnmountRequest.Unmarshal(m, b) -} -func (m *UnmountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UnmountRequest.Marshal(b, m, deterministic) -} -func (dst *UnmountRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_UnmountRequest.Merge(dst, src) -} -func (m *UnmountRequest) XXX_Size() int { - return xxx_messageInfo_UnmountRequest.Size(m) -} -func (m *UnmountRequest) XXX_DiscardUnknown() { - xxx_messageInfo_UnmountRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_UnmountRequest proto.InternalMessageInfo - -func (m *UnmountRequest) GetMountDir() string { - if m != nil { - return m.MountDir - } - return "" -} - -func init() { - proto.RegisterType((*AttachRequest)(nil), "flexvolume.AttachRequest") - proto.RegisterMapType((map[string]string)(nil), "flexvolume.AttachRequest.JsonOptionsEntry") - proto.RegisterType((*DetachRequest)(nil), "flexvolume.DetachRequest") - proto.RegisterType((*MountRequest)(nil), "flexvolume.MountRequest") - proto.RegisterMapType((map[string]string)(nil), "flexvolume.MountRequest.JsonOptionsEntry") - proto.RegisterType((*UnmountRequest)(nil), "flexvolume.UnmountRequest") -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// Client API for API service - -type APIClient interface { - Init(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) - Attach(ctx context.Context, in *AttachRequest, opts ...grpc.CallOption) (*empty.Empty, error) - Detach(ctx context.Context, in *DetachRequest, opts ...grpc.CallOption) (*empty.Empty, error) - Mount(ctx context.Context, in *MountRequest, opts ...grpc.CallOption) (*empty.Empty, error) - Unmount(ctx context.Context, in *UnmountRequest, opts ...grpc.CallOption) (*empty.Empty, error) -} - -type aPIClient struct { - cc *grpc.ClientConn -} - -func NewAPIClient(cc *grpc.ClientConn) APIClient { - return &aPIClient{cc} -} - -func (c *aPIClient) Init(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := grpc.Invoke(ctx, "/flexvolume.API/Init", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *aPIClient) Attach(ctx context.Context, in *AttachRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := grpc.Invoke(ctx, "/flexvolume.API/Attach", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *aPIClient) Detach(ctx context.Context, in *DetachRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := grpc.Invoke(ctx, "/flexvolume.API/Detach", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *aPIClient) Mount(ctx context.Context, in *MountRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := grpc.Invoke(ctx, "/flexvolume.API/Mount", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *aPIClient) Unmount(ctx context.Context, in *UnmountRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := grpc.Invoke(ctx, "/flexvolume.API/Unmount", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for API service - -type APIServer interface { - Init(context.Context, *empty.Empty) (*empty.Empty, error) - Attach(context.Context, *AttachRequest) (*empty.Empty, error) - Detach(context.Context, *DetachRequest) (*empty.Empty, error) - Mount(context.Context, *MountRequest) (*empty.Empty, error) - Unmount(context.Context, *UnmountRequest) (*empty.Empty, error) -} - -func RegisterAPIServer(s *grpc.Server, srv APIServer) { - s.RegisterService(&_API_serviceDesc, srv) -} - -func _API_Init_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(APIServer).Init(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/flexvolume.API/Init", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(APIServer).Init(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _API_Attach_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AttachRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(APIServer).Attach(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/flexvolume.API/Attach", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(APIServer).Attach(ctx, req.(*AttachRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _API_Detach_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DetachRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(APIServer).Detach(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/flexvolume.API/Detach", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(APIServer).Detach(ctx, req.(*DetachRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _API_Mount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MountRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(APIServer).Mount(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/flexvolume.API/Mount", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(APIServer).Mount(ctx, req.(*MountRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _API_Unmount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UnmountRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(APIServer).Unmount(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/flexvolume.API/Unmount", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(APIServer).Unmount(ctx, req.(*UnmountRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _API_serviceDesc = grpc.ServiceDesc{ - ServiceName: "flexvolume.API", - HandlerType: (*APIServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Init", - Handler: _API_Init_Handler, - }, - { - MethodName: "Attach", - Handler: _API_Attach_Handler, - }, - { - MethodName: "Detach", - Handler: _API_Detach_Handler, - }, - { - MethodName: "Mount", - Handler: _API_Mount_Handler, - }, - { - MethodName: "Unmount", - Handler: _API_Unmount_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "pkg/flexvolume/flexvolume.proto", -} - -func init() { - proto.RegisterFile("pkg/flexvolume/flexvolume.proto", fileDescriptor_flexvolume_503b7911b4b4c52f) -} - -var fileDescriptor_flexvolume_503b7911b4b4c52f = []byte{ - // 436 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x92, 0x41, 0x6b, 0xdb, 0x30, - 0x14, 0xc7, 0xb1, 0xbd, 0xa4, 0xed, 0xb3, 0x53, 0x3c, 0x6d, 0x0c, 0xcf, 0x1d, 0xac, 0xd3, 0x29, - 0x2b, 0xcc, 0x82, 0xec, 0x32, 0x7a, 0x18, 0x14, 0x52, 0x58, 0x47, 0x4b, 0x87, 0x61, 0xe7, 0xe0, - 0xb6, 0x8a, 0xa7, 0xc4, 0x96, 0x3c, 0x5b, 0x0e, 0xcb, 0x75, 0x5f, 0x21, 0xf7, 0x7d, 0xa9, 0x7d, - 0x85, 0x5d, 0xf6, 0x2d, 0x86, 0x25, 0x9b, 0xd8, 0x09, 0x86, 0x5d, 0x7a, 0xb3, 0xfe, 0x7a, 0xef, - 0x67, 0xbd, 0xff, 0xfb, 0xc3, 0xeb, 0x6c, 0x19, 0x93, 0x79, 0x42, 0x7f, 0xac, 0x44, 0x52, 0xa6, - 0xb4, 0xf5, 0x19, 0x64, 0xb9, 0x90, 0x02, 0xc1, 0x56, 0xf1, 0x5f, 0xc5, 0x42, 0xc4, 0x09, 0x25, - 0x51, 0xc6, 0x48, 0xc4, 0xb9, 0x90, 0x91, 0x64, 0x82, 0x17, 0xba, 0xd2, 0x3f, 0xa9, 0x6f, 0xd5, - 0xe9, 0xae, 0x9c, 0x13, 0x9a, 0x66, 0x72, 0xad, 0x2f, 0xf1, 0x2f, 0x03, 0x46, 0x17, 0x52, 0x46, - 0xf7, 0xdf, 0x42, 0xfa, 0xbd, 0xa4, 0x85, 0x44, 0x37, 0xe0, 0x2c, 0x0a, 0xc1, 0x67, 0x22, 0x53, - 0x10, 0xcf, 0x38, 0xb5, 0xc6, 0xf6, 0xe4, 0x2c, 0x68, 0xbd, 0xa0, 0xd3, 0x10, 0x7c, 0x2e, 0x04, - 0xbf, 0xd5, 0xc5, 0x97, 0x5c, 0xe6, 0xeb, 0xd0, 0x5e, 0x6c, 0x15, 0xff, 0x23, 0xb8, 0xbb, 0x05, - 0xc8, 0x05, 0x6b, 0x49, 0xd7, 0x9e, 0x71, 0x6a, 0x8c, 0x8f, 0xc2, 0xea, 0x13, 0x3d, 0x87, 0xc1, - 0x2a, 0x4a, 0x4a, 0xea, 0x99, 0x4a, 0xd3, 0x87, 0x73, 0xf3, 0x83, 0x81, 0x27, 0x30, 0x9a, 0xd2, - 0xf6, 0xfb, 0xde, 0x80, 0x93, 0x8a, 0x92, 0xcb, 0xd9, 0x03, 0x5d, 0xb1, 0x7b, 0x5a, 0x53, 0x6c, - 0xa5, 0x4d, 0x95, 0x84, 0xff, 0x1a, 0xe0, 0xdc, 0x54, 0xe7, 0xa6, 0x67, 0x0c, 0xae, 0x8c, 0xf2, - 0x98, 0xca, 0x59, 0xdd, 0xca, 0xf2, 0xba, 0xef, 0x58, 0xeb, 0xaa, 0x7a, 0xca, 0xf2, 0x3d, 0xba, - 0xb9, 0x47, 0x47, 0xd7, 0x3b, 0x06, 0x59, 0xca, 0xa0, 0xb7, 0x6d, 0x83, 0xda, 0x3f, 0x7f, 0x64, - 0x7f, 0xde, 0xc1, 0xf1, 0x57, 0x9e, 0xb6, 0x87, 0x3d, 0x81, 0xa3, 0xdd, 0x29, 0x0f, 0xd3, 0x7a, - 0xbe, 0xc9, 0xc6, 0x02, 0xeb, 0xe2, 0xcb, 0x15, 0xfa, 0x04, 0x4f, 0xae, 0x38, 0x93, 0xe8, 0x45, - 0xa0, 0xd3, 0x11, 0x34, 0xe9, 0x08, 0x2e, 0xab, 0x74, 0xf8, 0x3d, 0x3a, 0x76, 0x7f, 0xfe, 0xfe, - 0xb3, 0x31, 0x01, 0x0f, 0x08, 0xe3, 0x4c, 0x9e, 0x1b, 0x67, 0xe8, 0x16, 0x86, 0x3a, 0x0f, 0xe8, - 0x65, 0x6f, 0x46, 0x7a, 0x71, 0x48, 0xe1, 0x1c, 0x7c, 0x40, 0x22, 0x55, 0x5f, 0x03, 0xf5, 0xc6, - 0xbb, 0xc0, 0x4e, 0x0a, 0xfe, 0x03, 0xf8, 0x40, 0x1b, 0xe0, 0x35, 0x0c, 0xd4, 0x42, 0x90, 0xd7, - 0xb7, 0xa3, 0x5e, 0xdc, 0x53, 0x85, 0xb3, 0xf1, 0x90, 0x28, 0x07, 0x2b, 0x5a, 0x08, 0x07, 0xb5, - 0xe1, 0xc8, 0x6f, 0xf3, 0xba, 0x5b, 0xe8, 0x25, 0x3e, 0x53, 0xc4, 0x11, 0x3e, 0x24, 0x25, 0x6f, - 0x98, 0x77, 0x43, 0x55, 0xf4, 0xfe, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd3, 0x30, 0xd3, 0x1a, - 0xf6, 0x03, 0x00, 0x00, -} diff --git a/pkg/flexvolume/flexvolume.pb.gw.go b/pkg/flexvolume/flexvolume.pb.gw.go deleted file mode 100644 index bd47ae60c..000000000 --- a/pkg/flexvolume/flexvolume.pb.gw.go +++ /dev/null @@ -1,305 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: pkg/flexvolume/flexvolume.proto - -/* -Package flexvolume is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package flexvolume - -import ( - "io" - "net/http" - - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/empty" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "golang.org/x/net/context" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/status" -) - -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray - -func request_API_Init_0(ctx context.Context, marshaler runtime.Marshaler, client APIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty - var metadata runtime.ServerMetadata - - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Init(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func request_API_Attach_0(ctx context.Context, marshaler runtime.Marshaler, client APIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq AttachRequest - var metadata runtime.ServerMetadata - - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Attach(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func request_API_Detach_0(ctx context.Context, marshaler runtime.Marshaler, client APIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq DetachRequest - var metadata runtime.ServerMetadata - - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Detach(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func request_API_Mount_0(ctx context.Context, marshaler runtime.Marshaler, client APIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MountRequest - var metadata runtime.ServerMetadata - - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Mount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func request_API_Unmount_0(ctx context.Context, marshaler runtime.Marshaler, client APIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UnmountRequest - var metadata runtime.ServerMetadata - - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Unmount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -// RegisterAPIHandlerFromEndpoint is same as RegisterAPIHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterAPIHandler(ctx, mux, conn) -} - -// RegisterAPIHandler registers the http handlers for service API to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterAPIHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterAPIHandlerClient(ctx, mux, NewAPIClient(conn)) -} - -// RegisterAPIHandler registers the http handlers for service API to "mux". -// The handlers forward requests to the grpc endpoint over the given implementation of "APIClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "APIClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "APIClient" to call the correct interceptors. -func RegisterAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client APIClient) error { - - mux.Handle("POST", pattern_API_Init_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_API_Init_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_API_Init_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_API_Attach_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_API_Attach_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_API_Attach_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_API_Detach_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_API_Detach_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_API_Detach_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_API_Mount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_API_Mount_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_API_Mount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_API_Unmount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_API_Unmount_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_API_Unmount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_API_Init_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"init"}, "")) - - pattern_API_Attach_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"attach"}, "")) - - pattern_API_Detach_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"detach"}, "")) - - pattern_API_Mount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"mount"}, "")) - - pattern_API_Unmount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"unmount"}, "")) -) - -var ( - forward_API_Init_0 = runtime.ForwardResponseMessage - - forward_API_Attach_0 = runtime.ForwardResponseMessage - - forward_API_Detach_0 = runtime.ForwardResponseMessage - - forward_API_Mount_0 = runtime.ForwardResponseMessage - - forward_API_Unmount_0 = runtime.ForwardResponseMessage -) diff --git a/pkg/flexvolume/flexvolume.proto b/pkg/flexvolume/flexvolume.proto deleted file mode 100644 index 736c89763..000000000 --- a/pkg/flexvolume/flexvolume.proto +++ /dev/null @@ -1,57 +0,0 @@ -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/protobuf/empty.proto"; - -package flexvolume; - -message AttachRequest { - map json_options = 1; -} - -message DetachRequest { - string mount_device = 1; -} - -message MountRequest { - string target_mount_dir = 1; - string mount_device = 2; - map json_options = 3; -} - -message UnmountRequest { - string mount_dir = 1; -} - -service API { - rpc Init(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/init" - body: "*" - }; - } - rpc Attach(AttachRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/attach" - body: "*" - }; - } - rpc Detach(DetachRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/detach" - body: "*" - }; - } - rpc Mount(MountRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/mount" - body: "*" - }; - } - rpc Unmount(UnmountRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/unmount" - body: "*" - }; - } -} diff --git a/pkg/flexvolume/local_api_client.go b/pkg/flexvolume/local_api_client.go deleted file mode 100644 index d8032547f..000000000 --- a/pkg/flexvolume/local_api_client.go +++ /dev/null @@ -1,35 +0,0 @@ -package flexvolume - -import ( - "github.com/golang/protobuf/ptypes/empty" - "golang.org/x/net/context" - "google.golang.org/grpc" -) - -type localAPIClient struct { - apiServer APIServer -} - -func newLocalAPIClient(apiServer APIServer) *localAPIClient { - return &localAPIClient{apiServer} -} - -func (l *localAPIClient) Init(ctx context.Context, request *empty.Empty, _ ...grpc.CallOption) (*empty.Empty, error) { - return l.apiServer.Init(ctx, request) -} - -func (l *localAPIClient) Attach(ctx context.Context, request *AttachRequest, _ ...grpc.CallOption) (*empty.Empty, error) { - return l.apiServer.Attach(ctx, request) -} - -func (l *localAPIClient) Detach(ctx context.Context, request *DetachRequest, _ ...grpc.CallOption) (*empty.Empty, error) { - return l.apiServer.Detach(ctx, request) -} - -func (l *localAPIClient) Mount(ctx context.Context, request *MountRequest, _ ...grpc.CallOption) (*empty.Empty, error) { - return l.apiServer.Mount(ctx, request) -} - -func (l *localAPIClient) Unmount(ctx context.Context, request *UnmountRequest, _ ...grpc.CallOption) (*empty.Empty, error) { - return l.apiServer.Unmount(ctx, request) -} diff --git a/vendor/vendor.json b/vendor/vendor.json index c9a5b6527..41231961d 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -1040,18 +1040,6 @@ "revision": "501049066d62fd28e88924d9820ddd4460396992", "revisionTime": "2016-07-01T21:55:24Z" }, - { - "checksumSHA1": "4owLcxwLFcNhxmUpDC5KR3duspU=", - "path": "github.com/libopenstorage/openstorage/pkg/flexvolume", - "revision": "501049066d62fd28e88924d9820ddd4460396992", - "revisionTime": "2016-07-01T21:55:24Z" - }, - { - "checksumSHA1": "dF/gRx2Ef4LdYaM4MDpjwxWYNjo=", - "path": "github.com/libopenstorage/openstorage/pkg/flexvolume/cmd/flexvolume", - "revision": "501049066d62fd28e88924d9820ddd4460396992", - "revisionTime": "2016-07-01T21:55:24Z" - }, { "checksumSHA1": "Fc+o+y2kCMu5szHTv5m4Q8S5by8=", "path": "github.com/libopenstorage/openstorage/pkg/jsonpb",