Skip to content

Commit

Permalink
Enable CSIs topology feature
Browse files Browse the repository at this point in the history
Using volumes that are not configured with a networking layer requires
the kubescheduler to place pods on nodes that have access to a specific
persistent volume. This can be handled by STORK or using the optional
Topology feature of CSI. As a less invasive alternative to STORK
this feature works without changes to Pod and PVC specs for users.

There are some caveats to this approach:
* Its an extra burden on the API server in clusters with lots of volumes
* Nodes that joined the cluster after a given volume is created are not
  considered for that volume.

The latest linstor-csi master contains a mitigation for both of these issues.

See piraeusdatastore/linstor-csi#83
  • Loading branch information
WanzenBug authored and JoelColledge committed Sep 7, 2020
1 parent 8eaa0db commit 4e68be2
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

* Control volume placement and accessibility by using CSIs Topology feature. Controlled by setting
[`csi.enableTopology`](./doc/helm-values.adoc#csienabletopology).
* All pods use a dedicated service account to allow for fine-grained permission control.
* The new [helm section `psp.*`](./doc/helm-values.adoc#psp) can automatically configure the ServiceAccount
of all components to use the appropriate [PSP](https://kubernetes.io/docs/concepts/policy/pod-security-policy/) roles.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,10 @@ spec:
csiSnapshotterImage:
description: Name of the CSI external snapshotter image. See https://kubernetes-csi.github.io/docs/external-snapshotter.html
type: string
enableTopology:
description: Enable CSI topology feature to control volume accessibility
on cluster nodes
type: boolean
imagePullPolicy:
description: Pull policy applied to all pods started from this controller
type: string
Expand Down
1 change: 1 addition & 0 deletions charts/piraeus/templates/operator-csi-driver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ spec:
nodeTolerations: {{ .Values.csi.nodeTolerations | toJson}}
controllerAffinity: {{ .Values.csi.controllerAffinity | toJson }}
controllerTolerations: {{ .Values.csi.controllerTolerations | toJson}}
enableTopology: {{ .Values.csi.enableTopology }}
resources: {{ .Values.csi.resources | toJson }}
{{- end }}
1 change: 1 addition & 0 deletions charts/piraeus/values.cn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ csi:
nodeTolerations: []
controllerAffinity: {}
controllerTolerations: []
enableTopology: false
resources: {}
priorityClassName: ""
drbdRepoCred: "" # <- Specify the kubernetes secret name here
Expand Down
1 change: 1 addition & 0 deletions charts/piraeus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ csi:
nodeTolerations: []
controllerAffinity: {}
controllerTolerations: []
enableTopology: false
resources: {}
priorityClassName: ""
drbdRepoCred: "" # <- Specify the kubernetes secret name here
Expand Down
1 change: 1 addition & 0 deletions deploy/piraeus/templates/operator-csi-driver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ spec:
nodeTolerations: []
controllerAffinity: {}
controllerTolerations: []
enableTopology: false
resources: {}
8 changes: 8 additions & 0 deletions doc/helm-values.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ Valid values::
* `False`
Description:: Enable deployment of the LINSTOR CSI driver.

=== `csi.enableTopology`
Default:: `False`
Value values::
* `True`
* `False`
Description:: Enable the CSI Topology feature. This feature ensures that pods are always assigned to nodes that can
access persistent volumes. This is especially important for volumes without a networking layer (DRBD).

=== `csi.nodeAffinity`
Default:: `{}`
Valid values:: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity[affinity]
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/piraeus/v1/linstorcsidriver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ type LinstorCSIDriverSpec struct {
// +nullable
ControllerTolerations []corev1.Toleration `json:"controllerTolerations"`

// Enable CSI topology feature to control volume accessibility on cluster nodes
// +optional
EnableTopology bool `json:"enableTopology"`

shared.LinstorClientConfig `json:",inline"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package linstorcsidriver

import (
"context"
"fmt"
"os"
"time"

Expand Down Expand Up @@ -553,7 +554,7 @@ func newCSIControllerDeployment(csiResource *piraeusv1.LinstorCSIDriver) *appsv1
"--provisioner=linstor.csi.linbit.com",
"--csi-address=$(ADDRESS)",
"--v=5",
"--feature-gates=Topology=false",
fmt.Sprintf("--feature-gates=Topology=%t", csiResource.Spec.EnableTopology),
"--connection-timeout=4m",
"--enable-leader-election=true",
"--leader-election-type=leases",
Expand Down

0 comments on commit 4e68be2

Please sign in to comment.