Documentation
¶
Overview ¶
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func DeleteNS(c *kubernetes.Clientset, ns string) error
- func GetKubeClientFromRESTConfig(config *rest.Config) (*kubernetes.Clientset, error)
- func VerifyPVCIsEmpty(f *Framework, pvc *k8sv1.PersistentVolumeClaim) bool
- type Config
- type ExecOptions
- type Framework
- func (f *Framework) AddNamespaceToDelete(ns *v1.Namespace)
- func (f *Framework) AfterEach()
- func (f *Framework) BeforeEach()
- func (f *Framework) CreateAndPopulateSourcePVC(pvcName string, podName string, fillCommand string) *k8sv1.PersistentVolumeClaim
- func (f *Framework) CreateExecutorPodWithPVC(podName string, pvc *k8sv1.PersistentVolumeClaim) (*k8sv1.Pod, error)
- func (f *Framework) CreateNamespace(prefix string, labels map[string]string) (*v1.Namespace, error)
- func (f *Framework) CreatePVCFromDefinition(def *k8sv1.PersistentVolumeClaim) (*k8sv1.PersistentVolumeClaim, error)
- func (f *Framework) CreatePod(podDef *k8sv1.Pod) (*k8sv1.Pod, error)
- func (f *Framework) DeletePVC(pvc *k8sv1.PersistentVolumeClaim) error
- func (f *Framework) DeletePod(pod *k8sv1.Pod) error
- func (f *Framework) ExecCommandInContainer(namespace, podName, containerName string, cmd ...string) string
- func (f *Framework) ExecCommandInContainerWithFullOutput(namespace, podName, containerName string, cmd ...string) (string, string, error)
- func (f *Framework) ExecCommandInPod(podName, namespace string, cmd ...string) string
- func (f *Framework) ExecCommandInPodWithFullOutput(namespace, podName string, cmd ...string) (string, string, error)
- func (f *Framework) ExecShellInContainer(podName, containerName string, cmd string) string
- func (f *Framework) ExecShellInPod(podName, namespace string, cmd string) string
- func (f *Framework) ExecShellInPodWithFullOutput(podName string, cmd string) (string, string, error)
- func (f *Framework) ExecWithOptions(options ExecOptions) (string, string, error)
- func (f *Framework) FindPVC(pvcName string) (*k8sv1.PersistentVolumeClaim, error)
- func (f *Framework) FindPodByPrefix(prefix string) (*k8sv1.Pod, error)
- func (f *Framework) GetCdiClient() (*cdiClientset.Clientset, error)
- func (f *Framework) GetKubeClient() (*kubernetes.Clientset, error)
- func (f *Framework) LoadConfig() (*rest.Config, error)
- func (f *Framework) VerifyTargetPVCContent(namespace *k8sv1.Namespace, pvc *k8sv1.PersistentVolumeClaim, fileName string, ...) bool
- func (f *Framework) WaitForPersistentVolumeClaimPhase(phase k8sv1.PersistentVolumeClaimPhase, pvcName string) error
- func (f *Framework) WaitTimeoutForPodReady(podName string, timeout time.Duration) error
- func (f *Framework) WaitTimeoutForPodStatus(podName string, status k8sv1.PodPhase, timeout time.Duration) error
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func DeleteNS ¶
func DeleteNS(c *kubernetes.Clientset, ns string) error
func GetKubeClientFromRESTConfig ¶
func GetKubeClientFromRESTConfig(config *rest.Config) (*kubernetes.Clientset, error)
func VerifyPVCIsEmpty ¶
func VerifyPVCIsEmpty(f *Framework, pvc *k8sv1.PersistentVolumeClaim) bool
Verify passed in PVC is empty, returns true if the PVC is empty, false if it is not.
Types ¶
type Config ¶
type ExecOptions ¶
type ExecOptions struct {
Command []string
Namespace string
PodName string
ContainerName string
Stdin io.Reader
CaptureStdout bool
CaptureStderr bool
// If false, whitespace in std{err,out} will be removed.
PreserveWhitespace bool
}
ExecOptions passed to ExecWithOptions
type Framework ¶
type Framework struct {
Config
// prefix for generated namespace
NsPrefix string
// k8s client
K8sClient *kubernetes.Clientset
// cdi client
CdiClient *cdiClientset.Clientset
// REST client config.
RestConfig *rest.Config
// generated/unique ns per test
Namespace *v1.Namespace
// generated/unique secondary ns for testing across namespaces (eg. clone tests)
Namespace2 *v1.Namespace // note: not instantiated in NewFramework
ControllerPod *v1.Pod
// test run-time flags
KubectlPath string
OcPath string
CdiInstallNs string
KubeConfig string
Master string
// contains filtered or unexported fields
}
Framework supports common operations used by functional/e2e tests. It holds the k8s and cdi clients, a generated unique namespace, run-time flags, and more fields will be added over time as cdi e2e evolves. Global BeforeEach and AfterEach are called in the Framework constructor.
func NewFramework ¶
NewFramework makes a new framework and sets up the global BeforeEach/AfterEach's. Test run-time flags are parsed and added to the Framework struct.
func NewFrameworkOrDie ¶
NewFrameworkOrDie calls NewFramework and handles errors by calling Fail. Config is optional, but if passed there can only be one.
func (*Framework) CreateAndPopulateSourcePVC ¶
func (*Framework) CreateExecutorPodWithPVC ¶
func (*Framework) CreateNamespace ¶
Instantiate a new namespace object with a unique name and the passed-in label(s).
func (*Framework) CreatePVCFromDefinition ¶
func (f *Framework) CreatePVCFromDefinition(def *k8sv1.PersistentVolumeClaim) (*k8sv1.PersistentVolumeClaim, error)
func (*Framework) DeletePVC ¶
func (f *Framework) DeletePVC(pvc *k8sv1.PersistentVolumeClaim) error
func (*Framework) ExecCommandInContainer ¶
func (f *Framework) ExecCommandInContainer(namespace, podName, containerName string, cmd ...string) string
ExecCommandInContainer executes a command in the specified container.
func (*Framework) ExecCommandInContainerWithFullOutput ¶
func (f *Framework) ExecCommandInContainerWithFullOutput(namespace, podName, containerName string, cmd ...string) (string, string, error)
ExecCommandInContainerWithFullOutput executes a command in the specified container and return stdout, stderr and error
func (*Framework) ExecCommandInPod ¶
func (*Framework) ExecCommandInPodWithFullOutput ¶
func (*Framework) ExecShellInContainer ¶
func (*Framework) ExecShellInPod ¶
func (*Framework) ExecShellInPodWithFullOutput ¶
func (*Framework) ExecWithOptions ¶
func (f *Framework) ExecWithOptions(options ExecOptions) (string, string, error)
ExecWithOptions executes a command in the specified container, returning stdout, stderr and error. `options` allowed for additional parameters to be passed.
func (*Framework) FindPVC ¶
func (f *Framework) FindPVC(pvcName string) (*k8sv1.PersistentVolumeClaim, error)
func (*Framework) FindPodByPrefix ¶
func (*Framework) GetCdiClient ¶
func (f *Framework) GetCdiClient() (*cdiClientset.Clientset, error)
Gets an instance of a kubernetes client that includes all the CDI extensions.
func (*Framework) GetKubeClient ¶
func (f *Framework) GetKubeClient() (*kubernetes.Clientset, error)
func (*Framework) VerifyTargetPVCContent ¶
func (*Framework) WaitForPersistentVolumeClaimPhase ¶
func (f *Framework) WaitForPersistentVolumeClaimPhase(phase k8sv1.PersistentVolumeClaimPhase, pvcName string) error
func (*Framework) WaitTimeoutForPodReady ¶
Source Files
¶
- exec_util.go
- framework.go
- pod.go
- pvc.go