From 58599b813306cef47f478c9d577dd8acccb2122d Mon Sep 17 00:00:00 2001 From: Blaine Gardner Date: Fri, 12 Jul 2024 13:02:38 -0600 Subject: [PATCH 1/3] monorepo: move imported gRPC core files to ./proto Move the core required files for gRPC specification to ./proto directory. Do not make any file modifications at this point. Signed-off-by: Blaine Gardner --- {pkg/imported-grpc => proto}/.gitignore | 0 {pkg/imported-grpc => proto}/Makefile | 2 ++ {pkg/imported-grpc => proto}/README.md | 0 {pkg/imported-grpc => proto}/cosi.pb.go | 0 {pkg/imported-grpc => proto}/cosi.pb.json.go | 0 {pkg/imported-grpc => proto}/cosi.proto | 0 {pkg/imported-grpc => proto}/cosicomponents.png | Bin {pkg/imported-grpc => proto}/fake/cosi.pb.fake.go | 0 {pkg/imported-grpc => proto}/go.mod | 2 +- {pkg/imported-grpc => proto}/go.sum | 0 {pkg/imported-grpc => proto}/hack/fake-gen/main.go | 0 {pkg/imported-grpc => proto}/spec.md | 0 12 files changed, 3 insertions(+), 1 deletion(-) rename {pkg/imported-grpc => proto}/.gitignore (100%) rename {pkg/imported-grpc => proto}/Makefile (99%) rename {pkg/imported-grpc => proto}/README.md (100%) rename {pkg/imported-grpc => proto}/cosi.pb.go (100%) rename {pkg/imported-grpc => proto}/cosi.pb.json.go (100%) rename {pkg/imported-grpc => proto}/cosi.proto (100%) rename {pkg/imported-grpc => proto}/cosicomponents.png (100%) rename {pkg/imported-grpc => proto}/fake/cosi.pb.fake.go (100%) rename {pkg/imported-grpc => proto}/go.mod (89%) rename {pkg/imported-grpc => proto}/go.sum (100%) rename {pkg/imported-grpc => proto}/hack/fake-gen/main.go (100%) rename {pkg/imported-grpc => proto}/spec.md (100%) diff --git a/pkg/imported-grpc/.gitignore b/proto/.gitignore similarity index 100% rename from pkg/imported-grpc/.gitignore rename to proto/.gitignore diff --git a/pkg/imported-grpc/Makefile b/proto/Makefile similarity index 99% rename from pkg/imported-grpc/Makefile rename to proto/Makefile index d34cf5df..607d71fc 100644 --- a/pkg/imported-grpc/Makefile +++ b/proto/Makefile @@ -32,6 +32,8 @@ endif PROTOC_ARCH := $(shell uname -m) ifeq (i386,$(PROTOC_ARCH)) PROTOC_ARCH := x86_32 +else ifeq (arm64,$(PROTOC_ARCH)) +PROTOC_ARCH := aarch_64 endif PROTOC := ./protoc diff --git a/pkg/imported-grpc/README.md b/proto/README.md similarity index 100% rename from pkg/imported-grpc/README.md rename to proto/README.md diff --git a/pkg/imported-grpc/cosi.pb.go b/proto/cosi.pb.go similarity index 100% rename from pkg/imported-grpc/cosi.pb.go rename to proto/cosi.pb.go diff --git a/pkg/imported-grpc/cosi.pb.json.go b/proto/cosi.pb.json.go similarity index 100% rename from pkg/imported-grpc/cosi.pb.json.go rename to proto/cosi.pb.json.go diff --git a/pkg/imported-grpc/cosi.proto b/proto/cosi.proto similarity index 100% rename from pkg/imported-grpc/cosi.proto rename to proto/cosi.proto diff --git a/pkg/imported-grpc/cosicomponents.png b/proto/cosicomponents.png similarity index 100% rename from pkg/imported-grpc/cosicomponents.png rename to proto/cosicomponents.png diff --git a/pkg/imported-grpc/fake/cosi.pb.fake.go b/proto/fake/cosi.pb.fake.go similarity index 100% rename from pkg/imported-grpc/fake/cosi.pb.fake.go rename to proto/fake/cosi.pb.fake.go diff --git a/pkg/imported-grpc/go.mod b/proto/go.mod similarity index 89% rename from pkg/imported-grpc/go.mod rename to proto/go.mod index ad3d5439..abe1bc3f 100644 --- a/pkg/imported-grpc/go.mod +++ b/proto/go.mod @@ -1,4 +1,4 @@ -module sigs.k8s.io/container-object-storage-interface-spec +module sigs.k8s.io/container-object-storage-interface-api/proto go 1.18 diff --git a/pkg/imported-grpc/go.sum b/proto/go.sum similarity index 100% rename from pkg/imported-grpc/go.sum rename to proto/go.sum diff --git a/pkg/imported-grpc/hack/fake-gen/main.go b/proto/hack/fake-gen/main.go similarity index 100% rename from pkg/imported-grpc/hack/fake-gen/main.go rename to proto/hack/fake-gen/main.go diff --git a/pkg/imported-grpc/spec.md b/proto/spec.md similarity index 100% rename from pkg/imported-grpc/spec.md rename to proto/spec.md From 1bdaabae911f30854788202abef54891fd6dba8a Mon Sep 17 00:00:00 2001 From: Blaine Gardner Date: Fri, 12 Jul 2024 14:21:37 -0600 Subject: [PATCH 2/3] proto: fake-gen fix go deprecations Fix some package deprecations in proto/hack/fake-gen Signed-off-by: Blaine Gardner --- proto/hack/fake-gen/main.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/proto/hack/fake-gen/main.go b/proto/hack/fake-gen/main.go index 942d7717..c78fa62a 100644 --- a/proto/hack/fake-gen/main.go +++ b/proto/hack/fake-gen/main.go @@ -9,13 +9,13 @@ package main import ( "fmt" - "io/ioutil" + "io" "os" "strings" . "github.com/dave/jennifer/jen" - "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "google.golang.org/protobuf/proto" ) type GoFake struct { @@ -25,13 +25,13 @@ type GoFake struct { } type FakeService struct { - Name string + Name string Methods []Method } type Method struct { - Name string - Input string + Name string + Input string Output string } @@ -50,7 +50,7 @@ func (runner *GoFake) getLocationMessage() map[string][]*FakeService { for _, svc := range svcs { _, _ = fmt.Fprintf(os.Stderr, "service: %+v\n", svc) current := &FakeService{ - Name: fmt.Sprintf("%sClient", *svc.Name), + Name: fmt.Sprintf("%sClient", *svc.Name), } methods := make([]Method, 0) for _, mtd := range svc.Method { @@ -145,7 +145,7 @@ func main() { req := &plugin.CodeGeneratorRequest{} resp := &plugin.CodeGeneratorResponse{} - data, err := ioutil.ReadAll(os.Stdin) + data, err := io.ReadAll(os.Stdin) if err != nil { panic(err) } From 0ccbc06d06e19799ed1b0e1e71e18d33e4b54a3c Mon Sep 17 00:00:00 2001 From: Blaine Gardner Date: Fri, 12 Jul 2024 18:01:46 -0600 Subject: [PATCH 3/3] proto: update to latest grpc protobuf gen tools Modeled after: https://github.com/container-storage-interface/spec/pull/552 Update to the latest, non-deprecated versions of Google's tools for protobuf generation. Also update make tools to allow working with go modules outside of GOPATH, and to build on ARM-based Macbooks. New tools are significantly different from prior tools. Notably, the grpc plugin is no longer supported, so the `--go-gprc_out` flag is used, which moves some generated content from `cosi.pb.go` to a new `cosi_grpc.pb.go` file. We are still able to keep fake-gen by continuing to use deprecated tool versions for that purpose. There's a chance that it may not serve the COSI project long-term, but it should still work for now. Signed-off-by: Blaine Gardner --- proto/.gitignore | 3 - proto/Makefile | 226 +++----- proto/cosi.pb.go | 1004 +++++++++++++----------------------- proto/cosi.pb.json.go | 2 +- proto/cosi.proto | 10 +- proto/cosi_grpc.pb.go | 334 ++++++++++++ proto/fake/cosi.pb.fake.go | 22 +- proto/go.mod | 8 +- proto/go.sum | 14 +- proto/spec.md | 42 +- 10 files changed, 794 insertions(+), 871 deletions(-) create mode 100644 proto/cosi_grpc.pb.go diff --git a/proto/.gitignore b/proto/.gitignore index c105ac95..4dd2a6fb 100644 --- a/proto/.gitignore +++ b/proto/.gitignore @@ -2,9 +2,6 @@ .DS_Store .build *.swp -cosi.proto.tmp -protoc* -cosi.a .protoc .idea .project diff --git a/proto/Makefile b/proto/Makefile index 607d71fc..b9673e6e 100644 --- a/proto/Makefile +++ b/proto/Makefile @@ -21,7 +21,7 @@ export GOPATH # Only set PROTOC_VER if it has an empty value. ifeq (,$(strip $(PROTOC_VER))) -PROTOC_VER := 3.14.0 +PROTOC_VER := 27.2 endif PROTOC_OS := $(shell uname -s) @@ -36,11 +36,10 @@ else ifeq (arm64,$(PROTOC_ARCH)) PROTOC_ARCH := aarch_64 endif -PROTOC := ./protoc PROTOC_ZIP := protoc-$(PROTOC_VER)-$(PROTOC_OS)-$(PROTOC_ARCH).zip PROTOC_URL := https://github.com/protocolbuffers/protobuf/releases/download/v$(PROTOC_VER)/$(PROTOC_ZIP) PROTOC_TMP_DIR := .protoc -PROTOC_TMP_BIN := $(PROTOC_TMP_DIR)/bin/protoc +PROTOC := $(PROTOC_TMP_DIR)/bin/protoc PROTOC_TMP_INC := $(PROTOC_TMP_DIR)/include $(PROTOC): @@ -48,86 +47,19 @@ $(PROTOC): curl -L $(PROTOC_URL) -o "$(PROTOC_TMP_DIR)/$(PROTOC_ZIP)" && \ unzip -o "$(PROTOC_TMP_DIR)/$(PROTOC_ZIP)" -d "$(PROTOC_TMP_DIR)" && \ unzip -o "$(PROTOC_TMP_DIR)/$(PROTOC_ZIP)" -d "$(PROTOC_TMP_INC)/*" && \ - chmod 0755 "$(PROTOC_TMP_BIN)" && \ - cp -f "$(PROTOC_TMP_BIN)" "$@" + chmod 0755 "$@" stat "$@" > /dev/null 2>&1 +$(GOBIN)/protoc-gen-go: go.mod + go install google.golang.org/protobuf/cmd/protoc-gen-go -######################################################################## -## PROTOC-GEN-GO ## -######################################################################## - -# This is the recipe for getting and installing the go plug-in -# for protoc -PROTOC_GEN_GO_PKG := github.com/golang/protobuf/protoc-gen-go -PROTOC_GEN_GO := protoc-gen-go -$(PROTOC_GEN_GO): PROTOBUF_PKG := $(dir $(PROTOC_GEN_GO_PKG)) -$(PROTOC_GEN_GO): PROTOBUF_VERSION := v1.3.2 -$(PROTOC_GEN_GO): - mkdir -p $(dir $(GOPATH)/src/$(PROTOBUF_PKG)) - test -d $(GOPATH)/src/$(PROTOBUF_PKG)/.git || git clone https://$(PROTOBUF_PKG) $(GOPATH)/src/$(PROTOBUF_PKG) - (cd $(GOPATH)/src/$(PROTOBUF_PKG) && \ - (test "$$(git describe --tags | head -1)" = "$(PROTOBUF_VERSION)" || \ - (git fetch && git checkout tags/$(PROTOBUF_VERSION)))) - (cd $(GOPATH)/src/$(PROTOBUF_PKG) && go get -v -d $$(go list -f '{{ .ImportPath }}' ./...)) && \ - go build -o "$@" $(PROTOC_GEN_GO_PKG) +$(GOBIN)/protoc-gen-go-grpc: + go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0 +$(GOBIN)/protoc-gen-go-json: + go install github.com/mitchellh/protoc-gen-go-json@v1.1.0 -######################################################################## -## PROTOC-GEN-GO-JSON ## -######################################################################## - -# This is the recipe for getting and installing the json plug-in -# for protoc-gen-go -PROTOC_GEN_GO_JSON_PKG := github.com/mitchellh/protoc-gen-go-json -PROTOC_GEN_GO_JSON := protoc-gen-go-json -$(PROTOC_GEN_GO_JSON): PROTOC_GEN_GO_JSON_VERSION := v1.1.0 -$(PROTOC_GEN_GO_JSON): - mkdir -p $(dir $(GOPATH)/src/$(PROTOC_GEN_GO_JSON_PKG)) - test -d $(GOPATH)/src/$(PROTOC_GEN_GO_JSON_PKG)/.git || git clone https://$(PROTOC_GEN_GO_JSON_PKG) $(GOPATH)/src/$(PROTOC_GEN_GO_JSON_PKG) - (cd $(GOPATH)/src/$(PROTOC_GEN_GO_JSON_PKG) && \ - (test "$$(git describe --tags | head -1)" = "$(PROTOC_GEN_GO_JSON_VERSION)" || \ - (git fetch && git checkout tags/$(PROTOC_GEN_GO_JSON_VERSION)))) - (cd $(GOPATH)/src/$(PROTOC_GEN_GO_JSON_PKG) && go get -v -d $$(go list -f '{{ .ImportPath }}' ./...)) && \ - go build -o "$@" $(PROTOC_GEN_GO_JSON_PKG) - - -######################################################################## -## GEN-PROTO-GO ## -######################################################################## - -# This is the recipe for getting and installing the gen-proto pkg -# This is a dependency of grpc-go and must be installed before -# installing grpc-go. -GENPROTO_GO_SRC := github.com/googleapis/go-genproto -GENPROTO_GO_PKG := google.golang.org/genproto -GENPROTO_BUILD_GO := genproto-build-go -$(GENPROTO_BUILD_GO): GENPROTO_VERSION := 24fa4b261c55da65468f2abfdae2b024eef27dfb -$(GENPROTO_BUILD_GO): - mkdir -p $(dir $(GOPATH)/src/$(GENPROTO_GO_PKG)) - test -d $(GOPATH)/src/$(GENPROTO_GO_PKG)/.git || git clone https://$(GENPROTO_GO_SRC) $(GOPATH)/src/$(GENPROTO_GO_PKG) - (cd $(GOPATH)/src/$(GENPROTO_GO_PKG) && \ - (git fetch && git checkout $(GENPROTO_VERSION))) - (cd $(GOPATH)/src/$(GENPROTO_GO_PKG) && go get -v -d $$(go list -f '{{ .ImportPath }}' ./...)) - - -######################################################################## -## GRPC-GO ## -######################################################################## - -# This is the recipe for getting and installing the grpc go -GRPC_GO_SRC := github.com/grpc/grpc-go -GRPC_GO_PKG := google.golang.org/grpc -GRPC_BUILD_GO := grpc-build-go -$(GRPC_BUILD_GO): GRPC_VERSION := v1.26.0 -$(GRPC_BUILD_GO): - mkdir -p $(dir $(GOPATH)/src/$(GRPC_GO_PKG)) - test -d $(GOPATH)/src/$(GRPC_GO_PKG)/.git || git clone https://$(GRPC_GO_SRC) $(GOPATH)/src/$(GRPC_GO_PKG) - (cd $(GOPATH)/src/$(GRPC_GO_PKG) && \ - (test "$$(git describe --tags | head -1)" = "$(GRPC_VERSION)" || \ - (git fetch && git checkout tags/$(GRPC_VERSION)))) - (cd $(GOPATH)/src/$(GRPC_GO_PKG) && go get -v -d $$(go list -f '{{ .ImportPath }}' ./...) && \ - go build -o "$@" $(GRPC_GO_PKG)) +PROTOC_ALL := $(GOBIN)/protoc-gen-go $(GOBIN)/protoc-gen-go-grpc $(GOBIN)/protoc-gen-go-json $(PROTOC) ######################################################################## @@ -136,110 +68,68 @@ $(GRPC_BUILD_GO): # This is the recipe for getting and installing the grpc go PROTOC_GEN_GO_FAKE_SRC := ./hack/fake-gen -PROTOC_GEN_GO_FAKE := protoc-gen-gofake +PROTOC_GEN_GO_FAKE := $(PROTOC_TMP_DIR)/bin/protoc-gen-gofake $(PROTOC_GEN_GO_FAKE): go build -o $(PROTOC_GEN_GO_FAKE) $(PROTOC_GEN_GO_FAKE_SRC) - -######################################################################## -## PATH ## -######################################################################## - -# Update PATH with the current directory. This enables the protoc -# binary to discover the protoc-gen-go binary, built inside this -# directory. -export PATH := $(shell pwd):$(PATH) +# Update PATH to discover the protoc-gen-gofake binary +export PATH := $(PROTOC_TMP_DIR)/bin:$(PATH) ######################################################################## ## BUILD ## ######################################################################## -COSI_PROTO := ./cosi.proto COSI_SPEC := spec.md -COSI_PKG_ROOT := sigs.k8s.io/container-object-storage-interface-spec -COSI_PKG_SUB := . -COSI_BUILD := $(COSI_PKG_SUB)/.build -COSI_GO := $(COSI_PKG_SUB)/cosi.pb.go -COSI_GO_JSON := $(COSI_PKG_SUB)/cosi.pb.json.go -COSI_GO_FAKE := $(COSI_PKG_SUB)/fake/cosi.pb.fake.go -COSI_A := cosi.a -COSI_GO_TMP := $(COSI_BUILD)/$(COSI_PKG_ROOT)/cosi.pb.go -COSI_GO_JSON_TMP := $(COSI_BUILD)/$(COSI_PKG_ROOT)/cosi.pb.json.go -COSI_GO_FAKE_TMP := $(COSI_BUILD)/fake/$(COSI_PKG_ROOT)/cosi.pb.fake.go - -# This recipe generates the go language bindings to a temp area. -$(COSI_GO_TMP): HERE := $(shell pwd) -$(COSI_GO_TMP): PTYPES_PKG := github.com/golang/protobuf/ptypes -$(COSI_GO_TMP): GO_OUT := plugins=grpc -$(COSI_GO_TMP): GO_OUT := $(GO_OUT),Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor -$(COSI_GO_TMP): GO_OUT := $(GO_OUT),Mgoogle/protobuf/wrappers.proto=$(PTYPES_PKG)/wrappers -$(COSI_GO_TMP): GO_OUT := $(GO_OUT):"$(HERE)/$(COSI_BUILD)" -$(COSI_GO_TMP): GO_JSON_OUT := emit_defaults=true -$(COSI_GO_TMP): GO_JSON_OUT := $(GO_JSON_OUT):"$(HERE)/$(COSI_BUILD)" -$(COSI_GO_TMP): GO_FAKE_OUT := emit_defaults -$(COSI_GO_TMP): GO_FAKE_OUT := $(GO_FAKE_OUT),packagePath=sigs.k8s.io/container-object-storage-interface-spec -$(COSI_GO_TMP): GO_FAKE_OUT := $(GO_FAKE_OUT):"$(HERE)/$(COSI_BUILD)"/fake -$(COSI_GO_TMP): INCLUDE := -I$(GOPATH)/src -I$(HERE)/$(PROTOC_TMP_DIR)/include -$(COSI_GO_TMP): $(COSI_PROTO) | $(PROTOC) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_JSON) $(PROTOC_GEN_GO_FAKE) - @mkdir -p "$(@D)" - @mkdir -p "$(COSI_BUILD)/fake" - (cd "$(GOPATH)/src" && \ - $(HERE)/$(PROTOC) $(INCLUDE) --go_out=$(GO_OUT) --go-json_out=$(GO_JSON_OUT) --gofake_out=$(GO_FAKE_OUT) "$(COSI_PKG_ROOT)/$( /dev/null 2>&1 || cp -f "$?" "$@" -endif -# The temp language bindings are compared to the ones that are -# versioned. If they are different then it means the language -# bindings were not updated prior to being committed. -$(COSI_GO_JSON): $(COSI_GO_JSON_TMP) -ifeq (true,$(TRAVIS)) - diff "$@" "$?" -else - @mkdir -p "$(@D)" - diff "$@" "$?" > /dev/null 2>&1 || cp -f "$?" "$@" -endif +COSI_PROTO := ./cosi.proto +COSI_GO := ./cosi.pb.go +COSI_GO_GRPC := ./cosi_grpc.pb.go +COSI_GO_JSON := ./cosi.pb.json.go +COSI_GO_FAKE := ./fake/cosi.pb.fake.go -# The temp language bindings are compared to the ones that are -# versioned. If they are different then it means the language -# bindings were not updated prior to being committed. -$(COSI_GO_FAKE): $(COSI_GO_FAKE_TMP) -ifeq (true,$(TRAVIS)) - diff "$@" "$?" -else - @mkdir -p "$(@D)" - diff "$@" "$?" > /dev/null 2>&1 || cp -f "$?" "$@" -endif +BUILD_TMP_DIR := ./.build +BUILD_TMP_COSI_A := $(BUILD_TMP_DIR)/cosi.a +BUILD_PROTO_PATH := sigs.k8s.io/container-object-storage-interface-api/proto +BUILD_COSI_GO_TMP := $(BUILD_TMP_DIR)/$(BUILD_PROTO_PATH)/cosi.pb.go +BUILD_COSI_GO_GRPC_TMP := $(BUILD_TMP_DIR)/$(BUILD_PROTO_PATH)/cosi_grpc.pb.go +BUILD_COSI_GO_JSON_TMP := $(BUILD_TMP_DIR)/$(BUILD_PROTO_PATH)/cosi.pb.json.go +BUILD_COSI_GO_FAKE_TMP := $(BUILD_TMP_DIR)/fake/cosi.pb.fake.go -# This recipe builds the Go archive from the sources in three steps: -# -# 1. Go get any missing dependencies. -# 2. Cache the packages. -# 3. Build the archive file. -$(COSI_A): $(COSI_GO) $(COSI_GO_JSON) $(COSI_GO_FAKE) $(GENPROTO_BUILD_GO) $(GRPC_BUILD_GO) - go get -v -d ./... - go install ./$(COSI_PKG_SUB) - go build -o "$@" ./$(COSI_PKG_SUB) - -generate: +GO_JSON_OPTS := emit_defaults=true + +GO_FAKE_OPTS := emit_defaults +GO_FAKE_OPTS := $(GO_FAKE_OPTS),packagePath=sigs.k8s.io/container-object-storage-interface-api/proto + +$(COSI_PROTO): $(COSI_SPEC) echo "// Code generated by make; DO NOT EDIT." > "$(COSI_PROTO)" cat $(COSI_SPEC) | sed -n -e '/```protobuf$$/,/^```$$/ p' | sed '/^```/d' >> "$(COSI_PROTO)" -build: generate $(COSI_A) - -clean: +$(COSI_GO) $(COSI_GO_GRPC) $(COSI_GO_JSON) $(COSI_GO_FAKE): $(COSI_PROTO) $(PROTOC_ALL) $(PROTOC_GEN_GO_FAKE) + mkdir -p "$(BUILD_TMP_DIR)" + mkdir -p "$(BUILD_TMP_DIR)/fake" + $(PROTOC) -I. -I$(PROTOC_TMP_INC) \ + --go_out=$(BUILD_TMP_DIR) \ + --go-grpc_out=$(BUILD_TMP_DIR) \ + --go-json_out=$(GO_JSON_OPTS):$(BUILD_TMP_DIR) \ + --gofake_out=$(GO_FAKE_OPTS):$(BUILD_TMP_DIR)/fake \ + "$( cosi.v1alpha1.S3SignatureVersion 3, // 1: cosi.v1alpha1.Protocol.s3:type_name -> cosi.v1alpha1.S3 4, // 2: cosi.v1alpha1.Protocol.azureBlob:type_name -> cosi.v1alpha1.AzureBlob @@ -1512,13 +1500,13 @@ var file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_depIdxs 0, // [0:13] is the sub-list for field type_name } -func init() { file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() } -func file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() { - if File_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto != nil { +func init() { file_cosi_proto_init() } +func file_cosi_proto_init() { + if File_cosi_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_cosi_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*S3); i { case 0: return &v.state @@ -1530,7 +1518,7 @@ func file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() return nil } } - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_cosi_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*AzureBlob); i { case 0: return &v.state @@ -1542,7 +1530,7 @@ func file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() return nil } } - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_cosi_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*GCS); i { case 0: return &v.state @@ -1554,7 +1542,7 @@ func file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() return nil } } - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_cosi_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*Protocol); i { case 0: return &v.state @@ -1566,7 +1554,7 @@ func file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() return nil } } - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_cosi_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*CredentialDetails); i { case 0: return &v.state @@ -1578,7 +1566,7 @@ func file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() return nil } } - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_cosi_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*DriverGetInfoRequest); i { case 0: return &v.state @@ -1590,7 +1578,7 @@ func file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() return nil } } - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_cosi_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*DriverGetInfoResponse); i { case 0: return &v.state @@ -1602,7 +1590,7 @@ func file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() return nil } } - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_cosi_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*DriverCreateBucketRequest); i { case 0: return &v.state @@ -1614,7 +1602,7 @@ func file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() return nil } } - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_cosi_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*DriverCreateBucketResponse); i { case 0: return &v.state @@ -1626,7 +1614,7 @@ func file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() return nil } } - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_cosi_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*DriverDeleteBucketRequest); i { case 0: return &v.state @@ -1638,7 +1626,7 @@ func file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() return nil } } - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_cosi_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*DriverDeleteBucketResponse); i { case 0: return &v.state @@ -1650,7 +1638,7 @@ func file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() return nil } } - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_cosi_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*DriverGrantBucketAccessRequest); i { case 0: return &v.state @@ -1662,7 +1650,7 @@ func file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() return nil } } - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_cosi_proto_msgTypes[12].Exporter = func(v any, i int) any { switch v := v.(*DriverGrantBucketAccessResponse); i { case 0: return &v.state @@ -1674,7 +1662,7 @@ func file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() return nil } } - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_cosi_proto_msgTypes[13].Exporter = func(v any, i int) any { switch v := v.(*DriverRevokeBucketAccessRequest); i { case 0: return &v.state @@ -1686,7 +1674,7 @@ func file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() return nil } } - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_cosi_proto_msgTypes[14].Exporter = func(v any, i int) any { switch v := v.(*DriverRevokeBucketAccessResponse); i { case 0: return &v.state @@ -1699,7 +1687,7 @@ func file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() } } } - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_msgTypes[3].OneofWrappers = []interface{}{ + file_cosi_proto_msgTypes[3].OneofWrappers = []any{ (*Protocol_S3)(nil), (*Protocol_AzureBlob)(nil), (*Protocol_Gcs)(nil), @@ -1708,302 +1696,20 @@ func file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_init() out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_rawDesc, + RawDescriptor: file_cosi_proto_rawDesc, NumEnums: 3, NumMessages: 21, NumExtensions: 7, NumServices: 2, }, - GoTypes: file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_goTypes, - DependencyIndexes: file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_depIdxs, - EnumInfos: file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_enumTypes, - MessageInfos: file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_msgTypes, - ExtensionInfos: file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_extTypes, + GoTypes: file_cosi_proto_goTypes, + DependencyIndexes: file_cosi_proto_depIdxs, + EnumInfos: file_cosi_proto_enumTypes, + MessageInfos: file_cosi_proto_msgTypes, + ExtensionInfos: file_cosi_proto_extTypes, }.Build() - File_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto = out.File - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_rawDesc = nil - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_goTypes = nil - file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// 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.SupportPackageIsVersion6 - -// IdentityClient is the client API for Identity service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type IdentityClient interface { - // This call is meant to retrieve the unique provisioner Identity. - // This identity will have to be set in BucketClaim.DriverName field in order to invoke this specific provisioner. - DriverGetInfo(ctx context.Context, in *DriverGetInfoRequest, opts ...grpc.CallOption) (*DriverGetInfoResponse, error) -} - -type identityClient struct { - cc grpc.ClientConnInterface -} - -func NewIdentityClient(cc grpc.ClientConnInterface) IdentityClient { - return &identityClient{cc} -} - -func (c *identityClient) DriverGetInfo(ctx context.Context, in *DriverGetInfoRequest, opts ...grpc.CallOption) (*DriverGetInfoResponse, error) { - out := new(DriverGetInfoResponse) - err := c.cc.Invoke(ctx, "/cosi.v1alpha1.Identity/DriverGetInfo", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// IdentityServer is the server API for Identity service. -type IdentityServer interface { - // This call is meant to retrieve the unique provisioner Identity. - // This identity will have to be set in BucketClaim.DriverName field in order to invoke this specific provisioner. - DriverGetInfo(context.Context, *DriverGetInfoRequest) (*DriverGetInfoResponse, error) -} - -// UnimplementedIdentityServer can be embedded to have forward compatible implementations. -type UnimplementedIdentityServer struct { -} - -func (*UnimplementedIdentityServer) DriverGetInfo(context.Context, *DriverGetInfoRequest) (*DriverGetInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DriverGetInfo not implemented") -} - -func RegisterIdentityServer(s *grpc.Server, srv IdentityServer) { - s.RegisterService(&_Identity_serviceDesc, srv) -} - -func _Identity_DriverGetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DriverGetInfoRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(IdentityServer).DriverGetInfo(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosi.v1alpha1.Identity/DriverGetInfo", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(IdentityServer).DriverGetInfo(ctx, req.(*DriverGetInfoRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Identity_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosi.v1alpha1.Identity", - HandlerType: (*IdentityServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "DriverGetInfo", - Handler: _Identity_DriverGetInfo_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "sigs.k8s.io/container-object-storage-interface-spec/cosi.proto", -} - -// ProvisionerClient is the client API for Provisioner service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ProvisionerClient interface { - // This call is made to create the bucket in the backend. - // This call is idempotent - // 1. If a bucket that matches both name and parameters already exists, then OK (success) must be returned. - // 2. If a bucket by same name, but different parameters is provided, then the appropriate error code ALREADY_EXISTS must be returned. - DriverCreateBucket(ctx context.Context, in *DriverCreateBucketRequest, opts ...grpc.CallOption) (*DriverCreateBucketResponse, error) - // This call is made to delete the bucket in the backend. - // If the bucket has already been deleted, then no error should be returned. - DriverDeleteBucket(ctx context.Context, in *DriverDeleteBucketRequest, opts ...grpc.CallOption) (*DriverDeleteBucketResponse, error) - // This call grants access to an account. The account_name in the request shall be used as a unique identifier to create credentials. - // The account_id returned in the response will be used as the unique identifier for deleting this access when calling DriverRevokeBucketAccess. - DriverGrantBucketAccess(ctx context.Context, in *DriverGrantBucketAccessRequest, opts ...grpc.CallOption) (*DriverGrantBucketAccessResponse, error) - // This call revokes all access to a particular bucket from a principal. - DriverRevokeBucketAccess(ctx context.Context, in *DriverRevokeBucketAccessRequest, opts ...grpc.CallOption) (*DriverRevokeBucketAccessResponse, error) -} - -type provisionerClient struct { - cc grpc.ClientConnInterface -} - -func NewProvisionerClient(cc grpc.ClientConnInterface) ProvisionerClient { - return &provisionerClient{cc} -} - -func (c *provisionerClient) DriverCreateBucket(ctx context.Context, in *DriverCreateBucketRequest, opts ...grpc.CallOption) (*DriverCreateBucketResponse, error) { - out := new(DriverCreateBucketResponse) - err := c.cc.Invoke(ctx, "/cosi.v1alpha1.Provisioner/DriverCreateBucket", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *provisionerClient) DriverDeleteBucket(ctx context.Context, in *DriverDeleteBucketRequest, opts ...grpc.CallOption) (*DriverDeleteBucketResponse, error) { - out := new(DriverDeleteBucketResponse) - err := c.cc.Invoke(ctx, "/cosi.v1alpha1.Provisioner/DriverDeleteBucket", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *provisionerClient) DriverGrantBucketAccess(ctx context.Context, in *DriverGrantBucketAccessRequest, opts ...grpc.CallOption) (*DriverGrantBucketAccessResponse, error) { - out := new(DriverGrantBucketAccessResponse) - err := c.cc.Invoke(ctx, "/cosi.v1alpha1.Provisioner/DriverGrantBucketAccess", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *provisionerClient) DriverRevokeBucketAccess(ctx context.Context, in *DriverRevokeBucketAccessRequest, opts ...grpc.CallOption) (*DriverRevokeBucketAccessResponse, error) { - out := new(DriverRevokeBucketAccessResponse) - err := c.cc.Invoke(ctx, "/cosi.v1alpha1.Provisioner/DriverRevokeBucketAccess", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ProvisionerServer is the server API for Provisioner service. -type ProvisionerServer interface { - // This call is made to create the bucket in the backend. - // This call is idempotent - // 1. If a bucket that matches both name and parameters already exists, then OK (success) must be returned. - // 2. If a bucket by same name, but different parameters is provided, then the appropriate error code ALREADY_EXISTS must be returned. - DriverCreateBucket(context.Context, *DriverCreateBucketRequest) (*DriverCreateBucketResponse, error) - // This call is made to delete the bucket in the backend. - // If the bucket has already been deleted, then no error should be returned. - DriverDeleteBucket(context.Context, *DriverDeleteBucketRequest) (*DriverDeleteBucketResponse, error) - // This call grants access to an account. The account_name in the request shall be used as a unique identifier to create credentials. - // The account_id returned in the response will be used as the unique identifier for deleting this access when calling DriverRevokeBucketAccess. - DriverGrantBucketAccess(context.Context, *DriverGrantBucketAccessRequest) (*DriverGrantBucketAccessResponse, error) - // This call revokes all access to a particular bucket from a principal. - DriverRevokeBucketAccess(context.Context, *DriverRevokeBucketAccessRequest) (*DriverRevokeBucketAccessResponse, error) -} - -// UnimplementedProvisionerServer can be embedded to have forward compatible implementations. -type UnimplementedProvisionerServer struct { -} - -func (*UnimplementedProvisionerServer) DriverCreateBucket(context.Context, *DriverCreateBucketRequest) (*DriverCreateBucketResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DriverCreateBucket not implemented") -} -func (*UnimplementedProvisionerServer) DriverDeleteBucket(context.Context, *DriverDeleteBucketRequest) (*DriverDeleteBucketResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DriverDeleteBucket not implemented") -} -func (*UnimplementedProvisionerServer) DriverGrantBucketAccess(context.Context, *DriverGrantBucketAccessRequest) (*DriverGrantBucketAccessResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DriverGrantBucketAccess not implemented") -} -func (*UnimplementedProvisionerServer) DriverRevokeBucketAccess(context.Context, *DriverRevokeBucketAccessRequest) (*DriverRevokeBucketAccessResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DriverRevokeBucketAccess not implemented") -} - -func RegisterProvisionerServer(s *grpc.Server, srv ProvisionerServer) { - s.RegisterService(&_Provisioner_serviceDesc, srv) -} - -func _Provisioner_DriverCreateBucket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DriverCreateBucketRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProvisionerServer).DriverCreateBucket(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosi.v1alpha1.Provisioner/DriverCreateBucket", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProvisionerServer).DriverCreateBucket(ctx, req.(*DriverCreateBucketRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provisioner_DriverDeleteBucket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DriverDeleteBucketRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProvisionerServer).DriverDeleteBucket(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosi.v1alpha1.Provisioner/DriverDeleteBucket", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProvisionerServer).DriverDeleteBucket(ctx, req.(*DriverDeleteBucketRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provisioner_DriverGrantBucketAccess_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DriverGrantBucketAccessRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProvisionerServer).DriverGrantBucketAccess(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosi.v1alpha1.Provisioner/DriverGrantBucketAccess", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProvisionerServer).DriverGrantBucketAccess(ctx, req.(*DriverGrantBucketAccessRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provisioner_DriverRevokeBucketAccess_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DriverRevokeBucketAccessRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProvisionerServer).DriverRevokeBucketAccess(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosi.v1alpha1.Provisioner/DriverRevokeBucketAccess", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProvisionerServer).DriverRevokeBucketAccess(ctx, req.(*DriverRevokeBucketAccessRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Provisioner_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosi.v1alpha1.Provisioner", - HandlerType: (*ProvisionerServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "DriverCreateBucket", - Handler: _Provisioner_DriverCreateBucket_Handler, - }, - { - MethodName: "DriverDeleteBucket", - Handler: _Provisioner_DriverDeleteBucket_Handler, - }, - { - MethodName: "DriverGrantBucketAccess", - Handler: _Provisioner_DriverGrantBucketAccess_Handler, - }, - { - MethodName: "DriverRevokeBucketAccess", - Handler: _Provisioner_DriverRevokeBucketAccess_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "sigs.k8s.io/container-object-storage-interface-spec/cosi.proto", + File_cosi_proto = out.File + file_cosi_proto_rawDesc = nil + file_cosi_proto_goTypes = nil + file_cosi_proto_depIdxs = nil } diff --git a/proto/cosi.pb.json.go b/proto/cosi.pb.json.go index 8d30f4fc..e786f8e9 100644 --- a/proto/cosi.pb.json.go +++ b/proto/cosi.pb.json.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go-json. DO NOT EDIT. -// source: sigs.k8s.io/container-object-storage-interface-spec/cosi.proto +// source: cosi.proto package cosi diff --git a/proto/cosi.proto b/proto/cosi.proto index ca55a5ff..4c446b34 100644 --- a/proto/cosi.proto +++ b/proto/cosi.proto @@ -4,7 +4,7 @@ package cosi.v1alpha1; import "google/protobuf/descriptor.proto"; -option go_package = "sigs.k8s.io/container-object-storage-interface-spec;cosi"; +option go_package = "sigs.k8s.io/container-object-storage-interface-api/proto;cosi"; extend google.protobuf.EnumOptions { // Indicates that this enum is OPTIONAL and part of an experimental @@ -166,7 +166,7 @@ message DriverCreateBucketRequest { } message DriverCreateBucketResponse { - // bucket_id returned here is expected to be the globally unique + // bucket_id returned here is expected to be the globally unique // identifier for the bucket in the object storage provider. string bucket_id = 1; @@ -178,7 +178,7 @@ message DriverCreateBucketResponse { message DriverDeleteBucketRequest { // This field is REQUIRED // bucket_id is a globally unique identifier for the bucket - // in the object storage provider + // in the object storage provider string bucket_id = 1; // This field is OPTIONAL @@ -194,7 +194,7 @@ message DriverDeleteBucketResponse { message DriverGrantBucketAccessRequest { // This field is REQUIRED // bucket_id is a globally unique identifier for the bucket - // in the object storage provider + // in the object storage provider string bucket_id = 1; // This field is REQUIRED @@ -215,7 +215,7 @@ message DriverGrantBucketAccessRequest { message DriverGrantBucketAccessResponse { // This field is REQUIRED // This is the account_id that is being provided access. This will - // be required later to revoke access. + // be required later to revoke access. string account_id = 1; // This field is REQUIRED diff --git a/proto/cosi_grpc.pb.go b/proto/cosi_grpc.pb.go new file mode 100644 index 00000000..63437eca --- /dev/null +++ b/proto/cosi_grpc.pb.go @@ -0,0 +1,334 @@ +// Code generated by make; DO NOT EDIT. + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v5.27.2 +// source: cosi.proto + +package cosi + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Identity_DriverGetInfo_FullMethodName = "/cosi.v1alpha1.Identity/DriverGetInfo" +) + +// IdentityClient is the client API for Identity service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type IdentityClient interface { + // This call is meant to retrieve the unique provisioner Identity. + // This identity will have to be set in BucketClaim.DriverName field in order to invoke this specific provisioner. + DriverGetInfo(ctx context.Context, in *DriverGetInfoRequest, opts ...grpc.CallOption) (*DriverGetInfoResponse, error) +} + +type identityClient struct { + cc grpc.ClientConnInterface +} + +func NewIdentityClient(cc grpc.ClientConnInterface) IdentityClient { + return &identityClient{cc} +} + +func (c *identityClient) DriverGetInfo(ctx context.Context, in *DriverGetInfoRequest, opts ...grpc.CallOption) (*DriverGetInfoResponse, error) { + out := new(DriverGetInfoResponse) + err := c.cc.Invoke(ctx, Identity_DriverGetInfo_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// IdentityServer is the server API for Identity service. +// All implementations must embed UnimplementedIdentityServer +// for forward compatibility +type IdentityServer interface { + // This call is meant to retrieve the unique provisioner Identity. + // This identity will have to be set in BucketClaim.DriverName field in order to invoke this specific provisioner. + DriverGetInfo(context.Context, *DriverGetInfoRequest) (*DriverGetInfoResponse, error) + mustEmbedUnimplementedIdentityServer() +} + +// UnimplementedIdentityServer must be embedded to have forward compatible implementations. +type UnimplementedIdentityServer struct { +} + +func (UnimplementedIdentityServer) DriverGetInfo(context.Context, *DriverGetInfoRequest) (*DriverGetInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DriverGetInfo not implemented") +} +func (UnimplementedIdentityServer) mustEmbedUnimplementedIdentityServer() {} + +// UnsafeIdentityServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to IdentityServer will +// result in compilation errors. +type UnsafeIdentityServer interface { + mustEmbedUnimplementedIdentityServer() +} + +func RegisterIdentityServer(s grpc.ServiceRegistrar, srv IdentityServer) { + s.RegisterService(&Identity_ServiceDesc, srv) +} + +func _Identity_DriverGetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DriverGetInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IdentityServer).DriverGetInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Identity_DriverGetInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IdentityServer).DriverGetInfo(ctx, req.(*DriverGetInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Identity_ServiceDesc is the grpc.ServiceDesc for Identity service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Identity_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "cosi.v1alpha1.Identity", + HandlerType: (*IdentityServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "DriverGetInfo", + Handler: _Identity_DriverGetInfo_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosi.proto", +} + +const ( + Provisioner_DriverCreateBucket_FullMethodName = "/cosi.v1alpha1.Provisioner/DriverCreateBucket" + Provisioner_DriverDeleteBucket_FullMethodName = "/cosi.v1alpha1.Provisioner/DriverDeleteBucket" + Provisioner_DriverGrantBucketAccess_FullMethodName = "/cosi.v1alpha1.Provisioner/DriverGrantBucketAccess" + Provisioner_DriverRevokeBucketAccess_FullMethodName = "/cosi.v1alpha1.Provisioner/DriverRevokeBucketAccess" +) + +// ProvisionerClient is the client API for Provisioner service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ProvisionerClient interface { + // This call is made to create the bucket in the backend. + // This call is idempotent + // 1. If a bucket that matches both name and parameters already exists, then OK (success) must be returned. + // 2. If a bucket by same name, but different parameters is provided, then the appropriate error code ALREADY_EXISTS must be returned. + DriverCreateBucket(ctx context.Context, in *DriverCreateBucketRequest, opts ...grpc.CallOption) (*DriverCreateBucketResponse, error) + // This call is made to delete the bucket in the backend. + // If the bucket has already been deleted, then no error should be returned. + DriverDeleteBucket(ctx context.Context, in *DriverDeleteBucketRequest, opts ...grpc.CallOption) (*DriverDeleteBucketResponse, error) + // This call grants access to an account. The account_name in the request shall be used as a unique identifier to create credentials. + // The account_id returned in the response will be used as the unique identifier for deleting this access when calling DriverRevokeBucketAccess. + DriverGrantBucketAccess(ctx context.Context, in *DriverGrantBucketAccessRequest, opts ...grpc.CallOption) (*DriverGrantBucketAccessResponse, error) + // This call revokes all access to a particular bucket from a principal. + DriverRevokeBucketAccess(ctx context.Context, in *DriverRevokeBucketAccessRequest, opts ...grpc.CallOption) (*DriverRevokeBucketAccessResponse, error) +} + +type provisionerClient struct { + cc grpc.ClientConnInterface +} + +func NewProvisionerClient(cc grpc.ClientConnInterface) ProvisionerClient { + return &provisionerClient{cc} +} + +func (c *provisionerClient) DriverCreateBucket(ctx context.Context, in *DriverCreateBucketRequest, opts ...grpc.CallOption) (*DriverCreateBucketResponse, error) { + out := new(DriverCreateBucketResponse) + err := c.cc.Invoke(ctx, Provisioner_DriverCreateBucket_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *provisionerClient) DriverDeleteBucket(ctx context.Context, in *DriverDeleteBucketRequest, opts ...grpc.CallOption) (*DriverDeleteBucketResponse, error) { + out := new(DriverDeleteBucketResponse) + err := c.cc.Invoke(ctx, Provisioner_DriverDeleteBucket_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *provisionerClient) DriverGrantBucketAccess(ctx context.Context, in *DriverGrantBucketAccessRequest, opts ...grpc.CallOption) (*DriverGrantBucketAccessResponse, error) { + out := new(DriverGrantBucketAccessResponse) + err := c.cc.Invoke(ctx, Provisioner_DriverGrantBucketAccess_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *provisionerClient) DriverRevokeBucketAccess(ctx context.Context, in *DriverRevokeBucketAccessRequest, opts ...grpc.CallOption) (*DriverRevokeBucketAccessResponse, error) { + out := new(DriverRevokeBucketAccessResponse) + err := c.cc.Invoke(ctx, Provisioner_DriverRevokeBucketAccess_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ProvisionerServer is the server API for Provisioner service. +// All implementations must embed UnimplementedProvisionerServer +// for forward compatibility +type ProvisionerServer interface { + // This call is made to create the bucket in the backend. + // This call is idempotent + // 1. If a bucket that matches both name and parameters already exists, then OK (success) must be returned. + // 2. If a bucket by same name, but different parameters is provided, then the appropriate error code ALREADY_EXISTS must be returned. + DriverCreateBucket(context.Context, *DriverCreateBucketRequest) (*DriverCreateBucketResponse, error) + // This call is made to delete the bucket in the backend. + // If the bucket has already been deleted, then no error should be returned. + DriverDeleteBucket(context.Context, *DriverDeleteBucketRequest) (*DriverDeleteBucketResponse, error) + // This call grants access to an account. The account_name in the request shall be used as a unique identifier to create credentials. + // The account_id returned in the response will be used as the unique identifier for deleting this access when calling DriverRevokeBucketAccess. + DriverGrantBucketAccess(context.Context, *DriverGrantBucketAccessRequest) (*DriverGrantBucketAccessResponse, error) + // This call revokes all access to a particular bucket from a principal. + DriverRevokeBucketAccess(context.Context, *DriverRevokeBucketAccessRequest) (*DriverRevokeBucketAccessResponse, error) + mustEmbedUnimplementedProvisionerServer() +} + +// UnimplementedProvisionerServer must be embedded to have forward compatible implementations. +type UnimplementedProvisionerServer struct { +} + +func (UnimplementedProvisionerServer) DriverCreateBucket(context.Context, *DriverCreateBucketRequest) (*DriverCreateBucketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DriverCreateBucket not implemented") +} +func (UnimplementedProvisionerServer) DriverDeleteBucket(context.Context, *DriverDeleteBucketRequest) (*DriverDeleteBucketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DriverDeleteBucket not implemented") +} +func (UnimplementedProvisionerServer) DriverGrantBucketAccess(context.Context, *DriverGrantBucketAccessRequest) (*DriverGrantBucketAccessResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DriverGrantBucketAccess not implemented") +} +func (UnimplementedProvisionerServer) DriverRevokeBucketAccess(context.Context, *DriverRevokeBucketAccessRequest) (*DriverRevokeBucketAccessResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DriverRevokeBucketAccess not implemented") +} +func (UnimplementedProvisionerServer) mustEmbedUnimplementedProvisionerServer() {} + +// UnsafeProvisionerServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ProvisionerServer will +// result in compilation errors. +type UnsafeProvisionerServer interface { + mustEmbedUnimplementedProvisionerServer() +} + +func RegisterProvisionerServer(s grpc.ServiceRegistrar, srv ProvisionerServer) { + s.RegisterService(&Provisioner_ServiceDesc, srv) +} + +func _Provisioner_DriverCreateBucket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DriverCreateBucketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProvisionerServer).DriverCreateBucket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provisioner_DriverCreateBucket_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProvisionerServer).DriverCreateBucket(ctx, req.(*DriverCreateBucketRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provisioner_DriverDeleteBucket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DriverDeleteBucketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProvisionerServer).DriverDeleteBucket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provisioner_DriverDeleteBucket_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProvisionerServer).DriverDeleteBucket(ctx, req.(*DriverDeleteBucketRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provisioner_DriverGrantBucketAccess_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DriverGrantBucketAccessRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProvisionerServer).DriverGrantBucketAccess(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provisioner_DriverGrantBucketAccess_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProvisionerServer).DriverGrantBucketAccess(ctx, req.(*DriverGrantBucketAccessRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provisioner_DriverRevokeBucketAccess_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DriverRevokeBucketAccessRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProvisionerServer).DriverRevokeBucketAccess(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provisioner_DriverRevokeBucketAccess_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProvisionerServer).DriverRevokeBucketAccess(ctx, req.(*DriverRevokeBucketAccessRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Provisioner_ServiceDesc is the grpc.ServiceDesc for Provisioner service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Provisioner_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "cosi.v1alpha1.Provisioner", + HandlerType: (*ProvisionerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "DriverCreateBucket", + Handler: _Provisioner_DriverCreateBucket_Handler, + }, + { + MethodName: "DriverDeleteBucket", + Handler: _Provisioner_DriverDeleteBucket_Handler, + }, + { + MethodName: "DriverGrantBucketAccess", + Handler: _Provisioner_DriverGrantBucketAccess_Handler, + }, + { + MethodName: "DriverRevokeBucketAccess", + Handler: _Provisioner_DriverRevokeBucketAccess_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosi.proto", +} diff --git a/proto/fake/cosi.pb.fake.go b/proto/fake/cosi.pb.fake.go index 170bedbb..f74a39d7 100644 --- a/proto/fake/cosi.pb.fake.go +++ b/proto/fake/cosi.pb.fake.go @@ -3,33 +3,33 @@ package fake import ( "context" grpc "google.golang.org/grpc" - containerobjectstorageinterfacespec "sigs.k8s.io/container-object-storage-interface-spec" + proto "sigs.k8s.io/container-object-storage-interface-api/proto" ) type FakeIdentityClient struct { - FakeDriverGetInfo func(ctx context.Context, in *containerobjectstorageinterfacespec.DriverGetInfoRequest, opts ...grpc.CallOption) (*containerobjectstorageinterfacespec.DriverGetInfoResponse, error) + FakeDriverGetInfo func(ctx context.Context, in *proto.DriverGetInfoRequest, opts ...grpc.CallOption) (*proto.DriverGetInfoResponse, error) } -func (f *FakeIdentityClient) DriverGetInfo(ctx context.Context, in *containerobjectstorageinterfacespec.DriverGetInfoRequest, opts ...grpc.CallOption) (*containerobjectstorageinterfacespec.DriverGetInfoResponse, error) { +func (f *FakeIdentityClient) DriverGetInfo(ctx context.Context, in *proto.DriverGetInfoRequest, opts ...grpc.CallOption) (*proto.DriverGetInfoResponse, error) { return f.FakeDriverGetInfo(ctx, in, opts...) } type FakeProvisionerClient struct { - FakeDriverCreateBucket func(ctx context.Context, in *containerobjectstorageinterfacespec.DriverCreateBucketRequest, opts ...grpc.CallOption) (*containerobjectstorageinterfacespec.DriverCreateBucketResponse, error) - FakeDriverDeleteBucket func(ctx context.Context, in *containerobjectstorageinterfacespec.DriverDeleteBucketRequest, opts ...grpc.CallOption) (*containerobjectstorageinterfacespec.DriverDeleteBucketResponse, error) - FakeDriverGrantBucketAccess func(ctx context.Context, in *containerobjectstorageinterfacespec.DriverGrantBucketAccessRequest, opts ...grpc.CallOption) (*containerobjectstorageinterfacespec.DriverGrantBucketAccessResponse, error) - FakeDriverRevokeBucketAccess func(ctx context.Context, in *containerobjectstorageinterfacespec.DriverRevokeBucketAccessRequest, opts ...grpc.CallOption) (*containerobjectstorageinterfacespec.DriverRevokeBucketAccessResponse, error) + FakeDriverCreateBucket func(ctx context.Context, in *proto.DriverCreateBucketRequest, opts ...grpc.CallOption) (*proto.DriverCreateBucketResponse, error) + FakeDriverDeleteBucket func(ctx context.Context, in *proto.DriverDeleteBucketRequest, opts ...grpc.CallOption) (*proto.DriverDeleteBucketResponse, error) + FakeDriverGrantBucketAccess func(ctx context.Context, in *proto.DriverGrantBucketAccessRequest, opts ...grpc.CallOption) (*proto.DriverGrantBucketAccessResponse, error) + FakeDriverRevokeBucketAccess func(ctx context.Context, in *proto.DriverRevokeBucketAccessRequest, opts ...grpc.CallOption) (*proto.DriverRevokeBucketAccessResponse, error) } -func (f *FakeProvisionerClient) DriverCreateBucket(ctx context.Context, in *containerobjectstorageinterfacespec.DriverCreateBucketRequest, opts ...grpc.CallOption) (*containerobjectstorageinterfacespec.DriverCreateBucketResponse, error) { +func (f *FakeProvisionerClient) DriverCreateBucket(ctx context.Context, in *proto.DriverCreateBucketRequest, opts ...grpc.CallOption) (*proto.DriverCreateBucketResponse, error) { return f.FakeDriverCreateBucket(ctx, in, opts...) } -func (f *FakeProvisionerClient) DriverDeleteBucket(ctx context.Context, in *containerobjectstorageinterfacespec.DriverDeleteBucketRequest, opts ...grpc.CallOption) (*containerobjectstorageinterfacespec.DriverDeleteBucketResponse, error) { +func (f *FakeProvisionerClient) DriverDeleteBucket(ctx context.Context, in *proto.DriverDeleteBucketRequest, opts ...grpc.CallOption) (*proto.DriverDeleteBucketResponse, error) { return f.FakeDriverDeleteBucket(ctx, in, opts...) } -func (f *FakeProvisionerClient) DriverGrantBucketAccess(ctx context.Context, in *containerobjectstorageinterfacespec.DriverGrantBucketAccessRequest, opts ...grpc.CallOption) (*containerobjectstorageinterfacespec.DriverGrantBucketAccessResponse, error) { +func (f *FakeProvisionerClient) DriverGrantBucketAccess(ctx context.Context, in *proto.DriverGrantBucketAccessRequest, opts ...grpc.CallOption) (*proto.DriverGrantBucketAccessResponse, error) { return f.FakeDriverGrantBucketAccess(ctx, in, opts...) } -func (f *FakeProvisionerClient) DriverRevokeBucketAccess(ctx context.Context, in *containerobjectstorageinterfacespec.DriverRevokeBucketAccessRequest, opts ...grpc.CallOption) (*containerobjectstorageinterfacespec.DriverRevokeBucketAccessResponse, error) { +func (f *FakeProvisionerClient) DriverRevokeBucketAccess(ctx context.Context, in *proto.DriverRevokeBucketAccessRequest, opts ...grpc.CallOption) (*proto.DriverRevokeBucketAccessResponse, error) { return f.FakeDriverRevokeBucketAccess(ctx, in, opts...) } diff --git a/proto/go.mod b/proto/go.mod index abe1bc3f..b599c4bd 100644 --- a/proto/go.mod +++ b/proto/go.mod @@ -1,17 +1,15 @@ module sigs.k8s.io/container-object-storage-interface-api/proto -go 1.18 +go 1.22.4 require ( github.com/dave/jennifer v1.4.1 - github.com/golang/protobuf v1.4.3 + github.com/golang/protobuf v1.5.4 google.golang.org/grpc v1.35.0 - google.golang.org/protobuf v1.25.0 + google.golang.org/protobuf v1.34.2 ) require ( - github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect - github.com/mitchellh/protoc-gen-go-json v1.1.0 // indirect golang.org/x/net v0.0.0-20191002035440-2ec189313ef0 // indirect golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a // indirect golang.org/x/text v0.3.0 // indirect diff --git a/proto/go.sum b/proto/go.sum index 7d412c5a..29a5f400 100644 --- a/proto/go.sum +++ b/proto/go.sum @@ -10,7 +10,6 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -22,21 +21,19 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/mitchellh/protoc-gen-go-json v1.1.0 h1:lEi1xtXyYKDwA8EB5u27+UUZOTznC4JpqVOKZwCGJUo= -github.com/mitchellh/protoc-gen-go-json v1.1.0/go.mod h1:pACAKlMtBf4SMFbVswcjwNwWwlci6Vn841H5jPRcE9I= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -84,8 +81,9 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/proto/spec.md b/proto/spec.md index bbb1e47a..303b7cc3 100644 --- a/proto/spec.md +++ b/proto/spec.md @@ -49,7 +49,7 @@ The Container Object Storage Interface (COSI) will: * Consumption of both existing and new buckets created on SP. * Define plugin protocol recommendations. * Describe a process by which an admin configures a Plugin. - * COSI deployments and templates. + * COSI deployments and templates. ### Non-Goals in MVP @@ -86,31 +86,31 @@ Interaction of these components is illustrated in the figure below. +-------------------------------------------+ ``` -Figure 1: Plugin deployment, all of the COSI system Node hosts run Plugins. +Figure 1: Plugin deployment, all of the COSI system Node hosts run Plugins. ![Cosi Components](cosicomponents.png) -Figure 2: Kubernetes implementation - Interaction of COSI components +Figure 2: Kubernetes implementation - Interaction of COSI components ### Bucket Lifecycle ``` - CreateBucket +-------------+ DeleteBucket - +------------->| CREATED +--------------+ - | +---+----^---+ | - | Grant | | Revoke v - +++ Bucket | | Bucket +++ - |X| Access | | Access | | - +-+ +---v----+---+ +-+ - | BOUND | - +---+----^---+ + CreateBucket +-------------+ DeleteBucket + +------------->| CREATED +--------------+ + | +---+----^---+ | + | Grant | | Revoke v + +++ Bucket | | Bucket +++ + |X| Access | | Access | | + +-+ +---v----+---+ +-+ + | BOUND | + +---+----^---+ ``` Figure 3: The lifecycle of a dynamically provisioned bucket, from creation to deletion. -The above diagrams illustrate a general expectation with respect to how a COSI system MAY manage the lifecycle of a bucket via the API presented in this specification. +The above diagrams illustrate a general expectation with respect to how a COSI system MAY manage the lifecycle of a bucket via the API presented in this specification. Plugins SHOULD expose all RPCs for an interface: Controller plugins SHOULD implement all RPCs for the service. Unsupported RPCs SHOULD return an appropriate error code that indicates such (e.g. `UNIMPLEMENTED`). @@ -131,7 +131,7 @@ package cosi.v1alpha1; import "google/protobuf/descriptor.proto"; -option go_package = "sigs.k8s.io/container-object-storage-interface-spec;cosi"; +option go_package = "sigs.k8s.io/container-object-storage-interface-api/proto;cosi"; extend google.protobuf.EnumOptions { // Indicates that this enum is OPTIONAL and part of an experimental @@ -293,7 +293,7 @@ message DriverCreateBucketRequest { } message DriverCreateBucketResponse { - // bucket_id returned here is expected to be the globally unique + // bucket_id returned here is expected to be the globally unique // identifier for the bucket in the object storage provider. string bucket_id = 1; @@ -305,7 +305,7 @@ message DriverCreateBucketResponse { message DriverDeleteBucketRequest { // This field is REQUIRED // bucket_id is a globally unique identifier for the bucket - // in the object storage provider + // in the object storage provider string bucket_id = 1; // This field is OPTIONAL @@ -321,7 +321,7 @@ message DriverDeleteBucketResponse { message DriverGrantBucketAccessRequest { // This field is REQUIRED // bucket_id is a globally unique identifier for the bucket - // in the object storage provider + // in the object storage provider string bucket_id = 1; // This field is REQUIRED @@ -342,7 +342,7 @@ message DriverGrantBucketAccessRequest { message DriverGrantBucketAccessResponse { // This field is REQUIRED // This is the account_id that is being provided access. This will - // be required later to revoke access. + // be required later to revoke access. string account_id = 1; // This field is REQUIRED @@ -465,9 +465,9 @@ This operation MUST be idempotent. If a volume corresponding to the specified bucket `name` already exists, is accessible from `accessibility_requirements, and is compatible with the specified attributes of the bucket in the `DriverCreateBucket`, the Plugin MUST reply `0 OK` with the corresponding `DriverCreateBucketResponse`. ``` -message DriverCreateBucketRequest { +message DriverCreateBucketRequest { // Idempotency - This name is generated by the COSI system to achieve - // idempotency. + // idempotency. // This field is REQUIRED. string bucket_name = 1; @@ -612,7 +612,7 @@ Supervised plugins MAY be isolated and/or resource-bounded. ##### Linux Capabilities -* Provisioner Sidecar SHALL guarantee that plugins will have necessary permission to connect to their backend Object Storage System +* Provisioner Sidecar SHALL guarantee that plugins will have necessary permission to connect to their backend Object Storage System * Plugins SHOULD clearly document any additionally required capabilities and/or security context. ##### Namespaces