package wait
import "k8s.io/kubectl/pkg/cmd/wait"
Index ¶
- func IsCreated(ctx context.Context, info *resource.Info, o *WaitOptions) (runtime.Object, bool, error)
- func IsDeleted(ctx context.Context, info *resource.Info, o *WaitOptions) (runtime.Object, bool, error)
- func NewCmdWait(restClientGetter genericclioptions.RESTClientGetter, streams genericiooptions.IOStreams) *cobra.Command
- type ConditionFunc
- type ConditionalWait
- type JSONPathWait
- type ResourceLocation
- type UIDMap
- type Wait
- type WaitFlags
- func NewWaitFlags(restClientGetter genericclioptions.RESTClientGetter, streams genericiooptions.IOStreams) *WaitFlags
- func (flags *WaitFlags) AddFlags(cmd *cobra.Command)
- func (flags *WaitFlags) ToOptions(args []string) (*WaitOptions, error)
- type WaitOptions
Functions ¶
func IsCreated ¶
func IsCreated(ctx context.Context, info *resource.Info, o *WaitOptions) (runtime.Object, bool, error)
IsCreated is a condition func for waiting for something to be created
func IsDeleted ¶
func IsDeleted(ctx context.Context, info *resource.Info, o *WaitOptions) (runtime.Object, bool, error)
IsDeleted is a condition func for waiting for something to be deleted
func NewCmdWait ¶
func NewCmdWait(restClientGetter genericclioptions.RESTClientGetter, streams genericiooptions.IOStreams) *cobra.Command
NewCmdWait returns a cobra command for waiting
Types ¶
type ConditionFunc ¶
type ConditionFunc func(ctx context.Context, info *resource.Info, o *WaitOptions) (finalObject runtime.Object, done bool, err error)
ConditionFunc is the interface for providing condition checks
type ConditionalWait ¶
type ConditionalWait struct {
// contains filtered or unexported fields
}
ConditionalWait hold information to check an API status condition
func (ConditionalWait) IsConditionMet ¶
func (w ConditionalWait) IsConditionMet(ctx context.Context, info *resource.Info, o *WaitOptions) (runtime.Object, bool, error)
IsConditionMet is a conditionfunc for waiting on an API condition to be met
type JSONPathWait ¶
type JSONPathWait struct {
// contains filtered or unexported fields
}
JSONPathWait holds a JSONPath Parser which has the ability to check for the JSONPath condition and compare with the API server provided JSON output.
func (JSONPathWait) IsJSONPathConditionMet ¶
func (j JSONPathWait) IsJSONPathConditionMet(ctx context.Context, info *resource.Info, o *WaitOptions) (runtime.Object, bool, error)
IsJSONPathConditionMet fulfills the requirements of the interface ConditionFunc which provides condition check
type ResourceLocation ¶
type ResourceLocation struct { GroupResource schema.GroupResource Namespace string Name string }
ResourceLocation holds the location of a resource
type UIDMap ¶
type UIDMap map[ResourceLocation]types.UID
UIDMap maps ResourceLocation with UID
type Wait ¶
type Wait struct {
// contains filtered or unexported fields
}
Wait has helper methods for handling watches, including error handling.
func (Wait) IsDeleted ¶
IsDeleted returns true if the object is deleted. It prints any errors it encounters.
type WaitFlags ¶
type WaitFlags struct { RESTClientGetter genericclioptions.RESTClientGetter PrintFlags *genericclioptions.PrintFlags ResourceBuilderFlags *genericclioptions.ResourceBuilderFlags Timeout time.Duration ForCondition string genericiooptions.IOStreams }
WaitFlags directly reflect the information that CLI is gathering via flags. They will be converted to Options, which reflect the runtime requirements for the command. This structure reduces the transformation to wiring and makes the logic itself easy to unit test
func NewWaitFlags ¶
func NewWaitFlags(restClientGetter genericclioptions.RESTClientGetter, streams genericiooptions.IOStreams) *WaitFlags
NewWaitFlags returns a default WaitFlags
func (*WaitFlags) AddFlags ¶
AddFlags registers flags for a cli
func (*WaitFlags) ToOptions ¶
func (flags *WaitFlags) ToOptions(args []string) (*WaitOptions, error)
ToOptions converts from CLI inputs to runtime inputs
type WaitOptions ¶
type WaitOptions struct { ResourceFinder genericclioptions.ResourceFinder // UIDMap maps a resource location to a UID. It is optional, but ConditionFuncs may choose to use it to make the result // more reliable. For instance, delete can look for UID consistency during delegated calls. UIDMap UIDMap DynamicClient dynamic.Interface Timeout time.Duration ForCondition string Printer printers.ResourcePrinter ConditionFn ConditionFunc genericiooptions.IOStreams }
WaitOptions is a set of options that allows you to wait. This is the object reflects the runtime needs of a wait command, making the logic itself easy to unit test with our existing mocks.
func (*WaitOptions) RunWait ¶
func (o *WaitOptions) RunWait() error
RunWait runs the waiting logic
Source Files ¶
condition.go create.go delete.go json.go wait.go
- Version
- v0.32.3 (latest)
- Published
- Mar 12, 2025
- Platform
- linux/amd64
- Imports
- 30 packages
- Last checked
- 5 days ago –
Tools for package owners.