kubernetes: k8s.io/kubernetes/test/utils Index | Files | Directories

package utils

import "k8s.io/kubernetes/test/utils"

Index

Package Files

admission_webhook.go audit.go audit_dynamic.go conditions.go create_resources.go delete_resources.go density_utils.go deployment.go node.go paths.go pki_helpers.go pod_store.go replicaset.go runners.go tmpdir.go update_resources.go

Variables

var LocalhostCert = []byte("" /* 1136 byte string literal not displayed */)

LocalhostCert was generated from crypto/tls/generate_cert.go with the following command:

go run generate_cert.go  --rsa-bits 2048 --host 127.0.0.1,::1,example.com --ca --start-date "Jan 1 00:00:00 1970" --duration=1000000h
var LocalhostKey = []byte("" /* 1676 byte string literal not displayed */)

LocalhostKey is the private key for LocalhostCert.

func AddLabelsToNode Uses

func AddLabelsToNode(c clientset.Interface, nodeName string, labels map[string]string) error

func AdmissionWebhookHandler Uses

func AdmissionWebhookHandler(t *testing.T, admit func(*v1beta1.AdmissionReview) error) http.HandlerFunc

AdmissionWebhookHandler creates a HandlerFunc that decodes/encodes AdmissionReview and performs given admit function

func CheckDeploymentRevisionAndImage Uses

func CheckDeploymentRevisionAndImage(c clientset.Interface, ns, deploymentName, revision, image string) error

CheckDeploymentRevisionAndImage checks if the input deployment's and its new replica set's revision and image are as expected.

func CheckForDuplicates Uses

func CheckForDuplicates(el auditinternal.EventList) (auditinternal.EventList, error)

CheckForDuplicates checks a list for duplicate events

func CreateConfigMapWithRetries Uses

func CreateConfigMapWithRetries(c clientset.Interface, namespace string, obj *v1.ConfigMap) error

func CreateDaemonSetWithRetries Uses

func CreateDaemonSetWithRetries(c clientset.Interface, namespace string, obj *apps.DaemonSet) error

func CreateDeploymentWithRetries Uses

func CreateDeploymentWithRetries(c clientset.Interface, namespace string, obj *apps.Deployment) error

func CreateJobWithRetries Uses

func CreateJobWithRetries(c clientset.Interface, namespace string, obj *batch.Job) error

func CreatePersistentVolumeClaimWithRetries Uses

func CreatePersistentVolumeClaimWithRetries(c clientset.Interface, namespace string, obj *v1.PersistentVolumeClaim) error

func CreatePersistentVolumeWithRetries Uses

func CreatePersistentVolumeWithRetries(c clientset.Interface, obj *v1.PersistentVolume) error

func CreatePod Uses

func CreatePod(client clientset.Interface, namespace string, podCount int, podTemplate *v1.Pod) error

func CreatePodWithPersistentVolume Uses

func CreatePodWithPersistentVolume(client clientset.Interface, namespace string, claimTemplate *v1.PersistentVolumeClaim, factory volumeFactory, podTemplate *v1.Pod, count int) error

func CreatePodWithRetries Uses

func CreatePodWithRetries(c clientset.Interface, namespace string, obj *v1.Pod) error

func CreateRCWithRetries Uses

func CreateRCWithRetries(c clientset.Interface, namespace string, obj *v1.ReplicationController) error

func CreateReplicaSetWithRetries Uses

func CreateReplicaSetWithRetries(c clientset.Interface, namespace string, obj *apps.ReplicaSet) error

func CreateResourceQuotaWithRetries Uses

func CreateResourceQuotaWithRetries(c clientset.Interface, namespace string, obj *v1.ResourceQuota) error

func CreateSecretWithRetries Uses

func CreateSecretWithRetries(c clientset.Interface, namespace string, obj *v1.Secret) error

func CreateServiceWithRetries Uses

func CreateServiceWithRetries(c clientset.Interface, namespace string, obj *v1.Service) error

func DeleteResourceWithRetries Uses

func DeleteResourceWithRetries(c clientset.Interface, kind schema.GroupKind, namespace, name string, options *metav1.DeleteOptions) error

func DoCleanupNode Uses

func DoCleanupNode(client clientset.Interface, nodeName string, strategy PrepareNodeStrategy) error

