mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 18:28:13 +00:00 
			
		
		
		
	Merge pull request #45409 from humblec/glusterfs-code-cleanup
Automatic merge from submit-queue (batch tested with PRs 44727, 45409, 44968, 45122, 45493) More go friendly variable names. clusterId -> clusterID volumeId -> volumeID Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
		| @@ -111,13 +111,20 @@ parameters: | |||||||
|   volumetype: "replicate:3" |   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 | * `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. | `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. | * `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. | * `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`. | * `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". | * `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. | 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: | * `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. | "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. | * `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: | For example: | ||||||
|  |  | ||||||
|   'Replica volume': |   'Replica volume': | ||||||
|     `volumetype: replicate:3` where '3' is replica count. |     `volumetype: replicate:3` where '3' is replica count. | ||||||
|   'Disperse/EC volume': |   '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)) | 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 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)) | 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-<claimname>`. This dynamic endpoint and service will be deleted automatically when the persistent volume claim is deleted. | When the persistent volumes are dynamically provisioned, the Gluster plugin automatically create an endpoint and a headless service in the name `gluster-dynamic-<claimname>`. This dynamic endpoint and service will be deleted automatically when the persistent volume claim is deleted. | ||||||
|   | |||||||
| @@ -389,7 +389,7 @@ type provisionerConfig struct { | |||||||
| 	secretNamespace string | 	secretNamespace string | ||||||
| 	secretName      string | 	secretName      string | ||||||
| 	secretValue     string | 	secretValue     string | ||||||
| 	clusterId       string | 	clusterID       string | ||||||
| 	gidMin          int | 	gidMin          int | ||||||
| 	gidMax          int | 	gidMax          int | ||||||
| 	volumeType      gapi.VolumeDurabilityInfo | 	volumeType      gapi.VolumeDurabilityInfo | ||||||
| @@ -583,7 +583,7 @@ func (d *glusterfsVolumeDeleter) Delete() error { | |||||||
| 	var err error | 	var err error | ||||||
| 	glog.V(2).Infof("glusterfs: delete volume: %s ", d.glusterfsMounter.path) | 	glog.V(2).Infof("glusterfs: delete volume: %s ", d.glusterfsMounter.path) | ||||||
| 	volumeName := 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) | 	class, err := volutil.GetClassForVolume(d.plugin.host.GetKubeClient(), d.spec) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return err | 		return err | ||||||
| @@ -595,7 +595,7 @@ func (d *glusterfsVolumeDeleter) Delete() error { | |||||||
| 	} | 	} | ||||||
| 	d.provisionerConfig = *cfg | 	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() | 	gid, exists, err := d.getGid() | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| @@ -617,7 +617,7 @@ func (d *glusterfsVolumeDeleter) Delete() error { | |||||||
| 		glog.Errorf("glusterfs: failed to create glusterfs rest client") | 		glog.Errorf("glusterfs: failed to create glusterfs rest client") | ||||||
| 		return fmt.Errorf("glusterfs: failed to create glusterfs rest client, REST server authentication failed") | 		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 { | 	if err != nil { | ||||||
| 		glog.Errorf("glusterfs: error when deleting the volume :%v", err) | 		glog.Errorf("glusterfs: error when deleting the volume :%v", err) | ||||||
| 		return 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) { | 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)] | 	capacity := p.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)] | ||||||
| 	volSizeBytes := capacity.Value() | 	volSizeBytes := capacity.Value() | ||||||
| 	sz := int(volume.RoundUpSize(volSizeBytes, 1024*1024*1024)) | 	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") | 		glog.Errorf("glusterfs: failed to create glusterfs rest client") | ||||||
| 		return nil, 0, fmt.Errorf("failed to create glusterfs REST client, REST server authentication failed") | 		return nil, 0, fmt.Errorf("failed to create glusterfs REST client, REST server authentication failed") | ||||||
| 	} | 	} | ||||||
| 	if p.provisionerConfig.clusterId != "" { | 	if p.provisionerConfig.clusterID != "" { | ||||||
| 		clusterIds = dstrings.Split(p.clusterId, ",") | 		clusterIDs = dstrings.Split(p.clusterID, ",") | ||||||
| 		glog.V(4).Infof("glusterfs: provided clusterids: %v", clusterIds) | 		glog.V(4).Infof("glusterfs: provided clusterIDs: %v", clusterIDs) | ||||||
| 	} | 	} | ||||||
| 	gid64 := int64(gid) | 	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) | 	volume, err := cli.VolumeCreate(volumeReq) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		glog.Errorf("glusterfs: error creating volume %v ", err) | 		glog.Errorf("glusterfs: error creating volume %v ", err) | ||||||
| @@ -907,7 +907,7 @@ func parseClassParameters(params map[string]string, kubeClient clientset.Interfa | |||||||
| 			cfg.secretNamespace = v | 			cfg.secretNamespace = v | ||||||
| 		case "clusterid": | 		case "clusterid": | ||||||
| 			if len(v) != 0 { | 			if len(v) != 0 { | ||||||
| 				cfg.clusterId = v | 				cfg.clusterID = v | ||||||
| 			} | 			} | ||||||
| 		case "restauthenabled": | 		case "restauthenabled": | ||||||
| 			authEnabled = dstrings.ToLower(v) == "true" | 			authEnabled = dstrings.ToLower(v) == "true" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Kubernetes Submit Queue
					Kubernetes Submit Queue