func New(client kubernetes.Interface, identifier string) controller.Provisioner {
	return &freenasProvisioner{
		Client:     client,
		Identifier: identifier,
	}
}
New creates a new client instance
package provisioner
import (
	"context"
	"fmt"
	"net/http"
	"strconv"
	"strings"
	"time"
	"github.com/golang/glog"
	"github.com/travisghansen/freenas-iscsi-provisioner/freenas"
	v1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/kubernetes"
	"sigs.k8s.io/sig-storage-lib-external-provisioner/v6/controller"
)
var (
	_ controller.Provisioner = &freenasProvisioner{}
)
type freenasProvisionerConfig struct {
	FSType        string
	ReclaimPolicy *v1.PersistentVolumeReclaimPolicy
	ProvisionerRollbackPartialFailures bool
	ProvisionerTargetPortal            string
	ProvisionerPortals                 string
	ProvisionerISCSINamePrefix         string
	ProvisionerISCSINameSuffix         string
	ProvisionerISCSIInterface          string
	DatasetParentName string
	TargetGroupAuthgroup      int
	TargetGroupAuthtype       string
	TargetGroupInitiatorgroup int
	TargetGroupPortalgroup    int
	DiscoveryCHAPAuth bool
	SessionCHAPAuth   bool
	AuthSecretRef     *v1.SecretReference
	ZvolCompression string
	ZvolDedup       string
	ZvolSparse      bool
	ZvolForce       bool
	ZvolBlocksize   string
	ExtentBlocksize                int
	ExtentDisablePhysicalBlocksize bool
	ExtentAvailThreshold           int
	ExtentInsecureTpc              bool
	ExtentXen                      bool
	ExtentRpm                      string
	ExtentReadOnly                 bool
	ServerSecretNamespace string
	ServerSecretName      string
	ServerProtocol        string
	ServerHost            string
	ServerPort            int
	ServerUsername        string
	ServerPassword        string
	ServerAllowInsecure   bool
}
func (p *freenasProvisioner) GetConfig(ctx context.Context, storageClassName string) (*freenasProvisionerConfig, error) {
	class, err := p.Client.StorageV1().StorageClasses().Get(ctx, storageClassName, metav1.GetOptions{})
	if err != nil {
		return nil, err
	}
	var fsType = "ext4"
	var provisionerRollbackPartialFailures = true
	var provisionerTargetPortal string
	var provisionerPortals string
	var provisionerISCSINamePrefix string
	var provisionerISCSINameSuffix string
	var provisionerISCSIInterface = "default"
	var datasetParentName = "tank"
	var targetGroupAuthgroup int
	var targetGroupAuthtype = "None"
	var targetGroupInitiatorgroup int
	var targetGroupPortalgroup int
	var targetDiscoveryCHAPAuth = false
	var targetSessionCHAPAuth = false
	var authSecretNamespace = "kube-system"
	var authSecretName = "freenas-iscsi-chap"
	var authSecretRef *v1.SecretReference
	var zvolCompression string
	var zvolDedup string
	var zvolSparse = true
	var zvolForce = false
	var zvolBlocksize string
	var extentBlocksize int
	var extentDisablePhysicalBlocksize = true
	var extentAvailThreshold int
	var extentInsecureTpc = true
	var extentXen = false
	var extentRpm string
	var extentReadOnly = false
	var serverSecretNamespace = "kube-system"
	var serverSecretName = "freenas-iscsi"
	var serverProtocol = "http"
	var serverHost = "localhost"
	var serverPort = 80
	var serverUsername = "root"
	var serverPassword string
	var serverAllowInsecure = false
	for k, v := range class.Parameters {
		switch k {
		case "fsType":
			fsType = v
		case "provisionerRollbackPartialFailures":
			provisionerRollbackPartialFailures, _ = strconv.ParseBool(v)
		case "provisionerTargetPortal":
			provisionerTargetPortal = v
		case "provisionerPortals":
			provisionerPortals = v
		case "provisionerISCSINamePrefix":
			provisionerISCSINamePrefix = v
		case "provisionerISCSINameSuffix":
			provisionerISCSINameSuffix = v
		case "provisionerISCSIInterface":
			provisionerISCSIInterface = v
		case "datasetParentName":
			datasetParentName = v
		case "targetGroupAuthgroup":
			targetGroupAuthgroup, _ = strconv.Atoi(v)
		case "targetGroupAuthtype":
			targetGroupAuthtype = v
		case "targetGroupInitiatorgroup":
			targetGroupInitiatorgroup, _ = strconv.Atoi(v)
		case "targetGroupPortalgroup":
			targetGroupPortalgroup, _ = strconv.Atoi(v)
		case "targetDiscoveryCHAPAuth":
			targetDiscoveryCHAPAuth, _ = strconv.ParseBool(v)
		case "targetSessionCHAPAuth":
			targetSessionCHAPAuth, _ = strconv.ParseBool(v)
		case "authSecretNamespace":
			authSecretNamespace = v
		case "authSecretName":
			authSecretName = v
		case "zvolCompression":
			zvolCompression = v
		case "zvolDedup":
			zvolDedup = v
		case "zvolSparse":
			zvolSparse, _ = strconv.ParseBool(v)
		case "zvolForce":
			zvolForce, _ = strconv.ParseBool(v)
		case "zvolBlocksize":
			zvolBlocksize = v
		case "extentBlocksize":
			extentBlocksize, _ = strconv.Atoi(v)
		case "extentDisablePhysicalBlocksize":
			extentDisablePhysicalBlocksize, _ = strconv.ParseBool(v)
		case "extentAvailThreshold":
			extentAvailThreshold, _ = strconv.Atoi(v)
		case "extentInsecureTpc":
			extentInsecureTpc, _ = strconv.ParseBool(v)
		case "extentXen":
			extentXen, _ = strconv.ParseBool(v)
		case "extentRpm":
			extentRpm = v
		case "extentReadOnly":
			extentReadOnly, _ = strconv.ParseBool(v)
		case "serverSecretNamespace":
			serverSecretNamespace = v
		case "serverSecretName":
			serverSecretName = v
		}
	}
	secret, err := p.GetSecret(ctx, serverSecretNamespace, serverSecretName)
	if err != nil {
		return nil, err
	}
	for k, v := range secret.Data {
		switch k {
		case "protocol":
			serverProtocol = BytesToString(v)
		case "host":
			serverHost = BytesToString(v)
		case "port":
			serverPort, _ = strconv.Atoi(BytesToString(v))
		case "username":
			serverUsername = BytesToString(v)
		case "password":
			serverPassword = BytesToString(v)
		case "allowInsecure":
			serverAllowInsecure, _ = strconv.ParseBool(BytesToString(v))
		}
	}
	if provisionerTargetPortal == "" {
		provisionerTargetPortal = serverHost + ":3260"
	}
	if targetDiscoveryCHAPAuth || targetSessionCHAPAuth {
		authSecretRef = &v1.SecretReference{
			Namespace: authSecretNamespace,
			Name:      authSecretName,
		}
	}
	return &freenasProvisionerConfig{
		FSType:        fsType,
		ReclaimPolicy: class.ReclaimPolicy,
		ProvisionerRollbackPartialFailures: provisionerRollbackPartialFailures,
		ProvisionerTargetPortal:            provisionerTargetPortal,
		ProvisionerPortals:                 provisionerPortals,
		ProvisionerISCSINamePrefix:         provisionerISCSINamePrefix,
		ProvisionerISCSINameSuffix:         provisionerISCSINameSuffix,
		ProvisionerISCSIInterface:          provisionerISCSIInterface,
		DatasetParentName: datasetParentName,
		TargetGroupAuthgroup:      targetGroupAuthgroup,
		TargetGroupAuthtype:       targetGroupAuthtype,
		TargetGroupInitiatorgroup: targetGroupInitiatorgroup,
		TargetGroupPortalgroup:    targetGroupPortalgroup,
		DiscoveryCHAPAuth: targetDiscoveryCHAPAuth,
		SessionCHAPAuth:   targetSessionCHAPAuth,
		AuthSecretRef:     authSecretRef,
		ZvolCompression: zvolCompression,
		ZvolDedup:       zvolDedup,
		ZvolSparse:      zvolSparse,
		ZvolForce:       zvolForce,
		ZvolBlocksize:   zvolBlocksize,
		ExtentBlocksize:                extentBlocksize,
		ExtentDisablePhysicalBlocksize: extentDisablePhysicalBlocksize,
		ExtentAvailThreshold:           extentAvailThreshold,
		ExtentInsecureTpc:              extentInsecureTpc,
		ExtentXen:                      extentXen,
		ExtentRpm:                      extentRpm,
		ExtentReadOnly:                 extentReadOnly,
		ServerSecretNamespace: serverSecretNamespace,
		ServerSecretName:      serverSecretName,
		ServerProtocol:        serverProtocol,
		ServerHost:            serverHost,
		ServerPort:            serverPort,
		ServerUsername:        serverUsername,
		ServerPassword:        serverPassword,
		ServerAllowInsecure:   serverAllowInsecure,
	}, nil
}
type freenasProvisioner struct {
	Client     kubernetes.Interface
	Identifier string
}