func DoPrepareNode Uses

func DoPrepareNode(client clientset.Interface, node *v1.Node, strategy PrepareNodeStrategy) error

func EncodeCertPEM Uses

func EncodeCertPEM(cert *x509.Certificate) []byte

EncodeCertPEM returns PEM-endcoded certificate data

func FailedContainers Uses

func FailedContainers(pod *v1.Pod) map[string]ContainerFailures

FailedContainers inspects all containers in a pod and returns failure information for containers that have failed or been restarted. A map is returned where the key is the containerID and the value is a struct containing the restart and failure information

func GetCAdvisorRootDir Uses

func GetCAdvisorRootDir() (string, error)

GetCAdvisorRootDir returns the root directory for cAdvisor, if present in the gopath.

func GetK8sBuildOutputDir Uses

func GetK8sBuildOutputDir() (string, error)

GetK8sBuildOutputDir returns the build output directory for k8s

func GetK8sRootDir Uses

func GetK8sRootDir() (string, error)

GetK8sRootDir returns the root directory for kubernetes, if present in the gopath.

func GetNodeCondition Uses

func GetNodeCondition(status *v1.NodeStatus, conditionType v1.NodeConditionType) (int, *v1.NodeCondition)

GetNodeCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.

func IsRetryableAPIError Uses

func IsRetryableAPIError(err error) bool

func LogPodsOfDeployment Uses

func LogPodsOfDeployment(c clientset.Interface, deployment *apps.Deployment, rsList []*apps.ReplicaSet, logf LogfFn)

func LogReplicaSetsOfDeployment Uses

func LogReplicaSetsOfDeployment(deployment *apps.Deployment, allOldRSs []*apps.ReplicaSet, newRS *apps.ReplicaSet, logf LogfFn)

func MakePodSpec Uses

func MakePodSpec() v1.PodSpec

func MakeTempDirOrDie Uses

func MakeTempDirOrDie(prefix string, baseDir string) string

func NewAdmissionWebhookServer Uses

func NewAdmissionWebhookServer(handler http.Handler) (string, func(), error)

NewAdmissionWebhookServer sets up a webhook server with TLS enabled, returns URL and Close function for the server

func NewPrivateKey Uses

func NewPrivateKey() (*rsa.PrivateKey, error)

NewPrivateKey creates an RSA private key

func NewSignedCert Uses

func NewSignedCert(cfg *certutil.Config, key crypto.Signer, caCert *x509.Certificate, caKey crypto.Signer) (*x509.Certificate, error)

NewSignedCert creates a signed certificate using the given CA certificate and key

func PodNotReady Uses

func PodNotReady(p *v1.Pod) (bool, error)

PodNotReady checks whether pod p's has a ready condition of status false.

func PodRunningReady Uses

func PodRunningReady(p *v1.Pod) (bool, error)

PodRunningReady checks whether pod p's phase is running and it has a ready condition of status true.

func PodRunningReadyOrSucceeded Uses

func PodRunningReadyOrSucceeded(p *v1.Pod) (bool, error)

func RemoveLabelOffNode Uses

func RemoveLabelOffNode(c clientset.Interface, nodeName string, labelKeys []string) error

RemoveLabelOffNode is for cleaning up labels temporarily added to node, won't fail if target label doesn't exist or has been removed.

func RetryErrorCondition Uses

func RetryErrorCondition(condition wait.ConditionFunc) wait.ConditionFunc

func RetryWithExponentialBackOff Uses

func RetryWithExponentialBackOff(fn wait.ConditionFunc) error

Utility for retrying the given function with exponential backoff.

func RootDir Uses

func RootDir() (string, error)

RootDir gets the on-disk kubernetes source directory, returning an error is none is found

func RunDeployment Uses

func RunDeployment(config DeploymentConfig) error

RunDeployment Launches (and verifies correctness) of a Deployment and will wait for all pods it spawns to become "Running". It's the caller's responsibility to clean up externally (i.e. use the namespace lifecycle for handling Cleanup).

func RunJob Uses

func RunJob(config JobConfig) error

RunJob baunches (and verifies correctness) of a Job and will wait for all pods it spawns to become "Running". It's the caller's responsibility to clean up externally (i.e. use the namespace lifecycle for handling Cleanup).

