restconfig

package
v0.16.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForBroker

func ForBroker(submariner *v1alpha1.Submariner, serviceDisc *v1alpha1.ServiceDiscovery) (*rest.Config, string, error)

Types

type AllContextFn added in v0.14.0

type AllContextFn func(clusterInfos []*cluster.Info, namespaces []string, status reporter.Interface) error

type PerContextFn added in v0.14.0

type PerContextFn func(clusterInfo *cluster.Info, namespace string, status reporter.Interface) error

func IfConnectivityInstalled added in v0.15.0

func IfConnectivityInstalled(functions ...PerContextFn) PerContextFn

func IfServiceDiscoveryInstalled added in v0.14.0

func IfServiceDiscoveryInstalled(functions ...PerContextFn) PerContextFn

type Producer

type Producer struct {
	// contains filtered or unexported fields
}

func NewProducer

func NewProducer() *Producer

NewProducer initialises a blank producer which needs to be set up with flags (see SetupFlags).

func (*Producer) RunOnAllContexts added in v0.14.0

func (rcp *Producer) RunOnAllContexts(function PerContextFn, status reporter.Interface) error

RunOnAllContexts runs the given function on all accessible non-prefixed contexts. If the user has explicitly selected one or more contexts, only those contexts are used. All appropriate contexts are processed, and any errors are aggregated. Returns an error if no contexts are found.

func (*Producer) RunOnSelectedContext added in v0.14.0

func (rcp *Producer) RunOnSelectedContext(function PerContextFn, status reporter.Interface) error

RunOnSelectedContext runs the given function on the selected context.

func (*Producer) RunOnSelectedContexts added in v0.14.0

func (rcp *Producer) RunOnSelectedContexts(function AllContextFn, status reporter.Interface) (bool, error)

RunOnSelectedContexts runs the given function on all selected contexts, passing them simultaneously. This specifically handles the "--contexts" (plural) flag. Returns true if there was at least one selected context, false otherwise.

func (*Producer) RunOnSelectedPrefixedContext added in v0.14.0

func (rcp *Producer) RunOnSelectedPrefixedContext(prefix string, function PerContextFn, status reporter.Interface) (bool, error)

RunOnSelectedPrefixedContext runs the given function on the selected prefixed context. Returns true if there was a selected prefix context, false otherwise.

func (*Producer) SetupFlags added in v0.14.0

func (rcp *Producer) SetupFlags(flags *pflag.FlagSet)

SetupFlags configures the given flags to control the producer settings.

func (*Producer) WithContextsFlag added in v0.14.0

func (rcp *Producer) WithContextsFlag() *Producer

WithContextsFlag configures the producer to allow multiple contexts to be selected with the --contexts flag. This is only usable with RunOnAllContexts and will act as a filter on the selected contexts.

func (*Producer) WithDefaultNamespace added in v0.14.0

func (rcp *Producer) WithDefaultNamespace(defaultNamespace string) *Producer

WithDefaultNamespace configures the producer to set up a namespace flag, with the given default value. The chosen namespace will be passed to the PerContextFn used to process the context.

func (*Producer) WithInClusterFlag added in v0.14.0

func (rcp *Producer) WithInClusterFlag() *Producer

WithInClusterFlag configures the producer to handle an --in-cluster flag, requesting the use of a Kubernetes-provided context.

func (*Producer) WithNamespace added in v0.14.0

func (rcp *Producer) WithNamespace() *Producer

WithNamespace configures the producer to set up a namespace flag. The chosen namespace will be passed to the PerContextFn used to process the context.

func (*Producer) WithPrefixedContext added in v0.14.0

func (rcp *Producer) WithPrefixedContext(prefix string) *Producer

WithPrefixedContext configures the producer to set up flags using the given prefix.

func (*Producer) WithPrefixedNamespace added in v0.15.0

func (rcp *Producer) WithPrefixedNamespace(prefix, prefixedNamespace string) *Producer

WithPrefixedNamespace configures the producer to set up a prefixed namespace flag, with the given default value. The chosen namespace will be passed to the PerContextFn used to process the context.

type RestConfig

type RestConfig struct {
	Config      *rest.Config
	ClusterName string
}

Jump to

Keyboard shortcuts

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