Skip to content

Commit

Permalink
Merge pull request #540 from pohly/distributed-provisioning
Browse files Browse the repository at this point in the history
replace -capacity-controller-deployment-mode with -enable-capacity
  • Loading branch information
k8s-ci-robot authored Dec 16, 2020
2 parents 7ad1cd2 + ac47ee6 commit 41af8a3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 78 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Note that the external-provisioner does not scale with more replicas. Only one e

See the [storage capacity section](#capacity-support) below for details.

* `--capacity-controller-deployment-mode=central|local`: Setting this enables producing CSIStorageCapacity objects with capacity information from the driver's GetCapacity call. Use `central` when there is just one active external-provisioner in the cluster. Use `local` when deploying external-provisioner on each node with distributed provisioning. The default is to not produce CSIStorageCapacity objects.
* `--enable-capacity`: This enables producing CSIStorageCapacity objects with capacity information from the driver's GetCapacity call. The default is to not produce CSIStorageCapacity objects.

* `--capacity-ownerref-level <levels>`: The level indicates the number of objects that need to be traversed starting from the pod identified by the POD_NAME and POD_NAMESPACE environment variables to reach the owning object for CSIStorageCapacity objects: 0 for the pod itself, 1 for a StatefulSet, 2 for a Deployment, etc. Defaults to `1` (= StatefulSet).

Expand Down Expand Up @@ -165,7 +165,7 @@ example):
fieldRef:
fieldPath: metadata.name
```
- Add `--capacity-controller-deployment-mode=central` to the command line flags.
- Add `--enable-capacity` to the command line flags.
- Add `StorageCapacity: true` to the CSIDriver information object.
Without it, external-provisioner will publish information, but the
Kubernetes scheduler will ignore it. This can be used to first
Expand Down Expand Up @@ -232,8 +232,7 @@ other driver.

The deployment with [distributed
provisioning](#distributed-provisioning) is almost the same as above,
with some minor changes:
- Add `--capacity-controller-deployment-mode=local` to the command line flags.
with some minor change:
- Use `--capacity-ownerref-level=0` and the `POD_NAMESPACE/POD_NAME`
variables to make the pod that contains the external-provisioner
the owner of CSIStorageCapacity objects for the node.
Expand Down
14 changes: 3 additions & 11 deletions cmd/csi-provisioner/csi-provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,7 @@ var (
kubeAPIQPS = flag.Float32("kube-api-qps", 5, "QPS to use while communicating with the kubernetes apiserver. Defaults to 5.0.")
kubeAPIBurst = flag.Int("kube-api-burst", 10, "Burst to use while communicating with the kubernetes apiserver. Defaults to 10.")

capacityMode = func() *capacity.DeploymentMode {
mode := capacity.DeploymentModeUnset
flag.Var(&mode, "capacity-controller-deployment-mode", "Setting this enables producing CSIStorageCapacity objects with capacity information from the driver's GetCapacity call. 'central' is currently the only supported mode. Use it when there is just one active provisioner in the cluster.")
return &mode
}()
enableCapacity = flag.Bool("enable-capacity", false, "This enables producing CSIStorageCapacity objects with capacity information from the driver's GetCapacity call.")
capacityImmediateBinding = flag.Bool("capacity-for-immediate-binding", false, "Enables producing capacity information for storage classes with immediate binding. Not needed for the Kubernetes scheduler, maybe useful for other consumers or for debugging.")
capacityPollInterval = flag.Duration("capacity-poll-interval", time.Minute, "How long the external-provisioner waits before checking for storage capacity changes.")
capacityOwnerrefLevel = flag.Int("capacity-ownerref-level", 1, "The level indicates the number of objects that need to be traversed starting from the pod identified by the POD_NAME and POD_NAMESPACE environment variables to reach the owning object for CSIStorageCapacity objects: 0 for the pod itself, 1 for a StatefulSet, 2 for a Deployment, etc.")
Expand Down Expand Up @@ -386,8 +382,7 @@ func main() {
)

var capacityController *capacity.Controller
if *capacityMode == capacity.DeploymentModeCentral ||
*capacityMode == capacity.DeploymentModeLocal {
if *enableCapacity {
podName := os.Getenv("POD_NAME")
namespace := os.Getenv("POD_NAMESPACE")
if podName == "" || namespace == "" {
Expand All @@ -405,7 +400,7 @@ func main() {
klog.Infof("using %s/%s %s as owner of CSIStorageCapacity objects", controller.APIVersion, controller.Kind, controller.Name)

var topologyInformer topology.Informer
if *capacityMode == capacity.DeploymentModeCentral {
if nodeDeployment == nil {
topologyInformer = topology.NewNodeTopology(
provisionerName,
clientset,
Expand All @@ -415,9 +410,6 @@ func main() {
)
} else {
var segment topology.Segment
if nodeDeployment == nil {
klog.Fatal("--capacity-controller-deployment-mode=local is only valid in combination with --node-deployment")
}
if nodeDeployment.NodeInfo.AccessibleTopology != nil {
for key, value := range nodeDeployment.NodeInfo.AccessibleTopology.Segments {
segment = append(segment, topology.SegmentEntry{Key: key, Value: value})
Expand Down
63 changes: 0 additions & 63 deletions pkg/capacity/mode.go

This file was deleted.

0 comments on commit 41af8a3

Please sign in to comment.