func RunPodAndGetNodeName Uses

func RunPodAndGetNodeName(c clientset.Interface, pod *v1.Pod, timeout time.Duration) (string, error)

func RunRC Uses

func RunRC(config RCConfig) error

RunRC Launches (and verifies correctness) of a Replication Controller and will wait for all pods it spawns to become "Running". It's the caller's responsibility to clean up externally (i.e. use the namespace lifecycle for handling Cleanup).

func RunReplicaSet Uses

func RunReplicaSet(config ReplicaSetConfig) error

RunReplicaSet launches (and verifies correctness) of a ReplicaSet and waits until all the pods it launches to reach the "Running" state. It's the caller's responsibility to clean up externally (i.e. use the namespace lifecycle for handling Cleanup).

func ScaleResourceWithRetries Uses

func ScaleResourceWithRetries(scalesGetter scaleclient.ScalesGetter, namespace, name string, size uint, gvr schema.GroupVersionResource) error

func StartPods Uses

func StartPods(c clientset.Interface, replicas int, namespace string, podNamePrefix string,
    pod v1.Pod, waitForRunning bool, logFunc func(fmt string, args ...interface{})) error

Simplified version of RunRC, that does not create RC, but creates plain Pods. Optionally waits for pods to start running (if waitForRunning == true). The number of replicas must be non-zero.

func TerminatedContainers Uses

func TerminatedContainers(pod *v1.Pod) map[string]string

TerminatedContainers inspects all containers in a pod and returns a map of "container name: termination reason", for all currently terminated containers.

func UpdateDeploymentWithRetries Uses

func UpdateDeploymentWithRetries(c clientset.Interface, namespace, name string, applyUpdate UpdateDeploymentFunc, logf LogfFn, pollInterval, pollTimeout time.Duration) (*apps.Deployment, error)

func UpdateReplicaSetStatusWithRetries Uses

func UpdateReplicaSetStatusWithRetries(c clientset.Interface, namespace, name string, applyUpdate UpdateReplicaSetFunc, logf LogfFn, pollInterval, pollTimeout time.Duration) (*apps.ReplicaSet, error)

func UpdateReplicaSetWithRetries Uses

func UpdateReplicaSetWithRetries(c clientset.Interface, namespace, name string, applyUpdate UpdateReplicaSetFunc, logf LogfFn, pollInterval, pollTimeout time.Duration) (*apps.ReplicaSet, error)

func VerifyLabelsRemoved Uses

func VerifyLabelsRemoved(c clientset.Interface, nodeName string, labelKeys []string) error

VerifyLabelsRemoved checks if Node for given nodeName does not have any of labels from labelKeys. Return non-nil error if it does.

func WaitForDeploymentComplete Uses

func WaitForDeploymentComplete(c clientset.Interface, d *apps.Deployment, logf LogfFn, pollInterval, pollTimeout time.Duration) error

Waits for the deployment to complete, and don't check if rolling update strategy is broken. Rolling update strategy is used only during a rolling update, and can be violated in other situations, such as shortly after a scaling event or the deployment is just created.

func WaitForDeploymentCompleteAndCheckRolling Uses

func WaitForDeploymentCompleteAndCheckRolling(c clientset.Interface, d *apps.Deployment, logf LogfFn, pollInterval, pollTimeout time.Duration) error

Waits for the deployment to complete, and check rolling update strategy isn't broken at any times. Rolling update strategy should not be broken during a rolling update.

func WaitForDeploymentRevisionAndImage Uses

func WaitForDeploymentRevisionAndImage(c clientset.Interface, ns, deploymentName string, revision, image string, logf LogfFn, pollInterval, pollTimeout time.Duration) error

WaitForDeploymentRevisionAndImage waits for the deployment's and its new RS's revision and container image to match the given revision and image. Note that deployment revision and its new RS revision should be updated shortly, so we only wait for 1 minute here to fail early.

func WaitForDeploymentRollbackCleared Uses

func WaitForDeploymentRollbackCleared(c clientset.Interface, ns, deploymentName string, pollInterval, pollTimeout time.Duration) error

WaitForDeploymentRollbackCleared waits for given deployment either started rolling back or doesn't need to rollback.

func WaitForDeploymentUpdatedReplicasGTE Uses

