diff --git a/examples/experimental/persistent-volume-provisioning/README.md b/examples/experimental/persistent-volume-provisioning/README.md index 9fd4548b30e..fd25b765ff1 100644 --- a/examples/experimental/persistent-volume-provisioning/README.md +++ b/examples/experimental/persistent-volume-provisioning/README.md @@ -74,6 +74,7 @@ metadata: provisioner: kubernetes.io/glusterfs parameters: resturl: "http://127.0.0.1:8081" + clusterid: "630372ccdc720a92c681fb928f27b53f" restuser: "admin" secretNamespace: "default" secretName: "heketi-secret" @@ -85,8 +86,9 @@ parameters: * `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 containes 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. Example of a secret can be found in [glusterfs-provisioning-secret.yaml](glusterfs-provisioning-secret.yaml). diff --git a/examples/experimental/persistent-volume-provisioning/glusterfs-dp.yaml b/examples/experimental/persistent-volume-provisioning/glusterfs-dp.yaml index d0b4c3dd6a4..3013eb98134 100644 --- a/examples/experimental/persistent-volume-provisioning/glusterfs-dp.yaml +++ b/examples/experimental/persistent-volume-provisioning/glusterfs-dp.yaml @@ -5,6 +5,7 @@ metadata: provisioner: kubernetes.io/glusterfs parameters: resturl: "http://127.0.0.1:8081" + clusterid: "630372ccdc720a92c681fb928f27b53f" restuser: "admin" secretNamespace: "default" secretName: "heketi-secret" diff --git a/pkg/volume/glusterfs/glusterfs.go b/pkg/volume/glusterfs/glusterfs.go index 9677012a9be..5f234b5ee66 100644 --- a/pkg/volume/glusterfs/glusterfs.go +++ b/pkg/volume/glusterfs/glusterfs.go @@ -62,11 +62,6 @@ const ( replicaCount = 3 durabilityType = "replicate" secretKeyName = "key" // key name used in secret - annGlusterURL = "glusterfs.kubernetes.io/url" - annGlusterSecretName = "glusterfs.kubernetes.io/secretname" - annGlusterSecretNamespace = "glusterfs.kubernetes.io/secretnamespace" - annGlusterUserKey = "glusterfs.kubernetes.io/userkey" - annGlusterUser = "glusterfs.kubernetes.io/userid" gciGlusterMountBinariesPath = "/sbin/mount.glusterfs" ) @@ -385,6 +380,7 @@ type provisioningConfig struct { secretNamespace string secretName string secretValue string + clusterId string } type glusterfsVolumeProvisioner struct { @@ -526,7 +522,8 @@ func (p *glusterfsVolumeProvisioner) CreateVolume() (r *v1.GlusterfsVolumeSource glog.Errorf("glusterfs: failed to create glusterfs rest client") return nil, 0, fmt.Errorf("failed to create glusterfs REST client, REST server authentication failed") } - volumeReq := &gapi.VolumeCreateRequest{Size: sz, Durability: gapi.VolumeDurabilityInfo{Type: durabilityType, Replicate: gapi.ReplicaDurability{Replica: replicaCount}}} + clusterIds := dstrings.Split(p.clusterId, ",") + volumeReq := &gapi.VolumeCreateRequest{Size: sz, Clusters: clusterIds, Durability: gapi.VolumeDurabilityInfo{Type: durabilityType, Replicate: gapi.ReplicaDurability{Replica: replicaCount}}} volume, err := cli.VolumeCreate(volumeReq) if err != nil { glog.Errorf("glusterfs: error creating volume %v ", err) @@ -680,6 +677,8 @@ func parseClassParameters(params map[string]string, kubeClient clientset.Interfa cfg.secretName = v case "secretnamespace": cfg.secretNamespace = v + case "clusterid": + cfg.clusterId = v case "restauthenabled": authEnabled = dstrings.ToLower(v) == "true" default: