Skip to content

Commit

Permalink
Merge pull request kubernetes-csi#170 from mlmhl/resize
Browse files Browse the repository at this point in the history
make controller expansion capacity configurable
  • Loading branch information
k8s-ci-robot authored Feb 21, 2019
2 parents 722def7 + 5b47a48 commit 58669a9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
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

0 comments on commit 58669a9

Please sign in to comment.