func WaitForDeploymentUpdatedReplicasGTE(c clientset.Interface, ns, deploymentName string, minUpdatedReplicas int32, desiredGeneration int64, pollInterval, pollTimeout time.Duration) error

WaitForDeploymentUpdatedReplicasGTE waits for given deployment to be observed by the controller and has at least a number of updatedReplicas

func WaitForDeploymentWithCondition Uses

func WaitForDeploymentWithCondition(c clientset.Interface, ns, deploymentName, reason string, condType apps.DeploymentConditionType, logf LogfFn, pollInterval, pollTimeout time.Duration) error

func WaitForEnoughPodsWithLabelRunning Uses

func WaitForEnoughPodsWithLabelRunning(c clientset.Interface, ns string, label labels.Selector, replicas int) error

Wait up to 10 minutes for at least 'replicas' many pods to be Running and at least one matching pod exists. If 'replicas' is < 0, wait for all matching pods running.

func WaitForObservedDeployment Uses

func WaitForObservedDeployment(c clientset.Interface, ns, deploymentName string, desiredGeneration int64) error

func WaitForPodsWithLabelRunning Uses

func WaitForPodsWithLabelRunning(c clientset.Interface, ns string, label labels.Selector) error

Wait up to 10 minutes for all matching pods to become Running and at least one matching pod exists.

func WaitRSStable Uses

func WaitRSStable(t *testing.T, clientSet clientset.Interface, rs *apps.ReplicaSet, pollInterval, pollTimeout time.Duration) error

Verify .Status.Replicas is equal to .Spec.Replicas

func WaitUntilPodIsScheduled Uses

func WaitUntilPodIsScheduled(c clientset.Interface, name, namespace string, timeout time.Duration) (*v1.Pod, error)

type AuditEvent Uses

type AuditEvent struct {
    ID                 types.UID
    Level              auditinternal.Level
    Stage              auditinternal.Stage
    RequestURI         string
    Verb               string
    Code               int32
    User               string
    ImpersonatedUser   string
    ImpersonatedGroups string
    Resource           string
    Namespace          string
    RequestObject      bool
    ResponseObject     bool
    AuthorizeDecision  string

    // The Check functions in this package takes ownerships of these maps. You should
    // not reference these maps after calling the Check functions.
    AdmissionWebhookMutationAnnotations map[string]string
    AdmissionWebhookPatchAnnotations    map[string]string
}

AuditEvent is a simplified representation of an audit event for testing purposes

func CheckAuditList Uses

func CheckAuditList(el auditinternal.EventList, expected []AuditEvent) (missing []AuditEvent, err error)

CheckAuditList searches an audit event list for the expected audit events.

type AuditTestServer Uses

type AuditTestServer struct {
    Name            string
    LockedEventList *LockedEventList
    Server          *httptest.Server
    // contains filtered or unexported fields
}

AuditTestServer is a helper server for dynamic audit testing

func NewAuditTestServer Uses

func NewAuditTestServer(t *testing.T, name string) *AuditTestServer

NewAuditTestServer returns a new audit test server

func (*AuditTestServer) AppendEvents Uses

func (a *AuditTestServer) AppendEvents(events []auditinternal.Event)

AppendEvents will add the given events to the internal event list

func (*AuditTestServer) BuildSinkConfiguration Uses

func (a *AuditTestServer) BuildSinkConfiguration() *auditregv1alpha1.AuditSink

BuildSinkConfiguration creates a generic audit sink configuration for this server

func (*AuditTestServer) Close Uses

func (a *AuditTestServer) Close()

Close the server

func (*AuditTestServer) GetEventList Uses

func (a *AuditTestServer) GetEventList() auditinternal.EventList

GetEventList safely returns the internal event list

func (*AuditTestServer) Health Uses

func (a *AuditTestServer) Health() error

Health polls the server healthcheck until successful or the 30s timeout has been reached

func (*AuditTestServer) ResetEventList Uses

func (a *AuditTestServer) ResetEventList()

ResetEventList resets the internal event list

func (*AuditTestServer) WaitForEvents Uses

func (a *AuditTestServer) WaitForEvents(expected []AuditEvent) ([]AuditEvent, error)

WaitForEvents waits for the given events to arrive in the server or the 30s timeout is reached

func (*AuditTestServer) WaitForNumEvents Uses

func (a *AuditTestServer) WaitForNumEvents(numEvents int) error

WaitForNumEvents checks that at least the given number of events has arrived or the 30s timeout is reached

type ConfigMapConfig Uses

type ConfigMapConfig struct {
    Content   map[string]string
    Client    clientset.Interface
    Name      string
    Namespace string
    // If set this function will be used to print log lines instead of klog.
    LogFunc func(fmt string, args ...interface{})
}

func (*ConfigMapConfig) Run Uses

func (config *ConfigMapConfig) Run() error

func (*ConfigMapConfig) Stop Uses

func (config *ConfigMapConfig) Stop() error

type ContainerFailures Uses

type ContainerFailures struct {
    Restarts int
    // contains filtered or unexported fields
}

type CountToPodStrategy Uses

type CountToPodStrategy struct {
    Count    int
    Strategy TestPodCreateStrategy
}

type CountToStrategy Uses

type CountToStrategy struct {
    Count    int
    Strategy PrepareNodeStrategy
}

type DaemonConfig Uses

type DaemonConfig struct {
    Client    clientset.Interface
    Name      string
    Namespace string
    Image     string
    // If set this function will be used to print log lines instead of klog.
    LogFunc func(fmt string, args ...interface{})
    // How long we wait for DaemonSet to become running.
    Timeout time.Duration
}

func (*DaemonConfig) Run Uses

func (config *DaemonConfig) Run() error

type DeploymentConfig Uses

type DeploymentConfig struct {
    RCConfig
}

func (*DeploymentConfig) GetGroupResource Uses

func (config *DeploymentConfig) GetGroupResource() schema.GroupResource

func (*DeploymentConfig) GetGroupVersionResource Uses

func (config *DeploymentConfig) GetGroupVersionResource() schema.GroupVersionResource

func (*DeploymentConfig) GetKind Uses

func (config *DeploymentConfig) GetKind() schema.GroupKind

func (*DeploymentConfig) Run Uses

func (config *DeploymentConfig) Run() error

type JobConfig Uses

type JobConfig struct {
    RCConfig
}

func (*JobConfig) GetGroupResource Uses

func (config *JobConfig) GetGroupResource() schema.GroupResource

func (*JobConfig) GetGroupVersionResource Uses

func (config *JobConfig) GetGroupVersionResource() schema.GroupVersionResource

func (*JobConfig) GetKind Uses

func (config *JobConfig) GetKind() schema.GroupKind

func (*JobConfig) Run Uses

func (config *JobConfig) Run() error

type LabelNodePrepareStrategy Uses

type LabelNodePrepareStrategy struct {
    // contains filtered or unexported fields
}

func NewLabelNodePrepareStrategy Uses

func NewLabelNodePrepareStrategy(labelKey string, labelValue string) *LabelNodePrepareStrategy

func (*LabelNodePrepareStrategy) CleanupDependentObjects Uses

func (*LabelNodePrepareStrategy) CleanupDependentObjects(nodeName string, client clientset.Interface) error

func (*LabelNodePrepareStrategy) CleanupNode Uses

func (s *LabelNodePrepareStrategy) CleanupNode(node *v1.Node) *v1.Node

func (*LabelNodePrepareStrategy) PrepareDependentObjects Uses

func (*LabelNodePrepareStrategy) PrepareDependentObjects(node *v1.Node, client clientset.Interface) error

func (*LabelNodePrepareStrategy) PreparePatch Uses

func (s *LabelNodePrepareStrategy) PreparePatch(*v1.Node) []byte

type LockedEventList Uses

type LockedEventList struct {
    *sync.RWMutex
    EventList auditinternal.EventList
}

LockedEventList is an event list with a lock for concurrent access

func NewLockedEventList Uses

func NewLockedEventList() *LockedEventList

NewLockedEventList returns a new LockedEventList

type LogfFn Uses

type LogfFn func(format string, args ...interface{})

type MissingEventsReport Uses

type MissingEventsReport struct {
    FirstEventChecked *auditinternal.Event
    LastEventChecked  *auditinternal.Event
    NumEventsChecked  int
    MissingEvents     []AuditEvent
}

MissingEventsReport provides an analysis if any events are missing

