// StartStorageProvisioner will start storage provisioner server
773440
func StartStorageProvisioner() error {
	glog.Infof("Initializing the Minikube storage provisioner...")
	config, err := restclient.InClusterConfig()
	if err != nil {
		return err
	}
	clientset, err := kubernetes.NewForConfig(config)
	if err != nil {
		glog.Fatalf("Failed to create client: %v", err)
	}

	// The controller needs to know what the server version is because out-of-tree
	// provisioners aren't officially supported until 1.5
	serverVersion, err := clientset.Discovery().ServerVersion()
	if err != nil {
		return fmt.Errorf("Error getting server version: %v", err)
	}

	// Create the provisioner: it implements the Provisioner interface expected by
	// the controller
	hostPathProvisioner := NewHostPathProvisioner()

	// Start the provision controller which will dynamically provision hostPath
	// PVs
	pc := controller.NewProvisionController(clientset, provisionerName, hostPathProvisioner, serverVersion.GitVersion)

	glog.Info("Storage provisioner initialized, now starting service!")
	pc.Run(wait.NeverStop)
	return nil
}
1080220
func (k *kubernetesClient) EnsureStorageProvisioner(cfg caas.StorageProvisioner) (*caas.StorageProvisioner, error) {
	// First see if the named storage class exists.
	sc, err := k.getStorageClass(cfg.Name)
	if err == nil {
		return &caas.StorageProvisioner{
			Name:        sc.Name,
			Provisioner: sc.Provisioner,
			Parameters:  sc.Parameters,
		}, nil
	}
	if !k8serrors.IsNotFound(err) {
		return nil, errors.Annotatef(err, "getting storage class %q", cfg.Name)
	}
	// If it's not found but there's no provisioner specified, we can't
	// create it so just return not found.
	if cfg.Provisioner == "" {
		return nil, errors.NewNotFound(nil,
			fmt.Sprintf("storage class %q doesn't exist, but no storage provisioner has been specified",
				cfg.Name))
	}

	// Create the storage class with the specified provisioner.
	var reclaimPolicy *core.PersistentVolumeReclaimPolicy
	if cfg.ReclaimPolicy != "" {
		policy := core.PersistentVolumeReclaimPolicy(cfg.ReclaimPolicy)
		reclaimPolicy = &policy
	}
	storageClasses := k.client().StorageV1().StorageClasses()
	sc = &k8sstorage.StorageClass{
		ObjectMeta: v1.ObjectMeta{
			Name: qualifiedStorageClassName(cfg.Namespace, cfg.Name),
		},
		Provisioner:   cfg.Provisioner,
		ReclaimPolicy: reclaimPolicy,
		Parameters:    cfg.Parameters,
	}
	if cfg.Namespace != "" {
		sc.Labels = map[string]string{labelModel: k.namespace}
	}
	_, err = storageClasses.Create(sc)
	if err != nil {
		return nil, errors.Annotatef(err, "creating storage class %q", cfg.Name)
	}
	return &caas.StorageProvisioner{
		Name:        sc.Name,
		Provisioner: sc.Provisioner,
		Parameters:  sc.Parameters,
	}, nil
}
642442
func (*environ) StorageProvider(t storage.ProviderType) (storage.Provider, error) {
	return nil, errors.NotFoundf("storage provider %q", t)
}
934171
func (env *environ) StorageProvider(t storage.ProviderType) (storage.Provider, error) {
	if env.storageSupported() && t == lxdStorageProviderType {
		return &lxdStorageProvider{env}, nil
	}
	return nil, errors.NotFoundf("storage provider %q", t)
}
805639
func NewNFSProvisioner(exportDir string, client kubernetes.Interface, outOfCluster bool, useGanesha bool, ganeshaConfig string, enableXfsQuota bool, serverHostname string, maxExports int, exportSubnet string) controller.Provisioner {
	var exp exporter
	if useGanesha {
		exp = newGaneshaExporter(ganeshaConfig)
	} else {
		exp = newKernelExporter()
	}
	var quotaer quotaer
	var err error
	if enableXfsQuota {
		quotaer, err = newXfsQuotaer(exportDir)
		if err != nil {
			glog.Fatalf("Error creating xfs quotaer! %v", err)
		}
	} else {
		quotaer = newDummyQuotaer()
	}
	return newNFSProvisionerInternal(exportDir, client, outOfCluster, exp, quotaer, serverHostname, maxExports, exportSubnet)
}
1262826
func NewProvisionerAPIV4(st *state.State, resources facade.Resources, authorizer facade.Authorizer) (*ProvisionerAPIV4, error) {
	provisionerAPI, err := NewProvisionerAPIV5(st, resources, authorizer)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return &ProvisionerAPIV4{provisionerAPI}, nil
}
237384
func NewDisembedderProvisioner(d Disembedder, pathAstilectron, pathElectron string) Provisioner {
	return &defaultProvisioner{
		moverAstilectron: func(ctx context.Context, p Paths) (err error) {
			if err = Disembed(ctx, d, pathAstilectron, p.AstilectronDownloadDst()); err != nil {
				return errors.Wrapf(err, "disembedding %s into %s failed", pathAstilectron, p.AstilectronDownloadDst())
			}
			return
		},
		moverElectron: func(ctx context.Context, p Paths) (err error) {
			if err = Disembed(ctx, d, pathElectron, p.ElectronDownloadDst()); err != nil {
				return errors.Wrapf(err, "disembedding %s into %s failed", pathElectron, p.ElectronDownloadDst())
			}
			return
		},
	}
}
1188141
func NewEnvironProvisioner(st *apiprovisioner.State,
	agentConfig agent.Config,
	environ environs.Environ,
	credentialAPI common.CredentialAPI,
) (Provisioner, error) {
	p := &environProvisioner{
		provisioner: provisioner{
			st:                      st,
			agentConfig:             agentConfig,
			toolsFinder:             getToolsFinder(st),
			distributionGroupFinder: getDistributionGroupFinder(st),
			callContext:             common.NewCloudCallContext(credentialAPI, nil),
		},
		environ: environ,
	}
	p.Provisioner = p
	p.broker = environ
	logger.Tracef("Starting environ provisioner for %q", p.agentConfig.Tag())

	err := catacomb.Invoke(catacomb.Plan{
		Site: &p.catacomb,
		Work: p.loop,
	})
	if err != nil {
		return nil, errors.Trace(err)
	}
	return p, nil
}
682398
func BlobDescriptorCacheProvider(blobDescriptorCacheProvider cache.BlobDescriptorCacheProvider) RegistryOption {
	// TODO(aaronl): The duplication of statter across several objects is
	// ugly, and prevents us from using interface types in the registry
	// struct. Ideally, blobStore and blobServer should be lazily
	// initialized, and use the current value of
	// blobDescriptorCacheProvider.
	return func(registry *registry) error {
		if blobDescriptorCacheProvider != nil {
			statter := cache.NewCachedBlobStatter(blobDescriptorCacheProvider, registry.statter)
			registry.blobStore.statter = statter
			registry.blobServer.statter = statter
			registry.blobDescriptorCacheProvider = blobDescriptorCacheProvider
		}
		return nil
	}
}
980972
func (_class PVSCacheStorageClass) Create(sessionID SessionRef, args PVSCacheStorageRecord) (_retval PVSCacheStorageRef, _err error) {
	_method := "PVS_cache_storage.create"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_argsArg, _err := convertPVSCacheStorageRecordToXen(fmt.Sprintf("%s(%s)", _method, "args"), args)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _argsArg)
	if _err != nil {
		return
	}
	_retval, _err = convertPVSCacheStorageRefToGo(_method + " -> ", _result.Value)
	return
}
642565
func (r ChainedProviderRegistry) StorageProvider(t ProviderType) (Provider, error) {
	for _, r := range r {
		p, err := r.StorageProvider(t)
		if err == nil {
			return p, nil
		}
		if errors.IsNotFound(err) {
			continue
		}
		return nil, errors.Annotatef(err, "getting storage provider %q", t)
	}
	return nil, errors.NotFoundf("storage provider %q", t)
}
36112
func provision(baseDirectoryPath string, fnA RestoreAssets, fnP CustomProvision) (err error) {
	// Provision resources
	// TODO Handle upgrades and therefore removing the resources folder accordingly
	var pr = filepath.Join(baseDirectoryPath, "resources")
	if _, err = os.Stat(pr); os.IsNotExist(err) {
		// Restore assets
		astilog.Debugf("Restoring assets in %s", baseDirectoryPath)
		if err = fnA(baseDirectoryPath, "resources"); err != nil {
			err = errors.Wrapf(err, "restoring assets in %s failed", baseDirectoryPath)
			return
		}
	} else if err != nil {
		err = errors.Wrapf(err, "stating %s failed", pr)
		return
	} else {
		astilog.Debugf("%s already exists, skipping restoring assets...", pr)
	}

	// Custom provision
	if fnP != nil {
		if err = fnP(baseDirectoryPath); err != nil {
			err = errors.Wrap(err, "custom provisioning failed")
			return
		}
	}
	return
}
365765
func (o *Strategy) SetProvisioningTimeout(v *ProvisioningTimeout) *Strategy {
	if o.ProvisioningTimeout = v; o.ProvisioningTimeout == nil {
		o.nullFields = append(o.nullFields, "ProvisioningTimeout")
	}
	return o
}
231649
func (c *Client) Provisioner() (packer.Provisioner, error) {
	client, err := c.packrpcClient()
	if err != nil {
		return nil, err
	}

	return &cmdProvisioner{client.Provisioner(), c}, nil
}
128119
func (r StaticProviderRegistry) StorageProvider(t ProviderType) (Provider, error) {
	p, ok := r.Providers[t]
	if ok {
		return p, nil
	}
	return nil, errors.NotFoundf("storage provider %q", t)
}
576362
func NewProvisionToken(token string, roles teleport.Roles, expires time.Time) (ProvisionToken, error) {
	t := &ProvisionTokenV2{
		Kind:    KindToken,
		Version: V2,
		Metadata: Metadata{
			Name:      token,
			Expires:   &expires,
			Namespace: defaults.Namespace,
		},
		Spec: ProvisionTokenSpecV2{
			Roles: roles,
		},
	}
	if err := t.CheckAndSetDefaults(); err != nil {
		return nil, trace.Wrap(err)
	}
	return t, nil
}
1330733
func (m *MockProvisioner_ProvisionResourceServer) SetHeader(arg0 metadata.MD) error {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "SetHeader", arg0)
	ret0, _ := ret[0].(error)
	return ret0
}