Skip to content

Commit

Permalink
Make fstype configurable in external provisioner
Browse files Browse the repository at this point in the history
At present the fstype is set to `ext4` if nothing is passed in storage-class.
However a SP could prefer to have different fstype for many reasons for their
driver/volumes. This patch enables SP who is using the external-provisioner
to choose the default fstype which they want to have it.

Fix# #328

Signed-off-by: Humble Chirammal <[email protected]>
  • Loading branch information
humblec committed Feb 4, 2020
1 parent 8444597 commit 2203dd2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions cmd/csi-provisioner/csi-provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/kubernetes-csi/csi-lib-utils/leaderelection"
"github.com/kubernetes-csi/csi-lib-utils/metrics"
ctrl "github.com/kubernetes-csi/external-provisioner/pkg/controller"
provisionercontroller "github.com/kubernetes-csi/external-provisioner/pkg/controller"
snapclientset "github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned"
"sigs.k8s.io/sig-storage-lib-external-provisioner/controller"

Expand Down Expand Up @@ -89,6 +90,8 @@ func main() {
flag.Var(utilflag.NewMapStringBool(&featureGates), "feature-gates", "A set of key=value pairs that describe feature gates for alpha/experimental features. "+
"Options are:\n"+strings.Join(utilfeature.DefaultFeatureGate.KnownFeatures(), "\n"))

flag.StringVar(&provisionercontroller.DefaultFSType, "default-fstype", "ext4", "Specify the filesystem type of the volume. If not specified, external-provisioner will set default as `ext4`.")

klog.InitFlags(nil)
flag.CommandLine.AddGoFlagSet(goflag.CommandLine)
flag.Set("logtostderr", "true")
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ const (
backoffFactor = 1.2
backoffSteps = 10

defaultFSType = "ext4"

snapshotKind = "VolumeSnapshot"
snapshotAPIGroup = snapapi.GroupName // "snapshot.storage.k8s.io"
pvcKind = "PersistentVolumeClaim" // Native types don't require an API group
Expand All @@ -131,6 +129,8 @@ const (
)

var (
DefaultFSType = "ext4"

defaultSecretParams = secretParamsMap{
name: "Default",
secretNameKey: prefixedDefaultSecretNameKey,
Expand Down Expand Up @@ -487,7 +487,7 @@ func (p *csiProvisioner) ProvisionExt(options controller.ProvisionOptions) (*v1.
return nil, controller.ProvisioningFinished, fmt.Errorf("fstype specified in parameters with both \"fstype\" and \"%s\" keys", prefixedFsTypeKey)
}
if len(fsType) == 0 {
fsType = defaultFSType
fsType = DefaultFSType
}

capacity := options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
Expand Down

0 comments on commit 2203dd2

Please sign in to comment.