func CheckAuditLines Uses

func CheckAuditLines(stream io.Reader, expected []AuditEvent, version schema.GroupVersion) (missingReport *MissingEventsReport, err error)

CheckAuditLines searches the audit log for the expected audit lines.

func (*MissingEventsReport) String Uses

func (m *MissingEventsReport) String() string

String returns a human readable string representation of the report

type NodeAllocatableStrategy Uses

type NodeAllocatableStrategy struct {
    // contains filtered or unexported fields
}

NodeAllocatableStrategy fills node.status.allocatable and csiNode.spec.drivers[*].allocatable. csiNode is created if it does not exist. On cleanup, any csiNode.spec.drivers[*].allocatable is set to nil.

func NewNodeAllocatableStrategy Uses

func NewNodeAllocatableStrategy(nodeAllocatable map[v1.ResourceName]string, csiNodeAllocatable map[string]*storagev1beta1.VolumeNodeResources, migratedPlugins []string) *NodeAllocatableStrategy

func (*NodeAllocatableStrategy) CleanupDependentObjects Uses

func (s *NodeAllocatableStrategy) CleanupDependentObjects(nodeName string, client clientset.Interface) error

func (*NodeAllocatableStrategy) CleanupNode Uses

func (s *NodeAllocatableStrategy) CleanupNode(node *v1.Node) *v1.Node

func (*NodeAllocatableStrategy) PrepareDependentObjects Uses

func (s *NodeAllocatableStrategy) PrepareDependentObjects(node *v1.Node, client clientset.Interface) error

func (*NodeAllocatableStrategy) PreparePatch Uses

func (s *NodeAllocatableStrategy) PreparePatch(node *v1.Node) []byte

type PodDiff Uses

type PodDiff map[string]*podInfo

PodDiff is a map of pod name to podInfos

func Diff Uses

func Diff(oldPods []*v1.Pod, curPods []*v1.Pod) PodDiff

Diff computes a PodDiff given 2 lists of pods.

func (PodDiff) DeletedPods Uses

func (p PodDiff) DeletedPods() []string

DeletedPods returns a slice of pods that were present at the beginning and then disappeared.

func (PodDiff) String Uses

func (p PodDiff) String(ignorePhases sets.String) string

Print formats and prints the give PodDiff.

type PodStore Uses

type PodStore struct {
    cache.Store

    Reflector *cache.Reflector
    // contains filtered or unexported fields
}

Convenient wrapper around cache.Store that returns list of v1.Pod instead of interface{}.

func NewPodStore Uses

func NewPodStore(c clientset.Interface, namespace string, label labels.Selector, field fields.Selector) (*PodStore, error)

func (*PodStore) List Uses

func (s *PodStore) List() []*v1.Pod

func (*PodStore) Stop Uses

func (s *PodStore) Stop()

type PrepareNodeStrategy Uses

type PrepareNodeStrategy interface {
    // Modify pre-created Node objects before the test starts.
    PreparePatch(node *v1.Node) []byte
    // Create or modify any objects that depend on the node before the test starts.
    // Caller will re-try when http.StatusConflict error is returned.
    PrepareDependentObjects(node *v1.Node, client clientset.Interface) error
    // Clean up any node modifications after the test finishes.
    CleanupNode(node *v1.Node) *v1.Node
    // Clean up any objects that depend on the node after the test finishes.
    // Caller will re-try when http.StatusConflict error is returned.
    CleanupDependentObjects(nodeName string, client clientset.Interface) error
}

type RCConfig Uses

