Documentation ¶
Index ¶
- Variables
- func AddLabelsToNode(c clientset.Interface, nodeName string, labels map[string]string) error
- func AdmissionWebhookHandler(t *testing.T, admit func(*v1beta1.AdmissionReview) error) http.HandlerFunc
- func CheckDeploymentRevisionAndImage(c clientset.Interface, ns, deploymentName, revision, image string) error
- func CheckForDuplicates(el auditinternal.EventList) (auditinternal.EventList, error)
- func CreateConfigMapWithRetries(c clientset.Interface, namespace string, obj *v1.ConfigMap) error
- func CreateDaemonSetWithRetries(c clientset.Interface, namespace string, obj *apps.DaemonSet) error
- func CreateDeploymentWithRetries(c clientset.Interface, namespace string, obj *apps.Deployment) error
- func CreateJobWithRetries(c clientset.Interface, namespace string, obj *batch.Job) error
- func CreatePersistentVolumeClaimWithRetries(c clientset.Interface, namespace string, obj *v1.PersistentVolumeClaim) error
- func CreatePersistentVolumeWithRetries(c clientset.Interface, obj *v1.PersistentVolume) error
- func CreatePod(client clientset.Interface, namespace string, podCount int, ...) error
- func CreatePodWithPersistentVolume(client clientset.Interface, namespace string, ...) error
- func CreatePodWithRetries(c clientset.Interface, namespace string, obj *v1.Pod) error
- func CreateRCWithRetries(c clientset.Interface, namespace string, obj *v1.ReplicationController) error
- func CreateReplicaSetWithRetries(c clientset.Interface, namespace string, obj *apps.ReplicaSet) error
- func CreateResourceQuotaWithRetries(c clientset.Interface, namespace string, obj *v1.ResourceQuota) error
- func CreateSecretWithRetries(c clientset.Interface, namespace string, obj *v1.Secret) error
- func CreateServiceWithRetries(c clientset.Interface, namespace string, obj *v1.Service) error
- func CreateStorageClassWithRetries(c clientset.Interface, obj *storage.StorageClass) error
- func DeleteResourceWithRetries(c clientset.Interface, kind schema.GroupKind, namespace, name string, ...) error
- func DoCleanupNode(client clientset.Interface, nodeName string, strategy PrepareNodeStrategy) error
- func DoPrepareNode(client clientset.Interface, node *v1.Node, strategy PrepareNodeStrategy) error
- func EncodeCertPEM(cert *x509.Certificate) []byte
- func FailedContainers(pod *v1.Pod) map[string]ContainerFailures
- func GetCAdvisorRootDir() (string, error)
- func GetK8sBuildOutputDir() (string, error)
- func GetK8sRootDir() (string, error)
- func GetNodeCondition(status *v1.NodeStatus, conditionType v1.NodeConditionType) (int, *v1.NodeCondition)
- func IsRetryableAPIError(err error) bool
- func LogPodsOfDeployment(c clientset.Interface, deployment *apps.Deployment, rsList []*apps.ReplicaSet, ...)
- func LogReplicaSetsOfDeployment(deployment *apps.Deployment, allOldRSs []*apps.ReplicaSet, ...)
- func MakePodSpec() v1.PodSpec
- func MakeTempDirOrDie(prefix string, baseDir string) string
- func NewAdmissionWebhookServer(handler http.Handler) (string, func(), error)
- func NewPrivateKey() (*rsa.PrivateKey, error)
- func NewSignedCert(cfg *certutil.Config, key crypto.Signer, caCert *x509.Certificate, ...) (*x509.Certificate, error)
- func PodNotReady(p *v1.Pod) (bool, error)
- func PodRunningReady(p *v1.Pod) (bool, error)
- func PodRunningReadyOrSucceeded(p *v1.Pod) (bool, error)
- func RemoveLabelOffNode(c clientset.Interface, nodeName string, labelKeys []string) error
- func RetryErrorCondition(condition wait.ConditionFunc) wait.ConditionFunc
- func RetryWithExponentialBackOff(fn wait.ConditionFunc) error
- func RootDir() (string, error)
- func RunDeployment(config DeploymentConfig) error
- func RunJob(config JobConfig) error
- func RunPodAndGetNodeName(c clientset.Interface, pod *v1.Pod, timeout time.Duration) (string, error)
- func RunRC(config RCConfig) error
- func RunReplicaSet(config ReplicaSetConfig) error
- func ScaleResourceWithRetries(scalesGetter scaleclient.ScalesGetter, namespace, name string, size uint, ...) error
- func StartPods(c clientset.Interface, replicas int, namespace string, podNamePrefix string, ...) error
- func TerminatedContainers(pod *v1.Pod) map[string]string
- func UpdateDeploymentWithRetries(c clientset.Interface, namespace, name string, ...) (*apps.Deployment, error)
- func UpdateReplicaSetStatusWithRetries(c clientset.Interface, namespace, name string, ...) (*apps.ReplicaSet, error)
- func UpdateReplicaSetWithRetries(c clientset.Interface, namespace, name string, ...) (*apps.ReplicaSet, error)
- func VerifyLabelsRemoved(c clientset.Interface, nodeName string, labelKeys []string) error
- func WaitForDeploymentComplete(c clientset.Interface, d *apps.Deployment, logf LogfFn, ...) error
- func WaitForDeploymentCompleteAndCheckRolling(c clientset.Interface, d *apps.Deployment, logf LogfFn, ...) error
- func WaitForDeploymentRevisionAndImage(c clientset.Interface, ns, deploymentName string, revision, image string, ...) error
- func WaitForDeploymentRollbackCleared(c clientset.Interface, ns, deploymentName string, ...) error
- func WaitForDeploymentUpdatedReplicasGTE(c clientset.Interface, ns, deploymentName string, minUpdatedReplicas int32, ...) error
- func WaitForDeploymentWithCondition(c clientset.Interface, ns, deploymentName, reason string, ...) error
- func WaitForEnoughPodsWithLabelRunning(c clientset.Interface, ns string, label labels.Selector, replicas int) error
- func WaitForObservedDeployment(c clientset.Interface, ns, deploymentName string, desiredGeneration int64) error
- func WaitForPodsWithLabelRunning(c clientset.Interface, ns string, label labels.Selector) error
- func WaitRSStable(t *testing.T, clientSet clientset.Interface, rs *apps.ReplicaSet, ...) error
- func WaitUntilPodIsScheduled(c clientset.Interface, name, namespace string, timeout time.Duration) (*v1.Pod, error)
- type AuditEvent
- type AuditTestServer
- func (a *AuditTestServer) AppendEvents(events []auditinternal.Event)
- func (a *AuditTestServer) BuildSinkConfiguration() *auditregv1alpha1.AuditSink
- func (a *AuditTestServer) Close()
- func (a *AuditTestServer) GetEventList() auditinternal.EventList
- func (a *AuditTestServer) Health() error
- func (a *AuditTestServer) ResetEventList()
- func (a *AuditTestServer) WaitForEvents(expected []AuditEvent) ([]AuditEvent, error)
- func (a *AuditTestServer) WaitForNumEvents(numEvents int) error
- type ConfigMapConfig
- type ContainerFailures
- type CountToPodStrategy
- type CountToStrategy
- type DaemonConfig
- type DeploymentConfig
- type JobConfig
- type LabelNodePrepareStrategy
- func (*LabelNodePrepareStrategy) CleanupDependentObjects(nodeName string, client clientset.Interface) error
- func (s *LabelNodePrepareStrategy) CleanupNode(node *v1.Node) *v1.Node
- func (*LabelNodePrepareStrategy) PrepareDependentObjects(node *v1.Node, client clientset.Interface) error
- func (s *LabelNodePrepareStrategy) PreparePatch(*v1.Node) []byte
- type LockedEventList
- type LogfFn
- type MissingEventsReport
- type NodeAllocatableStrategy
- func (s *NodeAllocatableStrategy) CleanupDependentObjects(nodeName string, client clientset.Interface) error
- func (s *NodeAllocatableStrategy) CleanupNode(node *v1.Node) *v1.Node
- func (s *NodeAllocatableStrategy) PrepareDependentObjects(node *v1.Node, client clientset.Interface) error
- func (s *NodeAllocatableStrategy) PreparePatch(node *v1.Node) []byte
- type PodDiff
- type PodStore
- type PrepareNodeStrategy
- type RCConfig
- func (config *RCConfig) GetClient() clientset.Interface
- func (config *RCConfig) GetGroupResource() schema.GroupResource
- func (config *RCConfig) GetGroupVersionResource() schema.GroupVersionResource
- func (config *RCConfig) GetKind() schema.GroupKind
- func (config *RCConfig) GetLabelValue(key string) (string, bool)
- func (config *RCConfig) GetName() string
- func (config *RCConfig) GetNamespace() string
- func (config *RCConfig) GetReplicas() int
- func (config *RCConfig) GetScalesGetter() scaleclient.ScalesGetter
- func (rc *RCConfig) RCConfigLog(fmt string, args ...interface{})
- func (config *RCConfig) Run() error
- func (config *RCConfig) SetClient(c clientset.Interface)
- func (config *RCConfig) SetScalesClient(getter scaleclient.ScalesGetter)
- type RCStartupStatus
- type ReplicaSetConfig
- type RunObjectConfig
- type SecretConfig
- type TestNodePreparer
- type TestPodCreateStrategy
- func NewCreatePodWithPersistentVolumeStrategy(claimTemplate *v1.PersistentVolumeClaim, factory volumeFactory, ...) TestPodCreateStrategy
- func NewCreatePodWithPersistentVolumeWithFirstConsumerStrategy(factory volumeFactory, podTemplate *v1.Pod) TestPodCreateStrategy
- func NewCustomCreatePodStrategy(podTemplate *v1.Pod) TestPodCreateStrategy
- func NewSimpleCreatePodStrategy() TestPodCreateStrategy
- func NewSimpleWithControllerCreatePodStrategy(controllerName string) TestPodCreateStrategy
- type TestPodCreator
- type TestPodCreatorConfig
- type TrivialNodePrepareStrategy
- func (*TrivialNodePrepareStrategy) CleanupDependentObjects(nodeName string, client clientset.Interface) error
- func (*TrivialNodePrepareStrategy) CleanupNode(node *v1.Node) *v1.Node
- func (*TrivialNodePrepareStrategy) PrepareDependentObjects(node *v1.Node, client clientset.Interface) error
- func (*TrivialNodePrepareStrategy) PreparePatch(*v1.Node) []byte
- type UniqueNodeLabelStrategy
- func (*UniqueNodeLabelStrategy) CleanupDependentObjects(nodeName string, client clientset.Interface) error
- func (s *UniqueNodeLabelStrategy) CleanupNode(node *v1.Node) *v1.Node
- func (*UniqueNodeLabelStrategy) PrepareDependentObjects(node *v1.Node, client clientset.Interface) error
- func (s *UniqueNodeLabelStrategy) PreparePatch(*v1.Node) []byte
- type UpdateDeploymentFunc
- type UpdateReplicaSetFunc
Constants ¶
This section is empty.
Variables ¶
var LocalhostCert = []byte(`-----BEGIN CERTIFICATE-----
MIIDGDCCAgCgAwIBAgIQTKCKn99d5HhQVCLln2Q+eTANBgkqhkiG9w0BAQsFADAS
MRAwDgYDVQQKEwdBY21lIENvMCAXDTcwMDEwMTAwMDAwMFoYDzIwODQwMTI5MTYw
MDAwWjASMRAwDgYDVQQKEwdBY21lIENvMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
MIIBCgKCAQEA1Z5/aTwqY706M34tn60l8ZHkanWDl8mM1pYf4Q7qg3zA9XqWLX6S
4rTYDYCb4stEasC72lQnbEWHbthiQE76zubP8WOFHdvGR3mjAvHWz4FxvLOTheZ+
3iDUrl6Aj9UIsYqzmpBJAoY4+vGGf+xHvuukHrVcFqR9ZuBdZuJ/HbbjUyuNr3X9
erNIr5Ha17gVzf17SNbYgNrX9gbCeEB8Z9Ox7dVuJhLDkpF0T/B5Zld3BjyUVY/T
cukU4dTVp6isbWPvCMRCZCCOpb+qIhxEjJ0n6tnPt8nf9lvDl4SWMl6X1bH+2EFa
a8R06G0QI+XhwPyjXUyCR8QEOZPCR5wyqQIDAQABo2gwZjAOBgNVHQ8BAf8EBAMC
AqQwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDwYDVR0TAQH/BAUwAwEB/zAuBgNVHREE
JzAlggtleGFtcGxlLmNvbYcEfwAAAYcQAAAAAAAAAAAAAAAAAAAAATANBgkqhkiG
9w0BAQsFAAOCAQEAThqgJ/AFqaANsOp48lojDZfZBFxJQ3A4zfR/MgggUoQ9cP3V
rxuKAFWQjze1EZc7J9iO1WvH98lOGVNRY/t2VIrVoSsBiALP86Eew9WucP60tbv2
8/zsBDSfEo9Wl+Q/gwdEh8dgciUKROvCm76EgAwPGicMAgRsxXgwXHhS5e8nnbIE
Ewaqvb5dY++6kh0Oz+adtNT5OqOwXTIRI67WuEe6/B3Z4LNVPQDIj7ZUJGNw8e6L
F4nkUthwlKx4yEJHZBRuFPnO7Z81jNKuwL276+mczRH7piI6z9uyMV/JbEsOIxyL
W6CzB7pZ9Nj1YLpgzc1r6oONHLokMJJIz/IvkQ==
-----END CERTIFICATE-----`)
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(`-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEA1Z5/aTwqY706M34tn60l8ZHkanWDl8mM1pYf4Q7qg3zA9XqW
LX6S4rTYDYCb4stEasC72lQnbEWHbthiQE76zubP8WOFHdvGR3mjAvHWz4FxvLOT
heZ+3iDUrl6Aj9UIsYqzmpBJAoY4+vGGf+xHvuukHrVcFqR9ZuBdZuJ/HbbjUyuN
r3X9erNIr5Ha17gVzf17SNbYgNrX9gbCeEB8Z9Ox7dVuJhLDkpF0T/B5Zld3BjyU
VY/TcukU4dTVp6isbWPvCMRCZCCOpb+qIhxEjJ0n6tnPt8nf9lvDl4SWMl6X1bH+
2EFaa8R06G0QI+XhwPyjXUyCR8QEOZPCR5wyqQIDAQABAoIBAFAJmb1pMIy8OpFO
hnOcYWoYepe0vgBiIOXJy9n8R7vKQ1X2f0w+b3SHw6eTd1TLSjAhVIEiJL85cdwD
MRTdQrXA30qXOioMzUa8eWpCCHUpD99e/TgfO4uoi2dluw+pBx/WUyLnSqOqfLDx
S66kbeFH0u86jm1hZibki7pfxLbxvu7KQgPe0meO5/13Retztz7/xa/pWIY71Zqd
YC8UckuQdWUTxfuQf0470lAK34GZlDy9tvdVOG/PmNkG4j6OQjy0Kmz4Uk7rewKo
ZbdphaLPJ2A4Rdqfn4WCoyDnxlfV861T922/dEDZEbNWiQpB81G8OfLL+FLHxyIT
LKEu4R0CgYEA4RDj9jatJ/wGkMZBt+UF05mcJlRVMEijqdKgFwR2PP8b924Ka1mj
9zqWsfbxQbdPdwsCeVBZrSlTEmuFSQLeWtqBxBKBTps/tUP0qZf7HjfSmcVI89WE
3ab8LFjfh4PtK/LOq2D1GRZZkFliqi0gKwYdDoK6gxXWwrumXq4c2l8CgYEA8vrX
dMuGCNDjNQkGXx3sr8pyHCDrSNR4Z4FrSlVUkgAW1L7FrCM911BuGh86FcOu9O/1
Ggo0E8ge7qhQiXhB5vOo7hiVzSp0FxxCtGSlpdp4W6wx6ZWK8+Pc+6Moos03XdG7
MKsdPGDciUn9VMOP3r8huX/btFTh90C/L50sH/cCgYAd02wyW8qUqux/0RYydZJR
GWE9Hx3u+SFfRv9aLYgxyyj8oEOXOFjnUYdY7D3KlK1ePEJGq2RG81wD6+XM6Clp
Zt2di0pBjYdi0S+iLfbkaUdqg1+ImLoz2YY/pkNxJQWQNmw2//FbMsAJxh6yKKrD
qNq+6oonBwTf55hDodVHBwKBgEHgEBnyM9ygBXmTgM645jqiwF0v75pHQH2PcO8u
Q0dyDr6PGjiZNWLyw2cBoFXWP9DYXbM5oPTcBMbfizY6DGP5G4uxzqtZHzBE0TDn
OKHGoWr5PG7/xDRrSrZOfe3lhWVCP2XqfnqoKCJwlOYuPws89n+8UmyJttm6DBt0
mUnxAoGBAIvbR87ZFXkvqstLs4KrdqTz4TQIcpzB3wENukHODPA6C1gzWTqp+OEe
GMNltPfGCLO+YmoMQuTpb0kECYV3k4jR3gXO6YvlL9KbY+UOA6P0dDX4ROi2Rklj
yh+lxFLYa1vlzzi9r8B7nkR9hrOGMvkfXF42X89g7lx4uMtu2I4q
-----END RSA PRIVATE KEY-----`)
LocalhostKey is the private key for LocalhostCert.
Functions ¶
func AddLabelsToNode ¶ added in v1.5.0
func AdmissionWebhookHandler ¶ added in v1.16.0
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 ¶ added in v1.9.0
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 ¶ added in v1.14.0
func CheckForDuplicates(el auditinternal.EventList) (auditinternal.EventList, error)
CheckForDuplicates checks a list for duplicate events
func CreateConfigMapWithRetries ¶ added in v1.10.0
func CreateDaemonSetWithRetries ¶ added in v1.10.0
func CreateDeploymentWithRetries ¶ added in v1.10.0
func CreateJobWithRetries ¶ added in v1.10.0
func CreatePersistentVolumeClaimWithRetries ¶ added in v1.16.0
func CreatePersistentVolumeWithRetries ¶ added in v1.16.0
func CreatePersistentVolumeWithRetries(c clientset.Interface, obj *v1.PersistentVolume) error
func CreatePodWithPersistentVolume ¶ added in v1.16.0
func CreatePodWithRetries ¶ added in v1.10.0
func CreateRCWithRetries ¶ added in v1.10.0
func CreateReplicaSetWithRetries ¶ added in v1.10.0
func CreateResourceQuotaWithRetries ¶ added in v1.10.0
func CreateSecretWithRetries ¶ added in v1.10.0
func CreateServiceWithRetries ¶ added in v1.10.0
func CreateStorageClassWithRetries ¶ added in v1.18.0
func CreateStorageClassWithRetries(c clientset.Interface, obj *storage.StorageClass) error
func DeleteResourceWithRetries ¶ added in v1.10.0
func DoCleanupNode ¶ added in v1.5.0
func DoCleanupNode(client clientset.Interface, nodeName string, strategy PrepareNodeStrategy) error
func DoPrepareNode ¶ added in v1.5.0
func EncodeCertPEM ¶ added in v1.15.0
func EncodeCertPEM(cert *x509.Certificate) []byte
EncodeCertPEM returns PEM-endcoded certificate data
func FailedContainers ¶ added in v1.4.5
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 ¶ added in v1.11.0
GetCAdvisorRootDir returns the root directory for cAdvisor, if present in the gopath.
func GetK8sBuildOutputDir ¶ added in v1.11.0
GetK8sBuildOutputDir returns the build output directory for k8s
func GetK8sRootDir ¶ added in v1.11.0
GetK8sRootDir returns the root directory for kubernetes, if present in the gopath.
func GetNodeCondition ¶ added in v1.14.0
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 ¶ added in v1.10.0
func LogPodsOfDeployment ¶ added in v1.7.0
func LogPodsOfDeployment(c clientset.Interface, deployment *apps.Deployment, rsList []*apps.ReplicaSet, logf LogfFn)
func LogReplicaSetsOfDeployment ¶ added in v1.7.0
func LogReplicaSetsOfDeployment(deployment *apps.Deployment, allOldRSs []*apps.ReplicaSet, newRS *apps.ReplicaSet, logf LogfFn)
func MakePodSpec ¶ added in v1.5.0
func MakeTempDirOrDie ¶
func NewAdmissionWebhookServer ¶ added in v1.16.0
NewAdmissionWebhookServer sets up a webhook server with TLS enabled, returns URL and Close function for the server
func NewPrivateKey ¶ added in v1.15.0
func NewPrivateKey() (*rsa.PrivateKey, error)
NewPrivateKey creates an RSA private key
func NewSignedCert ¶ added in v1.15.0
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 ¶ added in v1.4.5
PodNotReady checks whether pod p's has a ready condition of status false.
func PodRunningReady ¶ added in v1.4.5
PodRunningReady checks whether pod p's phase is running and it has a ready condition of status true.
func PodRunningReadyOrSucceeded ¶ added in v1.4.5
func RemoveLabelOffNode ¶ added in v1.5.0
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 ¶ added in v1.11.0
func RetryErrorCondition(condition wait.ConditionFunc) wait.ConditionFunc
func RetryWithExponentialBackOff ¶ added in v1.10.0
func RetryWithExponentialBackOff(fn wait.ConditionFunc) error
Utility for retrying the given function with exponential backoff.
func RootDir ¶ added in v1.11.0
RootDir gets the on-disk kubernetes source directory, returning an error is none is found
func RunDeployment ¶ added in v1.5.0
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 ¶ added in v1.6.0
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 ¶ added in v1.6.0
func RunRC ¶ added in v1.5.0
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 ¶ added in v1.5.0
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 ¶ added in v1.10.0
func ScaleResourceWithRetries(scalesGetter scaleclient.ScalesGetter, namespace, name string, size uint, gvr schema.GroupVersionResource) error
func StartPods ¶ added in v1.5.0
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 ¶ added in v1.4.5
TerminatedContainers inspects all containers in a pod and returns a map of "container name: termination reason", for all currently terminated containers.
func UpdateDeploymentWithRetries ¶ added in v1.8.0
func UpdateDeploymentWithRetries(c clientset.Interface, namespace, name string, applyUpdate UpdateDeploymentFunc, logf LogfFn, pollInterval, pollTimeout time.Duration) (*apps.Deployment, error)
func UpdateReplicaSetStatusWithRetries ¶ added in v1.10.0
func UpdateReplicaSetStatusWithRetries(c clientset.Interface, namespace, name string, applyUpdate UpdateReplicaSetFunc, logf LogfFn, pollInterval, pollTimeout time.Duration) (*apps.ReplicaSet, error)
func UpdateReplicaSetWithRetries ¶ added in v1.9.0
func UpdateReplicaSetWithRetries(c clientset.Interface, namespace, name string, applyUpdate UpdateReplicaSetFunc, logf LogfFn, pollInterval, pollTimeout time.Duration) (*apps.ReplicaSet, error)
func VerifyLabelsRemoved ¶ added in v1.5.0
VerifyLabelsRemoved checks if Node for given nodeName does not have any of labels from labelKeys. Return non-nil error if it does.
func WaitForDeploymentComplete ¶ added in v1.9.0
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 ¶ added in v1.9.0
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 ¶ added in v1.7.0
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 ¶ added in v1.9.0
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 ¶ added in v1.10.0
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 ¶ added in v1.9.0
func WaitForEnoughPodsWithLabelRunning ¶ added in v1.10.0
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 ¶ added in v1.8.0
func WaitForPodsWithLabelRunning ¶ added in v1.5.0
Wait up to 10 minutes for all matching pods to become Running and at least one matching pod exists.
Types ¶
type AuditEvent ¶ added in v1.12.0
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 ¶ added in v1.14.0
func CheckAuditList(el auditinternal.EventList, expected []AuditEvent) (missing []AuditEvent, err error)
CheckAuditList searches an audit event list for the expected audit events.
type AuditTestServer ¶ added in v1.14.0
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 ¶ added in v1.14.0
func NewAuditTestServer(t *testing.T, name string) *AuditTestServer
NewAuditTestServer returns a new audit test server
func (*AuditTestServer) AppendEvents ¶ added in v1.14.0
func (a *AuditTestServer) AppendEvents(events []auditinternal.Event)
AppendEvents will add the given events to the internal event list
func (*AuditTestServer) BuildSinkConfiguration ¶ added in v1.14.0
func (a *AuditTestServer) BuildSinkConfiguration() *auditregv1alpha1.AuditSink
BuildSinkConfiguration creates a generic audit sink configuration for this server
func (*AuditTestServer) GetEventList ¶ added in v1.14.0
func (a *AuditTestServer) GetEventList() auditinternal.EventList
GetEventList safely returns the internal event list
func (*AuditTestServer) Health ¶ added in v1.14.0
func (a *AuditTestServer) Health() error
Health polls the server healthcheck until successful or the 30s timeout has been reached
func (*AuditTestServer) ResetEventList ¶ added in v1.14.0
func (a *AuditTestServer) ResetEventList()
ResetEventList resets the internal event list
func (*AuditTestServer) WaitForEvents ¶ added in v1.14.0
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 ¶ added in v1.14.0
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 ¶ added in v1.7.0
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 ¶ added in v1.7.0
func (config *ConfigMapConfig) Run() error
func (*ConfigMapConfig) Stop ¶ added in v1.7.0
func (config *ConfigMapConfig) Stop() error
type ContainerFailures ¶ added in v1.4.5
type ContainerFailures struct { Restarts int // contains filtered or unexported fields }
type CountToPodStrategy ¶ added in v1.5.0
type CountToPodStrategy struct { Count int Strategy TestPodCreateStrategy }
type CountToStrategy ¶ added in v1.5.0
type CountToStrategy struct { Count int Strategy PrepareNodeStrategy }
type DaemonConfig ¶ added in v1.6.0
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 ¶ added in v1.6.0
func (config *DaemonConfig) Run() error
type DeploymentConfig ¶ added in v1.5.0
type DeploymentConfig struct {
RCConfig
}
func (*DeploymentConfig) GetGroupResource ¶ added in v1.10.0
func (config *DeploymentConfig) GetGroupResource() schema.GroupResource
func (*DeploymentConfig) GetGroupVersionResource ¶ added in v1.16.0
func (config *DeploymentConfig) GetGroupVersionResource() schema.GroupVersionResource
func (*DeploymentConfig) GetKind ¶ added in v1.6.0
func (config *DeploymentConfig) GetKind() schema.GroupKind
func (*DeploymentConfig) Run ¶ added in v1.6.0
func (config *DeploymentConfig) Run() error
type JobConfig ¶ added in v1.6.0
type JobConfig struct {
RCConfig
}
func (*JobConfig) GetGroupResource ¶ added in v1.10.0
func (config *JobConfig) GetGroupResource() schema.GroupResource
func (*JobConfig) GetGroupVersionResource ¶ added in v1.16.0
func (config *JobConfig) GetGroupVersionResource() schema.GroupVersionResource
type LabelNodePrepareStrategy ¶ added in v1.5.0
type LabelNodePrepareStrategy struct { LabelKey string LabelValues []string // contains filtered or unexported fields }
func NewLabelNodePrepareStrategy ¶ added in v1.5.0
func NewLabelNodePrepareStrategy(labelKey string, labelValues ...string) *LabelNodePrepareStrategy
func (*LabelNodePrepareStrategy) CleanupDependentObjects ¶ added in v1.16.0
func (*LabelNodePrepareStrategy) CleanupDependentObjects(nodeName string, client clientset.Interface) error
func (*LabelNodePrepareStrategy) CleanupNode ¶ added in v1.5.0
func (s *LabelNodePrepareStrategy) CleanupNode(node *v1.Node) *v1.Node
func (*LabelNodePrepareStrategy) PrepareDependentObjects ¶ added in v1.16.0
func (*LabelNodePrepareStrategy) PreparePatch ¶ added in v1.5.0
func (s *LabelNodePrepareStrategy) PreparePatch(*v1.Node) []byte
type LockedEventList ¶ added in v1.14.0
type LockedEventList struct { *sync.RWMutex EventList auditinternal.EventList }
LockedEventList is an event list with a lock for concurrent access
func NewLockedEventList ¶ added in v1.14.0
func NewLockedEventList() *LockedEventList
NewLockedEventList returns a new LockedEventList
type MissingEventsReport ¶ added in v1.14.0
type MissingEventsReport struct { FirstEventChecked *auditinternal.Event LastEventChecked *auditinternal.Event NumEventsChecked int MissingEvents []AuditEvent }
MissingEventsReport provides an analysis if any events are missing
func CheckAuditLines ¶ added in v1.12.0
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 ¶ added in v1.14.0
func (m *MissingEventsReport) String() string
String returns a human readable string representation of the report
type NodeAllocatableStrategy ¶ added in v1.16.0
type NodeAllocatableStrategy struct { // Node.status.allocatable to fill to all nodes. NodeAllocatable map[v1.ResourceName]string // Map <driver_name> -> VolumeNodeResources to fill into csiNode.spec.drivers[<driver_name>]. CsiNodeAllocatable map[string]*storagev1beta1.VolumeNodeResources // List of in-tree volume plugins migrated to CSI. MigratedPlugins []string }
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 ¶ added in v1.16.0
func NewNodeAllocatableStrategy(nodeAllocatable map[v1.ResourceName]string, csiNodeAllocatable map[string]*storagev1beta1.VolumeNodeResources, migratedPlugins []string) *NodeAllocatableStrategy
func (*NodeAllocatableStrategy) CleanupDependentObjects ¶ added in v1.16.0
func (s *NodeAllocatableStrategy) CleanupDependentObjects(nodeName string, client clientset.Interface) error
func (*NodeAllocatableStrategy) CleanupNode ¶ added in v1.16.0
func (s *NodeAllocatableStrategy) CleanupNode(node *v1.Node) *v1.Node
func (*NodeAllocatableStrategy) PrepareDependentObjects ¶ added in v1.16.0
func (*NodeAllocatableStrategy) PreparePatch ¶ added in v1.16.0
func (s *NodeAllocatableStrategy) PreparePatch(node *v1.Node) []byte
type PodDiff ¶ added in v1.5.0
type PodDiff map[string]*podInfo
PodDiff is a map of pod name to podInfos
func (PodDiff) DeletedPods ¶ added in v1.13.0
DeletedPods returns a slice of pods that were present at the beginning and then disappeared.
type PodStore ¶ added in v1.5.0
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 ¶ added in v1.5.0
type PrepareNodeStrategy ¶ added in v1.5.0
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 ¶ added in v1.5.0
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) GetGroupResource ¶ added in v1.10.0
func (config *RCConfig) GetGroupResource() schema.GroupResource
func (*RCConfig) GetGroupVersionResource ¶ added in v1.16.0
func (config *RCConfig) GetGroupVersionResource() schema.GroupVersionResource
func (*RCConfig) GetLabelValue ¶ added in v1.8.0
func (*RCConfig) GetNamespace ¶ added in v1.6.0
func (*RCConfig) GetReplicas ¶ added in v1.6.0
func (*RCConfig) GetScalesGetter ¶ added in v1.10.0
func (config *RCConfig) GetScalesGetter() scaleclient.ScalesGetter
func (*RCConfig) RCConfigLog ¶ added in v1.5.0
func (*RCConfig) SetScalesClient ¶ added in v1.10.0
func (config *RCConfig) SetScalesClient(getter scaleclient.ScalesGetter)
type RCStartupStatus ¶ added in v1.5.0
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 ¶ added in v1.5.0
func ComputeRCStartupStatus(pods []*v1.Pod, expected int) RCStartupStatus
func (*RCStartupStatus) String ¶ added in v1.5.0
func (s *RCStartupStatus) String(name string) string
type ReplicaSetConfig ¶ added in v1.5.0
type ReplicaSetConfig struct {
RCConfig
}
func (*ReplicaSetConfig) GetGroupResource ¶ added in v1.10.0
func (config *ReplicaSetConfig) GetGroupResource() schema.GroupResource
func (*ReplicaSetConfig) GetGroupVersionResource ¶ added in v1.16.0
func (config *ReplicaSetConfig) GetGroupVersionResource() schema.GroupVersionResource
func (*ReplicaSetConfig) GetKind ¶ added in v1.6.0
func (config *ReplicaSetConfig) GetKind() schema.GroupKind
func (*ReplicaSetConfig) Run ¶ added in v1.6.0
func (config *ReplicaSetConfig) Run() error
type RunObjectConfig ¶ added in v1.6.0
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 ¶ added in v1.6.0
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 ¶ added in v1.6.0
func (config *SecretConfig) Run() error
func (*SecretConfig) Stop ¶ added in v1.6.0
func (config *SecretConfig) Stop() error
type TestNodePreparer ¶ added in v1.5.0
type TestPodCreateStrategy ¶ added in v1.5.0
func NewCreatePodWithPersistentVolumeStrategy ¶ added in v1.16.0
func NewCreatePodWithPersistentVolumeStrategy(claimTemplate *v1.PersistentVolumeClaim, factory volumeFactory, podTemplate *v1.Pod) TestPodCreateStrategy
func NewCreatePodWithPersistentVolumeWithFirstConsumerStrategy ¶ added in v1.18.0
func NewCreatePodWithPersistentVolumeWithFirstConsumerStrategy(factory volumeFactory, podTemplate *v1.Pod) TestPodCreateStrategy
func NewCustomCreatePodStrategy ¶ added in v1.5.0
func NewCustomCreatePodStrategy(podTemplate *v1.Pod) TestPodCreateStrategy
func NewSimpleCreatePodStrategy ¶ added in v1.5.0
func NewSimpleCreatePodStrategy() TestPodCreateStrategy
func NewSimpleWithControllerCreatePodStrategy ¶ added in v1.5.0
func NewSimpleWithControllerCreatePodStrategy(controllerName string) TestPodCreateStrategy
type TestPodCreator ¶ added in v1.5.0
type TestPodCreator struct { Client clientset.Interface // namespace -> count -> strategy Config *TestPodCreatorConfig }
func NewTestPodCreator ¶ added in v1.5.0
func NewTestPodCreator(client clientset.Interface, config *TestPodCreatorConfig) *TestPodCreator
func (*TestPodCreator) CreatePods ¶ added in v1.5.0
func (c *TestPodCreator) CreatePods() error
type TestPodCreatorConfig ¶ added in v1.5.0
type TestPodCreatorConfig map[string][]CountToPodStrategy
func NewTestPodCreatorConfig ¶ added in v1.5.0
func NewTestPodCreatorConfig() *TestPodCreatorConfig
func (*TestPodCreatorConfig) AddStrategy ¶ added in v1.5.0
func (c *TestPodCreatorConfig) AddStrategy( namespace string, podCount int, strategy TestPodCreateStrategy)
type TrivialNodePrepareStrategy ¶ added in v1.5.0
type TrivialNodePrepareStrategy struct{}
func (*TrivialNodePrepareStrategy) CleanupDependentObjects ¶ added in v1.16.0
func (*TrivialNodePrepareStrategy) CleanupDependentObjects(nodeName string, client clientset.Interface) error
func (*TrivialNodePrepareStrategy) CleanupNode ¶ added in v1.5.0
func (*TrivialNodePrepareStrategy) CleanupNode(node *v1.Node) *v1.Node
func (*TrivialNodePrepareStrategy) PrepareDependentObjects ¶ added in v1.16.0
func (*TrivialNodePrepareStrategy) PreparePatch ¶ added in v1.5.0
func (*TrivialNodePrepareStrategy) PreparePatch(*v1.Node) []byte
type UniqueNodeLabelStrategy ¶ added in v1.18.0
type UniqueNodeLabelStrategy struct {
LabelKey string
}
UniqueNodeLabelStrategy sets a unique label for each node.
func NewUniqueNodeLabelStrategy ¶ added in v1.18.0
func NewUniqueNodeLabelStrategy(labelKey string) *UniqueNodeLabelStrategy
func (*UniqueNodeLabelStrategy) CleanupDependentObjects ¶ added in v1.18.0
func (*UniqueNodeLabelStrategy) CleanupDependentObjects(nodeName string, client clientset.Interface) error
func (*UniqueNodeLabelStrategy) CleanupNode ¶ added in v1.18.0
func (s *UniqueNodeLabelStrategy) CleanupNode(node *v1.Node) *v1.Node
func (*UniqueNodeLabelStrategy) PrepareDependentObjects ¶ added in v1.18.0
func (*UniqueNodeLabelStrategy) PreparePatch ¶ added in v1.18.0
func (s *UniqueNodeLabelStrategy) PreparePatch(*v1.Node) []byte
type UpdateDeploymentFunc ¶ added in v1.8.0
type UpdateDeploymentFunc func(d *apps.Deployment)
type UpdateReplicaSetFunc ¶ added in v1.9.0
type UpdateReplicaSetFunc func(d *apps.ReplicaSet)