Files
ubicloud/kubernetes/csi/lib/csi_services_pb.rb
mohi-kalantari 9a665057c0 Generate Ruby definitions of CSI protobuf
First we need to download the csi.proto file

You can download this file directly from the repo using this command:
wget https://raw.githubusercontent.com/container-storage-interface/spec/\
v1.11.0/csi.proto -O kubernetes/csi/csi.proto

This file represents the CSI spec version v1.11.0

Using the ruby grpc gem, we would generate the ruby scaffold code
for the GRPC server.

In order to generate for yourself, run the following commands:

gem install grpc
gem install grpc-tools

sudo apt install -y protobuf-compiler
or
brew install protobuf

grpc_tools_ruby_protoc -I kubernetes/csi --ruby_out=kubernetes/csi/lib \
  --grpc_out=kubernetes/csi/lib kubernetes/csi/csi.proto

Since there is no need to keep the csi.proto file, remove it after
generating the ruby code:

rm kubernetes/csi/csi.proto

After generating the files, you can see that Rubocop complains about
the files in kubernetes/csi/lib which you might need to manually fix
or let your linter take care of it.
2025-07-25 15:20:55 +02:00

4.9 KiB