type RCConfig struct {
    Affinity                      *v1.Affinity
    Client                        clientset.Interface
    ScalesGetter                  scaleclient.ScalesGetter
    Image                         string
    Command                       []string
    Name                          string
    Namespace                     string
    PollInterval                  time.Duration
    Timeout                       time.Duration
    PodStatusFile                 *os.File
    Replicas                      int
    CpuRequest                    int64 // millicores
    CpuLimit                      int64 // millicores
    MemRequest                    int64 // bytes
    MemLimit                      int64 // bytes
    GpuLimit                      int64 // count
    ReadinessProbe                *v1.Probe
    DNSPolicy                     *v1.DNSPolicy
    PriorityClassName             string
    TerminationGracePeriodSeconds *int64
    Lifecycle                     *v1.Lifecycle

    // Env vars, set the same for every pod.
    Env map[string]string

    // Extra labels and annotations added to every pod.
    Labels      map[string]string
    Annotations map[string]string

    // Node selector for pods in the RC.
    NodeSelector map[string]string

    // Tolerations for pods in the RC.
    Tolerations []v1.Toleration

    // Ports to declare in the container (map of name to containerPort).
    Ports map[string]int
    // Ports to declare in the container as host and container ports.
    HostPorts map[string]int

    Volumes      []v1.Volume
    VolumeMounts []v1.VolumeMount

    // Pointer to a list of pods; if non-nil, will be set to a list of pods
    // created by this RC by RunRC.
    CreatedPods *[]*v1.Pod

    // Maximum allowable container failures. If exceeded, RunRC returns an error.
    // Defaults to replicas*0.1 if unspecified.
    MaxContainerFailures *int
    // Maximum allowed pod deletions count. If exceeded, RunRC returns an error.
    // Defaults to 0.
    MaxAllowedPodDeletions int

    // If set to false starting RC will print progress, otherwise only errors will be printed.
    Silent bool

    // If set this function will be used to print log lines instead of klog.
    LogFunc func(fmt string, args ...interface{})
    // If set those functions will be used to gather data from Nodes - in integration tests where no
    // kubelets are running those variables should be nil.
    NodeDumpFunc      func(c clientset.Interface, nodeNames []string, logFunc func(fmt string, args ...interface{}))
    ContainerDumpFunc func(c clientset.Interface, ns string, logFunc func(ftm string, args ...interface{}))

    // Names of the secrets and configmaps to mount.
    SecretNames    []string
    ConfigMapNames []string

    ServiceAccountTokenProjections int
}

func (*RCConfig) GetClient Uses

func (config *RCConfig) GetClient() clientset.Interface

func (*RCConfig) GetGroupResource Uses

func (config *RCConfig) GetGroupResource() schema.GroupResource

func (*RCConfig) GetGroupVersionResource Uses

func (config *RCConfig) GetGroupVersionResource() schema.GroupVersionResource

func (*RCConfig) GetKind Uses

func (config *RCConfig) GetKind() schema.GroupKind

func (*RCConfig) GetLabelValue Uses

func (config *RCConfig) GetLabelValue(key string) (string, bool)

func (*RCConfig) GetName Uses

func (config *RCConfig) GetName() string

func (*RCConfig) GetNamespace Uses

func (config *RCConfig) GetNamespace() string

func (*RCConfig) GetReplicas Uses

func (config *RCConfig) GetReplicas() int

func (*RCConfig) GetScalesGetter Uses

func (config *RCConfig) GetScalesGetter() scaleclient.ScalesGetter

func (*RCConfig) RCConfigLog Uses

func (rc *RCConfig) RCConfigLog(fmt string, args ...interface{})

func (*RCConfig) Run Uses

func (config *RCConfig) Run() error

func (*RCConfig) SetClient Uses

func (config *RCConfig) SetClient(c clientset.Interface)

func (*RCConfig) SetScalesClient Uses

func (config *RCConfig) SetScalesClient(getter scaleclient.ScalesGetter)

type RCStartupStatus Uses

type RCStartupStatus struct {
    Expected              int
    Terminating           int
    Running               int
    RunningButNotReady    int
    Waiting               int
    Pending               int
    Scheduled             int
    Unknown               int
    Inactive              int
    FailedContainers      int
    Created               []*v1.Pod
    ContainerRestartNodes sets.String
}

func ComputeRCStartupStatus Uses

func ComputeRCStartupStatus(pods []*v1.Pod, expected int) RCStartupStatus

func (*RCStartupStatus) String Uses

func (s *RCStartupStatus) String(name string) string

type ReplicaSetConfig Uses

type ReplicaSetConfig struct {
    RCConfig
}

func (*ReplicaSetConfig) GetGroupResource Uses

func (config *ReplicaSetConfig) GetGroupResource() schema.GroupResource

func (*ReplicaSetConfig) GetGroupVersionResource Uses

func (config *ReplicaSetConfig) GetGroupVersionResource() schema.GroupVersionResource

func (*ReplicaSetConfig) GetKind Uses

