@@ -25,7 +25,6 @@ type opts struct {
2525 reqValidation bool
2626 repValidation bool
2727 requiresStagingTargetPath bool
28- requiresNodeID bool
2928 requiresVolContext bool
3029 requiresPubContext bool
3130 requiresCtlrNewVolSecrets bool
@@ -50,15 +49,6 @@ func WithResponseValidation() Option {
5049 }
5150}
5251
53- // WithRequiresNodeID is a Option that indicates
54- // ControllerPublishVolume requests and NodeGetInfo responses must
55- // contain non-empty node ID data.
56- func WithRequiresNodeID () Option {
57- return func (o * opts ) {
58- o .requiresNodeID = true
59- }
60- }
61-
6252// WithRequiresStagingTargetPath is a Option that indicates
6353// NodePublishVolume requests must have non-empty StagingTargetPath
6454// fields.
@@ -264,9 +254,6 @@ func (s *interceptor) handle(
264254type interceptorHasVolumeID interface {
265255 GetVolumeId () string
266256}
267- type interceptorHasNodeID interface {
268- NodeGetId () string
269- }
270257type interceptorHasUserCredentials interface {
271258 GetUserCredentials () map [string ]string
272259}
@@ -302,17 +289,6 @@ func (s *interceptor) validateRequest(
302289 }
303290 }
304291
305- // Check to see if the request has a node ID and if it is set.
306- // If the node ID is not set then return an error.
307- if s .opts .requiresNodeID {
308- if treq , ok := req .(interceptorHasNodeID ); ok {
309- if treq .NodeGetId () == "" {
310- return status .Error (
311- codes .InvalidArgument , "required: NodeID" )
312- }
313- }
314- }
315-
316292 // Check to see if the request has volume context and if they're
317293 // required. If the volume context is required by no attributes are
318294 // specified then return an error.
@@ -459,6 +435,11 @@ func (s *interceptor) validateControllerPublishVolumeRequest(
459435 }
460436 }
461437
438+ if req .NodeId == "" {
439+ return status .Error (
440+ codes .InvalidArgument , "required: NodeID" )
441+ }
442+
462443 return validateVolumeCapabilityArg (req .VolumeCapability , true )
463444}
464445
@@ -674,9 +655,10 @@ func (s *interceptor) validateGetPluginInfoResponse(
674655func (s * interceptor ) validateNodeGetInfoResponse (
675656 ctx context.Context ,
676657 rep csi.NodeGetInfoResponse ) error {
677- if s . opts . requiresNodeID && rep .NodeId == "" {
658+ if rep .NodeId == "" {
678659 return status .Error (codes .Internal , "empty: NodeID" )
679660 }
661+
680662 return nil
681663}
682664
0 commit comments