func populateVolumeSource(volumeSource *api.VolumeSource, userVolumeSource map[string]interface{}) *api.VolumeSource {
	if _, ok := userVolumeSource["host_path"]; ok {
		volumeSource.HostPath = HostPathVolumeSource(userVolumeSource["host_path"].(map[string]interface{}))
	}

	if _, ok := userVolumeSource["empty_dir"]; ok {
		volumeSource.EmptyDir = EmptyDirVolumeSource(userVolumeSource["empty_dir"].(map[string]interface{}))
	}

	if _, ok := userVolumeSource["gce_persistent_disk"]; ok {
		volumeSource.GCEPersistentDisk = GCEPersistentDiskVolumeSource(userVolumeSource["gce_persistent_disk"].(map[string]interface{}))
	}

	if _, ok := userVolumeSource["aws_elastic_block_store"]; ok {
		volumeSource.AWSElasticBlockStore = AWSElasticBlockStoreVolumeSource(userVolumeSource["aws_elastic_block_store"].(map[string]interface{}))
	}

	if _, ok := userVolumeSource["git_repo"]; ok {
		volumeSource.GitRepo = GitRepoVolumeSource(userVolumeSource["git_repo"].(map[string]interface{}))
	}

	if _, ok := userVolumeSource["secret"]; ok {
		volumeSource.Secret = SecretVolumeSource(userVolumeSource["secret"].(map[string]interface{}))
	}

	if _, ok := userVolumeSource["persistent_volume_claim"]; ok {
		volumeSource.PersistentVolumeClaim = PersistentVolumeClaimVolumeSource(userVolumeSource["persistent_volume_claim"].(map[string]interface{}))
	}

	return volumeSource
}
Exemplo n.º 2
0
func deepCopy_api_VolumeSource(in api.VolumeSource, out *api.VolumeSource, c *conversion.Cloner) error {
	if in.HostPath != nil {
		out.HostPath = new(api.HostPathVolumeSource)
		if err := deepCopy_api_HostPathVolumeSource(*in.HostPath, out.HostPath, c); err != nil {
			return err
		}
	} else {
		out.HostPath = nil
	}
	if in.EmptyDir != nil {
		out.EmptyDir = new(api.EmptyDirVolumeSource)
		if err := deepCopy_api_EmptyDirVolumeSource(*in.EmptyDir, out.EmptyDir, c); err != nil {
			return err
		}
	} else {
		out.EmptyDir = nil
	}
	if in.GCEPersistentDisk != nil {
		out.GCEPersistentDisk = new(api.GCEPersistentDiskVolumeSource)
		if err := deepCopy_api_GCEPersistentDiskVolumeSource(*in.GCEPersistentDisk, out.GCEPersistentDisk, c); err != nil {
			return err
		}
	} else {
		out.GCEPersistentDisk = nil
	}
	if in.AWSElasticBlockStore != nil {
		out.AWSElasticBlockStore = new(api.AWSElasticBlockStoreVolumeSource)
		if err := deepCopy_api_AWSElasticBlockStoreVolumeSource(*in.AWSElasticBlockStore, out.AWSElasticBlockStore, c); err != nil {
			return err
		}
	} else {
		out.AWSElasticBlockStore = nil
	}
	if in.GitRepo != nil {
		out.GitRepo = new(api.GitRepoVolumeSource)
		if err := deepCopy_api_GitRepoVolumeSource(*in.GitRepo, out.GitRepo, c); err != nil {
			return err
		}
	} else {
		out.GitRepo = nil
	}
	if in.Secret != nil {
		out.Secret = new(api.SecretVolumeSource)
		if err := deepCopy_api_SecretVolumeSource(*in.Secret, out.Secret, c); err != nil {
			return err
		}
	} else {
		out.Secret = nil
	}
	if in.NFS != nil {
		out.NFS = new(api.NFSVolumeSource)
		if err := deepCopy_api_NFSVolumeSource(*in.NFS, out.NFS, c); err != nil {
			return err
		}
	} else {
		out.NFS = nil
	}
	if in.ISCSI != nil {
		out.ISCSI = new(api.ISCSIVolumeSource)
		if err := deepCopy_api_ISCSIVolumeSource(*in.ISCSI, out.ISCSI, c); err != nil {
			return err
		}
	} else {
		out.ISCSI = nil
	}
	if in.Glusterfs != nil {
		out.Glusterfs = new(api.GlusterfsVolumeSource)
		if err := deepCopy_api_GlusterfsVolumeSource(*in.Glusterfs, out.Glusterfs, c); err != nil {
			return err
		}
	} else {
		out.Glusterfs = nil
	}
	if in.PersistentVolumeClaim != nil {
		out.PersistentVolumeClaim = new(api.PersistentVolumeClaimVolumeSource)
		if err := deepCopy_api_PersistentVolumeClaimVolumeSource(*in.PersistentVolumeClaim, out.PersistentVolumeClaim, c); err != nil {
			return err
		}
	} else {
		out.PersistentVolumeClaim = nil
	}
	if in.RBD != nil {
		out.RBD = new(api.RBDVolumeSource)
		if err := deepCopy_api_RBDVolumeSource(*in.RBD, out.RBD, c); err != nil {
			return err
		}
	} else {
		out.RBD = nil
	}
	if in.Cinder != nil {
		out.Cinder = new(api.CinderVolumeSource)
		if err := deepCopy_api_CinderVolumeSource(*in.Cinder, out.Cinder, c); err != nil {
			return err
		}
	} else {
		out.Cinder = nil
	}
	if in.CephFS != nil {
		out.CephFS = new(api.CephFSVolumeSource)
		if err := deepCopy_api_CephFSVolumeSource(*in.CephFS, out.CephFS, c); err != nil {
			return err
		}
	} else {
		out.CephFS = nil
	}
	if in.DownwardAPI != nil {
		out.DownwardAPI = new(api.DownwardAPIVolumeSource)
		if err := deepCopy_api_DownwardAPIVolumeSource(*in.DownwardAPI, out.DownwardAPI, c); err != nil {
			return err
		}
	} else {
		out.DownwardAPI = nil
	}
	if in.FC != nil {
		out.FC = new(api.FCVolumeSource)
		if err := deepCopy_api_FCVolumeSource(*in.FC, out.FC, c); err != nil {
			return err
		}
	} else {
		out.FC = nil
	}
	return nil
}