Created
May 21, 2019 18:34
-
-
Save ddebroy/03b39c4e256092cd0d20a1e2892f3e31 to your computer and use it in GitHub Desktop.
external provisioner for targetd that returns Microsoft iSCSI flexvolume PV source
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/iscsi/targetd/provisioner/iscsi-provisioner.go b/iscsi/targetd/provisioner/iscsi-provisioner.go | |
| index b3f2c97a..1c1264da 100644 | |
| --- a/iscsi/targetd/provisioner/iscsi-provisioner.go | |
| +++ b/iscsi/targetd/provisioner/iscsi-provisioner.go | |
| @@ -126,11 +126,6 @@ func (p *iscsiProvisioner) Provision(options controller.VolumeOptions) (*v1.Pers | |
| annotations["pool"] = pool | |
| annotations["initiators"] = options.Parameters["initiators"] | |
| - var portals []string | |
| - if len(options.Parameters["portals"]) > 0 { | |
| - portals = strings.Split(options.Parameters["portals"], ",") | |
| - } | |
| - | |
| pv := &v1.PersistentVolume{ | |
| ObjectMeta: metav1.ObjectMeta{ | |
| Name: options.PVName, | |
| @@ -146,17 +141,17 @@ func (p *iscsiProvisioner) Provision(options controller.VolumeOptions) (*v1.Pers | |
| // set volumeMode from PVC Spec | |
| VolumeMode: options.PVC.Spec.VolumeMode, | |
| PersistentVolumeSource: v1.PersistentVolumeSource{ | |
| - ISCSI: &v1.ISCSIPersistentVolumeSource{ | |
| - TargetPortal: options.Parameters["targetPortal"], | |
| - Portals: portals, | |
| - IQN: options.Parameters["iqn"], | |
| - ISCSIInterface: options.Parameters["iscsiInterface"], | |
| - Lun: lun, | |
| - ReadOnly: getReadOnly(options.Parameters["readonly"]), | |
| - FSType: getFsType(options.Parameters["fsType"]), | |
| - DiscoveryCHAPAuth: getBool(options.Parameters["chapAuthDiscovery"]), | |
| - SessionCHAPAuth: getBool(options.Parameters["chapAuthSession"]), | |
| - SecretRef: getSecretRef(getBool(options.Parameters["chapAuthDiscovery"]), getBool(options.Parameters["chapAuthSession"]), &v1.SecretReference{Name: viper.GetString("provisioner-name") + "-chap-secret"}), | |
| + FlexVolume: &v1.FlexPersistentVolumeSource { | |
| + Driver: "microsoft.com/iscsi.cmd", | |
| + FSType: getFsType(options.Parameters["fsType"]), | |
| + Options: map[string]string{ | |
| + "chapAuthDiscovery": options.Parameters["chapAuthDiscovery"], | |
| + "chapAuthSession": options.Parameters["chapAuthSession"], | |
| + "iqn": options.Parameters["iqn"], | |
| + "lun": strconv.FormatInt(int64(lun), 10), | |
| + "targetPortal": options.Parameters["targetPortal"], | |
| + }, | |
| + ReadOnly: getReadOnly(options.Parameters["readonly"]), | |
| }, | |
| }, | |
| }, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment