diff --git a/cmd/hostpathplugin/main.go b/cmd/hostpathplugin/main.go index 9dcbe7238..d13ad594e 100644 --- a/cmd/hostpathplugin/main.go +++ b/cmd/hostpathplugin/main.go @@ -62,6 +62,7 @@ func main() { flag.Var(&cfg.AcceptedMutableParameterNames, "accepted-mutable-parameter-names", "Comma separated list of parameter names that can be modified on a persistent volume. This is only used when enable-controller-modify-volume is true. If unset, all parameters are mutable.") flag.BoolVar(&cfg.DisableControllerExpansion, "disable-controller-expansion", false, "Disables Controller volume expansion capability.") flag.BoolVar(&cfg.DisableNodeExpansion, "disable-node-expansion", false, "Disables Node volume expansion capability.") + flag.BoolVar(&cfg.EnableListSnapshots, "enable-list-snapshots", true, "Enables ControllerServiceCapability_RPC_LIST_SNAPSHOTS capability. Defaults to true.") flag.Int64Var(&cfg.MaxVolumeExpansionSizeNode, "max-volume-size-node", 0, "Maximum allowed size of volume when expanded on the node. Defaults to same size as max-volume-size.") flag.Int64Var(&cfg.AttachLimit, "attach-limit", 0, "Maximum number of attachable volumes on a node. Zero refers to no limit.") diff --git a/pkg/hostpath/controllerserver.go b/pkg/hostpath/controllerserver.go index 5dd570419..f1a309f78 100644 --- a/pkg/hostpath/controllerserver.go +++ b/pkg/hostpath/controllerserver.go @@ -877,7 +877,6 @@ func (hp *hostPath) getControllerServiceCapabilities() []*csi.ControllerServiceC csi.ControllerServiceCapability_RPC_GET_VOLUME, csi.ControllerServiceCapability_RPC_GET_CAPACITY, csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT, - csi.ControllerServiceCapability_RPC_LIST_SNAPSHOTS, csi.ControllerServiceCapability_RPC_LIST_VOLUMES, csi.ControllerServiceCapability_RPC_CLONE_VOLUME, csi.ControllerServiceCapability_RPC_VOLUME_CONDITION, @@ -892,6 +891,9 @@ func (hp *hostPath) getControllerServiceCapabilities() []*csi.ControllerServiceC if hp.config.EnableControllerModifyVolume { cl = append(cl, csi.ControllerServiceCapability_RPC_MODIFY_VOLUME) } + if hp.config.EnableListSnapshots { + cl = append(cl, csi.ControllerServiceCapability_RPC_LIST_SNAPSHOTS) + } } var csc []*csi.ControllerServiceCapability diff --git a/pkg/hostpath/hostpath.go b/pkg/hostpath/hostpath.go index 4abeac774..c20c32c06 100644 --- a/pkg/hostpath/hostpath.go +++ b/pkg/hostpath/hostpath.go @@ -88,6 +88,7 @@ type Config struct { DisableNodeExpansion bool MaxVolumeExpansionSizeNode int64 CheckVolumeLifecycle bool + EnableListSnapshots bool } var (