func (config *ReplicaSetConfig) GetKind() schema.GroupKind

func (*ReplicaSetConfig) Run Uses

func (config *ReplicaSetConfig) Run() error

type RunObjectConfig Uses

type RunObjectConfig interface {
    Run() error
    GetName() string
    GetNamespace() string
    GetKind() schema.GroupKind
    GetClient() clientset.Interface
    GetScalesGetter() scaleclient.ScalesGetter
    SetClient(clientset.Interface)
    SetScalesClient(scaleclient.ScalesGetter)
    GetReplicas() int
    GetLabelValue(string) (string, bool)
    GetGroupResource() schema.GroupResource
    GetGroupVersionResource() schema.GroupVersionResource
}

type SecretConfig Uses

type SecretConfig struct {
    Content   map[string]string
    Client    clientset.Interface
    Name      string
    Namespace string
    // If set this function will be used to print log lines instead of klog.
    LogFunc func(fmt string, args ...interface{})
}

func (*SecretConfig) Run Uses

func (config *SecretConfig) Run() error

func (*SecretConfig) Stop Uses

func (config *SecretConfig) Stop() error

type TestNodePreparer Uses

type TestNodePreparer interface {
    PrepareNodes() error
    CleanupNodes() error
}

type TestPodCreateStrategy Uses

type TestPodCreateStrategy func(client clientset.Interface, namespace string, podCount int) error

func NewCreatePodWithPersistentVolumeStrategy Uses

func NewCreatePodWithPersistentVolumeStrategy(claimTemplate *v1.PersistentVolumeClaim, factory volumeFactory, podTemplate *v1.Pod) TestPodCreateStrategy

func NewCustomCreatePodStrategy Uses

func NewCustomCreatePodStrategy(podTemplate *v1.Pod) TestPodCreateStrategy

func NewSimpleCreatePodStrategy Uses

func NewSimpleCreatePodStrategy() TestPodCreateStrategy

func NewSimpleWithControllerCreatePodStrategy Uses

func NewSimpleWithControllerCreatePodStrategy(controllerName string) TestPodCreateStrategy

type TestPodCreator Uses

type TestPodCreator struct {
    Client clientset.Interface
    // namespace -> count -> strategy
    Config *TestPodCreatorConfig
}

func NewTestPodCreator Uses

func NewTestPodCreator(client clientset.Interface, config *TestPodCreatorConfig) *TestPodCreator

func (*TestPodCreator) CreatePods Uses

func (c *TestPodCreator) CreatePods() error

type TestPodCreatorConfig Uses

type TestPodCreatorConfig map[string][]CountToPodStrategy

func NewTestPodCreatorConfig Uses

func NewTestPodCreatorConfig() *TestPodCreatorConfig

func (*TestPodCreatorConfig) AddStrategy Uses

func (c *TestPodCreatorConfig) AddStrategy(
    namespace string, podCount int, strategy TestPodCreateStrategy)

type TrivialNodePrepareStrategy Uses

type TrivialNodePrepareStrategy struct{}

func (*TrivialNodePrepareStrategy) CleanupDependentObjects Uses

func (*TrivialNodePrepareStrategy) CleanupDependentObjects(nodeName string, client clientset.Interface) error

func (*TrivialNodePrepareStrategy) CleanupNode Uses

func (*TrivialNodePrepareStrategy) CleanupNode(node *v1.Node) *v1.Node

func (*TrivialNodePrepareStrategy) PrepareDependentObjects Uses

func (*TrivialNodePrepareStrategy) PrepareDependentObjects(node *v1.Node, client clientset.Interface) error

func (*TrivialNodePrepareStrategy) PreparePatch Uses

func (*TrivialNodePrepareStrategy) PreparePatch(*v1.Node) []byte

type UpdateDeploymentFunc Uses

type UpdateDeploymentFunc func(d *apps.Deployment)

type UpdateReplicaSetFunc Uses

type UpdateReplicaSetFunc func(d *apps.ReplicaSet)

Directories

PathSynopsis
crd
harness
image
junitPackage junit provides data structures to allow easy XML encoding and decoding of JUnit test results.

Package utils imports 70 packages (graph) and is imported by 876 packages. Updated 2019-11-08. Refresh now. Tools for package owners.