From 0c4782d036117253797cd3545f585a88e0f0e0bb Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 24 Mar 2025 14:13:20 +0000 Subject: [PATCH 1/3] cinder-csi-plugin, manila-csi-plugin: Correct formatting character %T prints the type. %t prints the word true/false, which is what we want. [1] [1] https://pkg.go.dev/fmt Signed-off-by: Stephen Finucane --- pkg/csi/cinder/driver.go | 2 +- pkg/csi/manila/driver.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/csi/cinder/driver.go b/pkg/csi/cinder/driver.go index 04356a0eba..047572242e 100644 --- a/pkg/csi/cinder/driver.go +++ b/pkg/csi/cinder/driver.go @@ -101,7 +101,7 @@ func NewDriver(o *DriverOpts) *Driver { klog.Info("Driver: ", d.name) klog.Info("Driver version: ", d.fqVersion) klog.Info("CSI Spec version: ", specVersion) - klog.Infof("Topology awareness: %T", d.withTopology) + klog.Infof("Topology awareness: %t", d.withTopology) d.AddControllerServiceCapabilities( []csi.ControllerServiceCapability_RPC_Type{ diff --git a/pkg/csi/manila/driver.go b/pkg/csi/manila/driver.go index e39277ce0a..30d1b1f5d3 100644 --- a/pkg/csi/manila/driver.go +++ b/pkg/csi/manila/driver.go @@ -130,7 +130,7 @@ func NewDriver(o *DriverOpts) (*Driver, error) { klog.Info("Driver: ", d.name) klog.Info("Driver version: ", d.fqVersion) klog.Info("CSI spec version: ", specVersion) - klog.Infof("Topology awareness: %T", d.withTopology) + klog.Infof("Topology awareness: %t", d.withTopology) getShareAdapter(d.shareProto) // The program will terminate with a non-zero exit code if the share protocol selector is wrong klog.Infof("Operating on %s shares", d.shareProto) From 71f521fd277b5e3809f0c0b07aae50b016ddc0f5 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 24 Mar 2025 12:40:04 +0000 Subject: [PATCH 2/3] cinder-csi-plugin: Don't report topology capability when --with-topology=False The 'PluginCapability_Service_VOLUME_ACCESSIBILITY_CONSTRAINTS' capability flag determines whether the provisioner attempts to look up topology information from the node or not [1][2]. If we report it but don't return topology information from the node, we end up with failures to provision [3]. Fix the issue by optionally reporting the capability, like Manila already does. [1] https://github.com/kubernetes-csi/external-provisioner/blob/17e2429e9f/pkg/controller/controller.go#L685-L700 [2] https://github.com/kubernetes-csi/external-provisioner/blob/17e2429e9f/pkg/controller/controller.go#L994-L996 [3] https://github.com/kubernetes-csi/external-provisioner/blob/17e2429e9f/pkg/controller/topology.go#L177 Signed-off-by: Stephen Finucane --- pkg/csi/cinder/identityserver.go | 51 +++++++++++++++++--------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/pkg/csi/cinder/identityserver.go b/pkg/csi/cinder/identityserver.go index 3db28c04a5..ca30bc10b8 100644 --- a/pkg/csi/cinder/identityserver.go +++ b/pkg/csi/cinder/identityserver.go @@ -53,36 +53,39 @@ func (ids *identityServer) Probe(ctx context.Context, req *csi.ProbeRequest) (*c func (ids *identityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) { klog.V(5).Infof("GetPluginCapabilities called with req %+v", req) - return &csi.GetPluginCapabilitiesResponse{ - Capabilities: []*csi.PluginCapability{ - { - Type: &csi.PluginCapability_Service_{ - Service: &csi.PluginCapability_Service{ - Type: csi.PluginCapability_Service_CONTROLLER_SERVICE, - }, + caps := []*csi.PluginCapability{ + { + Type: &csi.PluginCapability_Service_{ + Service: &csi.PluginCapability_Service{ + Type: csi.PluginCapability_Service_CONTROLLER_SERVICE, }, }, - { - Type: &csi.PluginCapability_Service_{ - Service: &csi.PluginCapability_Service{ - Type: csi.PluginCapability_Service_VOLUME_ACCESSIBILITY_CONSTRAINTS, - }, + }, + { + Type: &csi.PluginCapability_VolumeExpansion_{ + VolumeExpansion: &csi.PluginCapability_VolumeExpansion{ + Type: csi.PluginCapability_VolumeExpansion_ONLINE, }, }, - { - Type: &csi.PluginCapability_VolumeExpansion_{ - VolumeExpansion: &csi.PluginCapability_VolumeExpansion{ - Type: csi.PluginCapability_VolumeExpansion_ONLINE, - }, + }, + { + Type: &csi.PluginCapability_VolumeExpansion_{ + VolumeExpansion: &csi.PluginCapability_VolumeExpansion{ + Type: csi.PluginCapability_VolumeExpansion_OFFLINE, }, }, - { - Type: &csi.PluginCapability_VolumeExpansion_{ - VolumeExpansion: &csi.PluginCapability_VolumeExpansion{ - Type: csi.PluginCapability_VolumeExpansion_OFFLINE, - }, + }, + } + + if ids.Driver.withTopology { + caps = append(caps, &csi.PluginCapability{ + Type: &csi.PluginCapability_Service_{ + Service: &csi.PluginCapability_Service{ + Type: csi.PluginCapability_Service_VOLUME_ACCESSIBILITY_CONSTRAINTS, }, }, - }, - }, nil + }) + } + + return &csi.GetPluginCapabilitiesResponse{Capabilities: caps}, nil } From 7aa34cd1b1ff4449be4dc7a3ecad8e23a54c247c Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 24 Mar 2025 12:45:58 +0000 Subject: [PATCH 3/3] manila-csi-plugin: Unify some logging between cinder, manila Signed-off-by: Stephen Finucane --- pkg/csi/manila/identityserver.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/csi/manila/identityserver.go b/pkg/csi/manila/identityserver.go index 7ff85cac8c..156372d3c4 100644 --- a/pkg/csi/manila/identityserver.go +++ b/pkg/csi/manila/identityserver.go @@ -22,6 +22,7 @@ import ( "github.com/container-storage-interface/spec/lib/go/csi" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "k8s.io/klog/v2" ) type identityServer struct { @@ -30,10 +31,16 @@ type identityServer struct { } func (ids *identityServer) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) { + klog.V(5).Infof("Using default GetPluginInfo") + if ids.d.name == "" { return nil, status.Error(codes.Unavailable, "Driver name not configured") } + if ids.d.fqVersion == "" { + return nil, status.Error(codes.Unavailable, "Driver is missing version") + } + return &csi.GetPluginInfoResponse{ Name: ids.d.name, VendorVersion: ids.d.fqVersion, @@ -51,6 +58,7 @@ func (ids *identityServer) Probe(ctx context.Context, req *csi.ProbeRequest) (*c } func (ids *identityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) { + klog.V(5).Infof("GetPluginCapabilities called with req %+v", req) caps := []*csi.PluginCapability{ { Type: &csi.PluginCapability_Service_{