Skip to content

Commit dd68929

Browse files
committed
Do not enable snapshotmetadata service by default
Signed-off-by: Prasad Ghangal <[email protected]>
1 parent 3b2b102 commit dd68929

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

cmd/hostpathplugin/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ func main() {
5555

5656
flag.BoolVar(&cfg.EnableVolumeExpansion, "enable-volume-expansion", true, "Enables volume expansion feature.")
5757
flag.BoolVar(&cfg.EnableControllerModifyVolume, "enable-controller-modify-volume", false, "Enables Controller modify volume feature.")
58+
// TODO: Remove this feature flag and enable SnapshotMetadata service by default once external-snapshot-metadata alpha is released.
59+
flag.BoolVar(&cfg.EnableSnapshotMetadata, "enable-snapshot-metadata", false, "Enables Snapshot Metadata service.")
5860
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.")
5961
flag.BoolVar(&cfg.DisableControllerExpansion, "disable-controller-expansion", false, "Disables Controller volume expansion capability.")
6062
flag.BoolVar(&cfg.DisableNodeExpansion, "disable-node-expansion", false, "Disables Node volume expansion capability.")

pkg/hostpath/hostpath.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ type Config struct {
8181
EnableTopology bool
8282
EnableVolumeExpansion bool
8383
EnableControllerModifyVolume bool
84+
EnableSnapshotMetadata bool
8485
AcceptedMutableParameterNames StringArray
8586
DisableControllerExpansion bool
8687
DisableNodeExpansion bool
@@ -130,8 +131,13 @@ func NewHostPathDriver(cfg Config) (*hostPath, error) {
130131

131132
func (hp *hostPath) Run() error {
132133
s := NewNonBlockingGRPCServer()
133-
// hp itself implements ControllerServer, NodeServer, and IdentityServer.
134-
s.Start(hp.config.Endpoint, hp, hp, hp, hp, hp)
134+
// hp itself implements ControllerServer, NodeServer, IdentityServer, and SnapshotMetadataServer.
135+
// TODO: Enable SnapshotMetadata service by default once external-snapshot-metadata alpha is released.
136+
var sms csi.SnapshotMetadataServer
137+
if hp.config.EnableSnapshotMetadata {
138+
sms = hp
139+
}
140+
s.Start(hp.config.Endpoint, hp, hp, hp, hp, sms)
135141
s.Wait()
136142

137143
return nil

pkg/hostpath/identityserver.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,21 @@ func (hp *hostPath) GetPluginCapabilities(ctx context.Context, req *csi.GetPlugi
6262
},
6363
},
6464
},
65-
{
65+
}
66+
if hp.config.EnableTopology {
67+
caps = append(caps, &csi.PluginCapability{
6668
Type: &csi.PluginCapability_Service_{
6769
Service: &csi.PluginCapability_Service{
68-
Type: csi.PluginCapability_Service_SNAPSHOT_METADATA_SERVICE,
70+
Type: csi.PluginCapability_Service_VOLUME_ACCESSIBILITY_CONSTRAINTS,
6971
},
7072
},
71-
},
73+
})
7274
}
73-
if hp.config.EnableTopology {
75+
if hp.config.EnableSnapshotMetadata {
7476
caps = append(caps, &csi.PluginCapability{
7577
Type: &csi.PluginCapability_Service_{
7678
Service: &csi.PluginCapability_Service{
77-
Type: csi.PluginCapability_Service_VOLUME_ACCESSIBILITY_CONSTRAINTS,
79+
Type: csi.PluginCapability_Service_SNAPSHOT_METADATA_SERVICE,
7880
},
7981
},
8082
})

0 commit comments

Comments
 (0)