Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make controller expansion capacity configurable #170

Merged
merged 1 commit into from
Feb 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/mock-driver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func main() {
flag.StringVar(&config.DriverName, "name", service.Name, "CSI driver name.")
flag.Int64Var(&config.AttachLimit, "attach-limit", 0, "number of attachable volumes on a node")
flag.BoolVar(&config.NodeExpansionRequired, "node-expand-required", false, "Enables NodeServiceCapability_RPC_EXPAND_VOLUME capacity.")
flag.BoolVar(&config.DisableControllerExpansion, "disable-controller-expansion", false, "Disables ControllerServiceCapability_RPC_EXPAND_VOLUME capability.")
flag.Parse()

endpoint := os.Getenv("CSI_ENDPOINT")
Expand Down
13 changes: 8 additions & 5 deletions mock/service/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,20 +386,23 @@ func (s *service) ControllerGetCapabilities(
},
},
},
{
}

if !s.config.DisableAttach {
caps = append(caps, &csi.ControllerServiceCapability{
Type: &csi.ControllerServiceCapability_Rpc{
Rpc: &csi.ControllerServiceCapability_RPC{
Type: csi.ControllerServiceCapability_RPC_EXPAND_VOLUME,
Type: csi.ControllerServiceCapability_RPC_PUBLISH_UNPUBLISH_VOLUME,
},
},
},
})
}

if !s.config.DisableAttach {
if !s.config.DisableControllerExpansion {
caps = append(caps, &csi.ControllerServiceCapability{
Type: &csi.ControllerServiceCapability_Rpc{
Rpc: &csi.ControllerServiceCapability_RPC{
Type: csi.ControllerServiceCapability_RPC_PUBLISH_UNPUBLISH_VOLUME,
Type: csi.ControllerServiceCapability_RPC_EXPAND_VOLUME,
},
},
})
Expand Down
9 changes: 5 additions & 4 deletions mock/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ var Manifest = map[string]string{
}

type Config struct {
DisableAttach bool
DriverName string
AttachLimit int64
NodeExpansionRequired bool
DisableAttach bool
DriverName string
AttachLimit int64
NodeExpansionRequired bool
DisableControllerExpansion bool
}

// Service is the CSI Mock service provider.
Expand Down