// Provision creates a PersistentVolume, sets quota and shares it via NFS.
Provision creates a PersistentVolume, sets quota and shares it via NFS.
// Provision creates a PersistentVolume sets quota and shares it via NFS .
func (p ZFSProvisioner) Provision(options controller.VolumeOptions) (*v1.PersistentVolume, error) {
	path, err := p.createVolume(options)
	if err != nil {
		return nil, err
	}
	log.WithFields(log.Fields{
		"volume": path,
	}).Info("Created volume")
	annotations := make(map[string]string)
	annotations[annCreatedBy] = createdBy
	pv := &v1.PersistentVolume{
		ObjectMeta: metav1.ObjectMeta{
			Name:        options.PVName,
			Labels:      map[string]string{},
			Annotations: annotations,
		},
		Spec: v1.PersistentVolumeSpec{
			PersistentVolumeReclaimPolicy: p.reclaimPolicy,
			AccessModes:                   options.PVC.Spec.AccessModes,
			Capacity: v1.ResourceList{
				v1.ResourceName(v1.ResourceStorage): options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)],
			},
			PersistentVolumeSource: v1.PersistentVolumeSource{
				NFS: &v1.NFSVolumeSource{
					Server:   p.serverHostname,
					Path:     path,
					ReadOnly: false,
				},
			},
		},
	}
	log.Debug("Returning pv:")
	log.Debug(*pv)
	return pv, nil
}
func ( p ZFSProvisioner ) Provision ( options controller . VolumeOptions ) ( * v1 . PersistentVolume , error ) { path , err := p . createVolume ( options ) if err != nil { return nil , err } log . WithFields ( log . Fields { " " : path , } ) . Info ( " " ) annotations := make ( map [ string ] string ) annotations [ annCreatedBy ] = createdBy pv := & v1 . PersistentVolume { ObjectMeta : metav1 . ObjectMeta { Name : options . PVName , Labels : map [ string ] string { } , Annotations : annotations , } , Spec : v1 . PersistentVolumeSpec { PersistentVolumeReclaimPolicy : p . reclaimPolicy , AccessModes : options . PVC . Spec . AccessModes , Capacity : v1 . ResourceList { v1 . ResourceName ( v1 . ResourceStorage ) : options . PVC . Spec . Resources . Requests [ v1 . ResourceName ( v1 . ResourceStorage ) ] , } , PersistentVolumeSource : v1 . PersistentVolumeSource { NFS : & v1 . NFSVolumeSource { Server : p . serverHostname , Path : path , ReadOnly : false , } , } , } , } log . Debug ( " " ) log . Debug ( * pv ) return pv , nil }
Provision creates a PersistentVolume, sets quota and shares it via NFS.
Provision creates a PersistentVolume sets quota and shares it via NFS .
// See nfs provisioner in github.com/kubernetes-incubator/external-storage for why we annotate this way and if it's still allowed