Documentation ¶
Index ¶
- Constants
- func CreateDataVolumeFromDefinition(clientSet *cdiclientset.Clientset, namespace string, def *cdiv1.DataVolume) (*cdiv1.DataVolume, error)
- func CreateExecutorPodWithPVC(clientSet *kubernetes.Clientset, podName, namespace string, ...) (*k8sv1.Pod, error)
- func CreatePVCFromDefinition(clientSet *kubernetes.Clientset, namespace string, ...) (*k8sv1.PersistentVolumeClaim, error)
- func CreatePod(clientSet *kubernetes.Clientset, namespace string, podDef *k8sv1.Pod) (*k8sv1.Pod, error)
- func CreateSecretFromDefinition(c *kubernetes.Clientset, secret *v1.Secret) (*v1.Secret, error)
- func DeleteDataVolume(clientSet *cdiclientset.Clientset, namespace string, ...) error
- func DeletePVC(clientSet *kubernetes.Clientset, namespace string, ...) error
- func DeletePod(clientSet *kubernetes.Clientset, pod *k8sv1.Pod, namespace string) error
- func FindPVC(clientSet *kubernetes.Clientset, namespace, pvcName string) (*k8sv1.PersistentVolumeClaim, error)
- func FindPodByPrefix(clientSet *kubernetes.Clientset, namespace, prefix, labelSelector string) (*k8sv1.Pod, error)
- func FormatTestData(srcFile, tgtDir string, targetFormats ...string) (string, error)
- func GetServiceInNamespace(c *kubernetes.Clientset, ns, name string) (*v1.Service, error)
- func GetServiceInNamespaceOrDie(c *kubernetes.Clientset, ns, name string) *v1.Service
- func GetServicePortByName(svc *v1.Service, name string) (int, error)
- func GetServicesInNamespaceByLabel(c *kubernetes.Clientset, ns, labelSelector string) (*v1.ServiceList, error)
- func NewDataVolumeWithHttpImport(dataVolumeName string, size string, httpUrl string) *cdiv1.DataVolume
- func NewDataVolumeWithPVCImport(dataVolumeName string, size string, targetPvc *k8sv1.PersistentVolumeClaim) *cdiv1.DataVolume
- func NewPVCDefinition(pvcName string, size string, annotations, labels map[string]string) *k8sv1.PersistentVolumeClaim
- func NewPodWithPVC(podName, cmd string, pvc *k8sv1.PersistentVolumeClaim) *k8sv1.Pod
- func NewSecretDefinition(labels, stringData map[string]string, data map[string][]byte, ...) *v1.Secret
- func PodGetNode(clientSet *kubernetes.Clientset, podName, namespace string) (string, error)
- func WaitForDataVolumePhase(clientSet *cdiclientset.Clientset, namespace string, ...) error
- func WaitForDeploymentReplicasReady(c *kubernetes.Clientset, namespace, name string) error
- func WaitForDeploymentReplicasReadyOrDie(c *kubernetes.Clientset, namespace, name string)
- func WaitForPVCAnnotation(clientSet *kubernetes.Clientset, namespace string, ...) (string, bool, error)
- func WaitForPersistentVolumeClaimPhase(clientSet *kubernetes.Clientset, namespace string, ...) error
- func WaitTimeoutForPodReady(clientSet *kubernetes.Clientset, podName, namespace string, ...) error
- func WaitTimeoutForPodStatus(clientSet *kubernetes.Clientset, podName, namespace string, ...) error
Constants ¶
const ( // cdi-file-host pod/service relative values FileHostName = "cdi-file-host" // deployment and service name FileHostNs = "kube-system" // deployment and service namespace FileHostS3Bucket = "images" // s3 bucket name (e.g. http://<serviceIP:port>/FileHostS3Bucket/image) AccessKeyValue = "admin" // http && s3 username, see hack/build/docker/cdi-func-test-file-host-http/htpasswd SecretKeyValue = "password" // http && s3 password, ditto HttpAuthPortName = "http-auth" // cdi-file-host service auth port HttpNoAuthPortName = "http-no-auth" // cdi-file-host service no-auth port, requires AccessKeyValue and SecretKeyValue )
const ( DataVolumeCreateTime = 30 * time.Second DataVolumeDeleteTime = 30 * time.Second DataVolumePhaseTime = 30 * time.Second )
const ( PodCreateTime = defaultPollPeriod PodDeleteTime = defaultPollPeriod PodWaitForTime = defaultPollPeriod )
const ( DefaultPvcMountPath = "/pvc" PVCPollInterval = defaultPollInterval PVCCreateTime = defaultPollPeriod PVCDeleteTime = defaultPollPeriod PVCPhaseTime = defaultPollPeriod )
const ( SecretPollPeriod = defaultPollPeriod SecretPollInterval = defaultPollInterval )
const ( ServicePollInterval = defaultPollInterval ServicePollPeriod = defaultPollPeriod )
const (
TinyCoreIsoURL = "http://cdi-file-host.kube-system/tinyCore.iso"
)
Variables ¶
This section is empty.
Functions ¶
func CreateDataVolumeFromDefinition ¶
func CreateDataVolumeFromDefinition(clientSet *cdiclientset.Clientset, namespace string, def *cdiv1.DataVolume) (*cdiv1.DataVolume, error)
func CreateExecutorPodWithPVC ¶
func CreateExecutorPodWithPVC(clientSet *kubernetes.Clientset, podName, namespace string, pvc *k8sv1.PersistentVolumeClaim) (*k8sv1.Pod, error)
Create a Pod with the passed in PVC mounted under /pvc. You can then use the executor utilities to run commands against the PVC through this Pod.
func CreatePVCFromDefinition ¶
func CreatePVCFromDefinition(clientSet *kubernetes.Clientset, namespace string, def *k8sv1.PersistentVolumeClaim) (*k8sv1.PersistentVolumeClaim, error)
Creates a PVC in the passed in namespace from the passed in PersistentVolumeClaim definition. An example of creating a PVC without annotations looks like this: CreatePVCFromDefinition(client, namespace, NewPVCDefinition(name, size, nil, nil))
func DeleteDataVolume ¶
func DeleteDataVolume(clientSet *cdiclientset.Clientset, namespace string, dataVolume *cdiv1.DataVolume) error
Delete the passed in DataVolume
func DeletePVC ¶
func DeletePVC(clientSet *kubernetes.Clientset, namespace string, pvc *k8sv1.PersistentVolumeClaim) error
Delete the passed in PVC
func FindPVC ¶
func FindPVC(clientSet *kubernetes.Clientset, namespace, pvcName string) (*k8sv1.PersistentVolumeClaim, error)
Find the passed in PVC
func FindPodByPrefix ¶
func FindPodByPrefix(clientSet *kubernetes.Clientset, namespace, prefix, labelSelector string) (*k8sv1.Pod, error)
Finds the first pod which has the passed in prefix. Returns error if multiple pods with the same prefix are found.
func FormatTestData ¶
FormatTestData accepts the path of a single file (srcFile) and attempts to generate an output file in the format defined by targetFormats (e.g. ".tar", ".gz" will produce a .tar.gz formatted file). The output file is written to the directory in `tgtDir`. returns:
(string) Path of output file (error) Errors that occur during formatting
func GetServiceInNamespace ¶
GetServiceInNamespace retries get on service `name` in namespace `ns` until timeout or IsNotFound error. Ignores api errors that may be intermittent. Returns pointer to service (nil on error) or an error (nil on success)
func GetServiceInNamespaceOrDie ¶
func GetServiceInNamespaceOrDie(c *kubernetes.Clientset, ns, name string) *v1.Service
GetServiceInNamespaceOrDie attempts to get the service in namespace `ns` by `name`. Returns pointer to service on success. Panics on error.
func GetServicePortByName ¶
GetServicePortByName scan's a services ports for names matching `name`. Returns integer port value (0 on error) and error (nil on success).
func GetServicesInNamespaceByLabel ¶
func GetServicesInNamespaceByLabel(c *kubernetes.Clientset, ns, labelSelector string) (*v1.ServiceList, error)
GetServicesInNamespaceByLabel retries get of services in namespace `ns` by `labelSelector` until timeout. Ignores api errors that may be intermittent. Returns pointer to ServiceList (nil on error) and an error (nil on success)
func NewDataVolumeWithHttpImport ¶
func NewDataVolumeWithHttpImport(dataVolumeName string, size string, httpUrl string) *cdiv1.DataVolume
func NewDataVolumeWithPVCImport ¶
func NewDataVolumeWithPVCImport(dataVolumeName string, size string, targetPvc *k8sv1.PersistentVolumeClaim) *cdiv1.DataVolume
func NewPVCDefinition ¶
func NewPVCDefinition(pvcName string, size string, annotations, labels map[string]string) *k8sv1.PersistentVolumeClaim
Creates a PVC definition using the passed in name and requested size. You can use the following annotation keys to request an import or clone. The values are defined in the controller package AnnEndpoint AnnSecret AnnCloneRequest You can also pass in any label you want.
func NewPodWithPVC ¶
func NewPodWithPVC(podName, cmd string, pvc *k8sv1.PersistentVolumeClaim) *k8sv1.Pod
func NewSecretDefinition ¶
func PodGetNode ¶
func PodGetNode(clientSet *kubernetes.Clientset, podName, namespace string) (string, error)
func WaitForDataVolumePhase ¶
func WaitForDataVolumePhase(clientSet *cdiclientset.Clientset, namespace string, phase cdiv1.DataVolumePhase, dataVolumeName string) error
Wait for the DataVolume to be in a particular phase (Pending, Bound, or Lost)
func WaitForDeploymentReplicasReady ¶
func WaitForDeploymentReplicasReady(c *kubernetes.Clientset, namespace, name string) error
func WaitForDeploymentReplicasReadyOrDie ¶
func WaitForDeploymentReplicasReadyOrDie(c *kubernetes.Clientset, namespace, name string)
func WaitForPVCAnnotation ¶
func WaitForPVCAnnotation(clientSet *kubernetes.Clientset, namespace string, pvc *k8sv1.PersistentVolumeClaim, annotation string) (string, bool, error)
Wait for annotation on PVC
func WaitForPersistentVolumeClaimPhase ¶
func WaitForPersistentVolumeClaimPhase(clientSet *kubernetes.Clientset, namespace string, phase k8sv1.PersistentVolumeClaimPhase, pvcName string) error
Wait for the PVC to be in a particular phase (Pending, Bound, or Lost)
func WaitTimeoutForPodReady ¶
func WaitTimeoutForPodStatus ¶
Types ¶
This section is empty.