clusters

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2025 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultClusterOptions added in v0.7.0

func DefaultClusterOptions(scheme *runtime.Scheme) cluster.Option

DefaultClusterOptions returns the default cluster options. This is useful when one wants to add custom cluster options without overwriting the default ones via WithClusterOptions().

Types

type Cluster

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

func New

func New(id string) *Cluster

Initializes a new cluster. Panics if id is empty.

func (*Cluster) APIServerEndpoint

func (c *Cluster) APIServerEndpoint() string

APIServerEndpoint returns the cluster's API server endpoint. Returns an empty string if the REST config has not been initialized.

func (*Cluster) Client

func (c *Cluster) Client() client.Client

Client returns the cluster's client.

func (*Cluster) Cluster

func (c *Cluster) Cluster() cluster.Cluster

Cluster returns the cluster's controller-runtime 'Cluster' representation.

func (*Cluster) ConfigPath

func (c *Cluster) ConfigPath() string

ConfigPath returns the cluster's config path.

func (*Cluster) HasClient

func (c *Cluster) HasClient() bool

HasClient returns true if the cluster has a client. If this returns false, create a client via InitializeClient().

func (*Cluster) HasID

func (c *Cluster) HasID() bool

HasID returns true if the cluster has an id. If this returns false, initialize a new cluster via New() or InitializeID().

func (*Cluster) HasRESTConfig

func (c *Cluster) HasRESTConfig() bool

HasRESTConfig returns true if the cluster has a REST config. If this returns false, load the config via InitializeRESTConfig().

func (*Cluster) ID

func (c *Cluster) ID() string

ID returns the cluster's id.

func (*Cluster) InitializeClient

func (c *Cluster) InitializeClient(scheme *runtime.Scheme) error

InitializeClient creates a new client for the cluster. This also initializes the cluster's controller-runtime 'Cluster' representation. Panics if the cluster's REST config has not been loaded (InitializeRESTConfig must be called first).

func (*Cluster) InitializeID

func (c *Cluster) InitializeID(id string)

InitializeID sets the cluster's id. Panics if id is empty.

func (*Cluster) InitializeRESTConfig

func (c *Cluster) InitializeRESTConfig() error

InitializeRESTConfig loads the cluster's REST config. Panics if the cluster's id is not set (InitializeID must be called first).

func (*Cluster) RESTConfig

func (c *Cluster) RESTConfig() *rest.Config

RESTConfig returns the cluster's REST config. This returns a pointer, but modification can lead to inconsistent behavior and is not recommended.

func (*Cluster) RegisterConfigPathFlag

func (c *Cluster) RegisterConfigPathFlag(flags *flag.FlagSet)

RegisterConfigPathFlag adds a flag '--<id>-cluster' for the cluster's config path to the given flag set. Panics if the cluster's id is not set.

func (*Cluster) Scheme

func (c *Cluster) Scheme() *runtime.Scheme

Scheme returns the cluster's scheme. Returns nil if the client has not been initialized.

func (*Cluster) WithClientOptions added in v0.7.0

func (c *Cluster) WithClientOptions(opts client.Options) *Cluster

WithClientOptions allows to overwrite the default client options. It must be called before InitializeClient(). Note that using this method disables the the scheme injection during client initialization. This means that the required scheme should already be set in the options that are passed into this method. Returns the cluster for chaining.

func (*Cluster) WithClusterOptions added in v0.7.0

func (c *Cluster) WithClusterOptions(opts ...cluster.Option) *Cluster

WithClusterOptions allows to overwrite the default cluster options. It must be called before InitializeClient(). Note that using this method disables the the scheme injection during client initialization. This means that the required scheme should be set by the cluster options that are passed into this method. The DefaultClusterOptions function can be passed in as a cluster option to set the scheme. Returns the cluster for chaining.

func (*Cluster) WithConfigPath

func (c *Cluster) WithConfigPath(cfgPath string) *Cluster

WithConfigPath sets the config path for the cluster. Returns the cluster for chaining.

func (*Cluster) WithRESTConfig added in v0.6.0

func (c *Cluster) WithRESTConfig(cfg *rest.Config) *Cluster

WithRestConfig allows to set the REST config manually. Returns the cluster for chaining.

Jump to

Keyboard shortcuts

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