Documentation
¶
Index ¶
- func CurrentContext() (string, error)
- func DefaultIOStreams() genericclioptions.IOStreams
- func GenerateNamespace(namespace string, labels map[string]string) *corev1.Namespace
- func WaitDeploymentReady(ctx context.Context, f Factory, ns, name string) (bool, error)
- type DeleteOptions
- type DeleteResourceOptions
- type Factory
- type Resource
- type WaitFunc
- type WaitOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentContext ¶
func CurrentContext() (string, error)
CurrentContext returns the name of the current kubernetes context or dies.
func DefaultIOStreams ¶
func DefaultIOStreams() genericclioptions.IOStreams
func GenerateNamespace ¶
func GenerateNamespace(namespace string, labels map[string]string) *corev1.Namespace
func WaitDeploymentReady ¶
func WaitDeploymentReady(ctx context.Context, f Factory, ns, name string) (bool, error)
WaitDeploymentReady can be used as a generic 'WaitFunc' for deployment.
Types ¶
type DeleteOptions ¶ added in v0.2.9
type DeleteOptions struct {
LabelSelector string
ResourceTypes []string
Timeout time.Duration
WaitForDeletion bool
}
type DeleteResourceOptions ¶ added in v0.4.19
type DeleteResourceOptions struct {
Namespace string
Name string
Resource schema.GroupVersionResource
}
type Factory ¶
type Factory interface {
// KubernetesClientSet returns a new kubernetes clientset or error
KubernetesClientSet() (kubernetes.Interface, error)
// KubernetesClientSetOrDie calls KubernetesClientSet() and panics if it returns an error
KubernetesClientSetOrDie() kubernetes.Interface
// ToRESTConfig returns a rest Config object or error
ToRESTConfig() (*restclient.Config, error)
// Apply applies the provided manifests
Apply(ctx context.Context, manifests []byte) error
// Delete delets the resources by their type(s) and labelSelector
Delete(context.Context, *DeleteOptions) error
// Delete deletes a specific resource by namespace/name
DeleteResource(context.Context, *DeleteResourceOptions) error
// Wait waits for all of the provided `Resources` to be ready by calling
// the `WaitFunc` of each resource until all of them returns `true`
Wait(context.Context, *WaitOptions) error
}
type Resource ¶
type Resource struct {
Name string
Namespace string
// WaitFunc will be called to check if the resources is ready. Should return (true, nil)
// if the resources is ready, (false, nil) if the resource is not ready yet, or (false, err)
// if some error occured (in that case the `Wait` will fail with that error).
WaitFunc WaitFunc
}
type WaitFunc ¶ added in v0.2.9
type WaitFunc func(ctx context.Context, f Factory, ns, name string) (bool, error)
type WaitOptions ¶
type WaitOptions struct {
// Inverval the duration between each iteration of calling all of the resources' `WaitFunc`s.
Interval time.Duration
// Timeout the max time to wait for all of the resources to be ready. If not all of the
// resourecs are ready at time this will cause `Wait` to return an error.
Timeout time.Duration
// Resources the list of resources to wait for.
Resources []Resource
}
Click to show internal directories.
Click to hide internal directories.