factory

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package factory implements the logic to initialize common objects for liqoctl commands.

Index

Constants

View Source
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

func (f *Factory) AddFlags(flags *pflag.FlagSet, register completionFuncRegisterer)

AddFlags registers the flags to interact with the Kubernetes access options, and the corresponding completion functions.

func (*Factory) AddLiqoNamespaceFlag

func (f *Factory) AddLiqoNamespaceFlag(flags *pflag.FlagSet)

AddLiqoNamespaceFlag registers the flag to select the Liqo namespace (alternative to AddNamespaceFlag).

func (*Factory) AddNamespaceFlag

func (f *Factory) AddNamespaceFlag(flags *pflag.FlagSet)

AddNamespaceFlag registers the flag to select the target namespace (alternative to AddLiqoNamespaceFlag).

func (*Factory) HelmClient

func (f *Factory) HelmClient() helm.Client

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

func (f *Factory) HelmClientOrError() (helm.Client, error)

HelmClientOrError returns an Helm client, initializing it if necessary.

func (*Factory) Initialize

func (f *Factory) Initialize(opts ...Options) (err error)

Initialize populates the object based on the provided flags.

type Options

type Options func(*options)

Options represents an option for the initialize function.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL