Documentation ¶
Overview ¶
Package factory implements the logic to initialize common objects for liqoctl commands.
Index ¶
- Constants
- func WithScopedPrinter(o *options)
- type Factory
- func (f *Factory) AddFlags(flags *pflag.FlagSet, register completionFuncRegisterer)
- func (f *Factory) AddLiqoNamespaceFlag(flags *pflag.FlagSet)
- func (f *Factory) AddNamespaceFlag(flags *pflag.FlagSet)
- func (f *Factory) HelmClient() helm.Client
- func (f *Factory) HelmClientOrError() (helm.Client, error)
- func (f *Factory) Initialize(opts ...Options) (err error)
- type Options
Constants ¶
const FlagNamespace = "namespace"
FlagNamespace -> the name of the namespace flag.
Variables ¶
This section is empty.
Functions ¶
func WithScopedPrinter ¶
func WithScopedPrinter(o *options)
WithScopedPrinter marks the generated printer as scoped.
Types ¶
type Factory ¶
type Factory struct { // Printer is the object used to output messages in the appropriate format. Printer *output.Printer // SkipConfirm determines whether to skip confirmations. SkipConfirm bool // Whether to add a scope to the printer (i.e., local/remote). ScopedPrinter bool // Namespace is the namespace that the user has requested with the "--namespace" / "-n" flag, if registered (alternative to LiqoNamespace). Namespace string // LiqoNamespace is the namespace (where Liqo is installed) that the user has requested with the "--namespace" / "-n" flag, // if registered (alternative to Namespace). LiqoNamespace string // RESTConfig is a Kubernetes REST config that contains the user's authentication and access configuration. RESTConfig *rest.Config // crClient is the controller runtime client. CRClient client.Client // kubeClient is a Kubernetes clientset for interacting with the base Kubernetes APIs. KubeClient kubernetes.Interface // contains filtered or unexported fields }
Factory provides a set of clients and configurations to authenticate and access a target Kubernetes cluster. Factory will ensure that its fields are populated and valid during command execution.
func NewForLocal ¶
func NewForLocal() *Factory
NewForLocal returns a new initialized Factory, to interact with a remote cluster.
func NewForRemote ¶
func NewForRemote() *Factory
NewForRemote returns a new initialized Factory, to interact with a remote cluster.
func (*Factory) AddFlags ¶
AddFlags registers the flags to interact with the Kubernetes access options, and the corresponding completion functions.
func (*Factory) AddLiqoNamespaceFlag ¶
AddLiqoNamespaceFlag registers the flag to select the Liqo namespace (alternative to AddNamespaceFlag).
func (*Factory) AddNamespaceFlag ¶
AddNamespaceFlag registers the flag to select the target namespace (alternative to AddLiqoNamespaceFlag).
func (*Factory) HelmClient ¶
HelmClient returns an Helm client, initializing it if necessary. In case of error, it outputs the error (through the spinner if provided, or leveraging the printer) and exits.
func (*Factory) HelmClientOrError ¶
HelmClientOrError returns an Helm client, initializing it if necessary.
func (*Factory) Initialize ¶
Initialize populates the object based on the provided flags.