diff --git a/examples/persistent-volume-provisioning/README.md b/examples/persistent-volume-provisioning/README.md index b5b01c78477..56f7dbb5d48 100644 --- a/examples/persistent-volume-provisioning/README.md +++ b/examples/persistent-volume-provisioning/README.md @@ -111,13 +111,20 @@ parameters: volumetype: "replicate:3" ``` +Example storageclass can be found in [glusterfs-storageclass.yaml](glusterfs/glusterfs-storageclass.yaml). + * `resturl` : Gluster REST service/Heketi service url which provision gluster volumes on demand. The general format should be `IPaddress:Port` and this is a mandatory parameter for GlusterFS dynamic provisioner. If Heketi service is exposed as a routable service in openshift/kubernetes setup, this can have a format similar to `http://heketi-storage-project.cloudapps.mystorage.com` where the fqdn is a resolvable heketi service url. + * `restauthenabled` : Gluster REST service authentication boolean that enables authentication to the REST server. If this value is 'true', `restuser` and `restuserkey` or `secretNamespace` + `secretName` have to be filled. This option is deprecated, authentication is enabled when any of `restuser`, `restuserkey`, `secretName` or `secretNamespace` is specified. + * `restuser` : Gluster REST service/Heketi user who has access to create volumes in the Gluster Trusted Pool. + * `restuserkey` : Gluster REST service/Heketi user's password which will be used for authentication to the REST server. This parameter is deprecated in favor of `secretNamespace` + `secretName`. + * `secretNamespace` + `secretName` : Identification of Secret instance that contains user password to use when talking to Gluster REST service. These parameters are optional, empty password will be used when both `secretNamespace` and `secretName` are omitted. The provided secret must have type "kubernetes.io/glusterfs". When both `restuserkey` and `secretNamespace` + `secretName` is specified, the secret will be used. + * `clusterid`: `630372ccdc720a92c681fb928f27b53f` is the ID of the cluster which will be used by Heketi when provisioning the volume. It can also be a list of clusterids, for ex: "8452344e2becec931ece4e33c4674e4e,42982310de6c63381718ccfa6d8cf397". This is an optional parameter. @@ -127,6 +134,7 @@ Example of a secret can be found in [glusterfs-secret.yaml](glusterfs/glusterfs- * `volumetype` : The volume type and its parameters can be configured with this optional value. If the volume type is not mentioned, it's up to the provisioner to decide the volume type. For example: + 'Replica volume': `volumetype: replicate:3` where '3' is replica count. 'Disperse/EC volume': @@ -137,6 +145,7 @@ For example: For available volume types and its administration options refer: ([Administration Guide](https://access.redhat.com/documentation/en-US/Red_Hat_Storage/3.1/html/Administration_Guide/part-Overview.html)) Reference : ([How to configure Gluster on Kubernetes](https://github.com/gluster/gluster-kubernetes/blob/master/docs/setup-guide.md)) + Reference : ([How to configure Heketi](https://github.com/heketi/heketi/wiki/Setting-up-the-topology)) When the persistent volumes are dynamically provisioned, the Gluster plugin automatically create an endpoint and a headless service in the name `gluster-dynamic-`. This dynamic endpoint and service will be deleted automatically when the persistent volume claim is deleted. diff --git a/examples/persistent-volume-provisioning/glusterfs/glusterfs-dp.yaml b/examples/persistent-volume-provisioning/glusterfs/glusterfs-storageclass.yaml similarity index 100% rename from examples/persistent-volume-provisioning/glusterfs/glusterfs-dp.yaml rename to examples/persistent-volume-provisioning/glusterfs/glusterfs-storageclass.yaml diff --git a/pkg/volume/glusterfs/glusterfs.go b/pkg/volume/glusterfs/glusterfs.go index 98c13dfa17b..c12674deb98 100644 --- a/pkg/volume/glusterfs/glusterfs.go +++ b/pkg/volume/glusterfs/glusterfs.go @@ -389,7 +389,7 @@ type provisionerConfig struct { secretNamespace string secretName string secretValue string - clusterId string + clusterID string gidMin int gidMax int volumeType gapi.VolumeDurabilityInfo @@ -583,7 +583,7 @@ func (d *glusterfsVolumeDeleter) Delete() error { var err error glog.V(2).Infof("glusterfs: delete volume: %s ", d.glusterfsMounter.path) volumeName := d.glusterfsMounter.path - volumeId := dstrings.TrimPrefix(volumeName, volPrefix) + volumeID := dstrings.TrimPrefix(volumeName, volPrefix) class, err := volutil.GetClassForVolume(d.plugin.host.GetKubeClient(), d.spec) if err != nil { return err @@ -595,7 +595,7 @@ func (d *glusterfsVolumeDeleter) Delete() error { } d.provisionerConfig = *cfg - glog.V(4).Infof("glusterfs: deleting volume %q with configuration %+v", volumeId, d.provisionerConfig) + glog.V(4).Infof("glusterfs: deleting volume %q with configuration %+v", volumeID, d.provisionerConfig) gid, exists, err := d.getGid() if err != nil { @@ -617,7 +617,7 @@ func (d *glusterfsVolumeDeleter) Delete() error { glog.Errorf("glusterfs: failed to create glusterfs rest client") return fmt.Errorf("glusterfs: failed to create glusterfs rest client, REST server authentication failed") } - err = cli.VolumeDelete(volumeId) + err = cli.VolumeDelete(volumeID) if err != nil { glog.Errorf("glusterfs: error when deleting the volume :%v", err) return err @@ -738,7 +738,7 @@ func (p *glusterfsVolumeProvisioner) GetClusterNodes(cli *gcli.Client, cluster s } func (p *glusterfsVolumeProvisioner) CreateVolume(gid int) (r *v1.GlusterfsVolumeSource, size int, err error) { - var clusterIds []string + var clusterIDs []string capacity := p.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)] volSizeBytes := capacity.Value() sz := int(volume.RoundUpSize(volSizeBytes, 1024*1024*1024)) @@ -752,12 +752,12 @@ func (p *glusterfsVolumeProvisioner) CreateVolume(gid int) (r *v1.GlusterfsVolum glog.Errorf("glusterfs: failed to create glusterfs rest client") return nil, 0, fmt.Errorf("failed to create glusterfs REST client, REST server authentication failed") } - if p.provisionerConfig.clusterId != "" { - clusterIds = dstrings.Split(p.clusterId, ",") - glog.V(4).Infof("glusterfs: provided clusterids: %v", clusterIds) + if p.provisionerConfig.clusterID != "" { + clusterIDs = dstrings.Split(p.clusterID, ",") + glog.V(4).Infof("glusterfs: provided clusterIDs: %v", clusterIDs) } gid64 := int64(gid) - volumeReq := &gapi.VolumeCreateRequest{Size: sz, Clusters: clusterIds, Gid: gid64, Durability: p.volumeType} + volumeReq := &gapi.VolumeCreateRequest{Size: sz, Clusters: clusterIDs, Gid: gid64, Durability: p.volumeType} volume, err := cli.VolumeCreate(volumeReq) if err != nil { glog.Errorf("glusterfs: error creating volume %v ", err) @@ -907,7 +907,7 @@ func parseClassParameters(params map[string]string, kubeClient clientset.Interfa cfg.secretNamespace = v case "clusterid": if len(v) != 0 { - cfg.clusterId = v + cfg.clusterID = v } case "restauthenabled": authEnabled = dstrings.ToLower(v) == "true"