Documentation
¶
Index ¶
- func DefaultClusterOptions(scheme *runtime.Scheme) cluster.Option
- type Cluster
- func (c *Cluster) APIServerEndpoint() string
- func (c *Cluster) Client() client.Client
- func (c *Cluster) Cluster() cluster.Cluster
- func (c *Cluster) ConfigPath() string
- func (c *Cluster) HasClient() bool
- func (c *Cluster) HasID() bool
- func (c *Cluster) HasRESTConfig() bool
- func (c *Cluster) ID() string
- func (c *Cluster) InitializeClient(scheme *runtime.Scheme) error
- func (c *Cluster) InitializeID(id string)
- func (c *Cluster) InitializeRESTConfig() error
- func (c *Cluster) RESTConfig() *rest.Config
- func (c *Cluster) RegisterConfigPathFlag(flags *flag.FlagSet)
- func (c *Cluster) RegisterSingleConfigPathFlag(flags *flag.FlagSet)
- func (c *Cluster) Scheme() *runtime.Scheme
- func (c *Cluster) WithClientOptions(opts client.Options) *Cluster
- func (c *Cluster) WithClusterOptions(opts ...cluster.Option) *Cluster
- func (c *Cluster) WithConfigPath(cfgPath string) *Cluster
- func (c *Cluster) WithRESTConfig(cfg *rest.Config) *Cluster
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
func NewTestClusterFromClient ¶ added in v0.8.0
NewTestClusterFromClient creates a Cluster from a given client. Note that this method is meant for testing purposes only and it does not result in a fully functional Cluster. Calling anything except Client() on the resulting Cluster is undefined and might lead to panics or unexpected behavior.
func (*Cluster) APIServerEndpoint ¶
APIServerEndpoint returns the cluster's API server endpoint. Returns an empty string if the REST config has not been initialized.
func (*Cluster) Cluster ¶
Cluster returns the cluster's controller-runtime 'Cluster' representation.
func (*Cluster) ConfigPath ¶
ConfigPath returns the cluster's config path.
func (*Cluster) HasClient ¶
HasClient returns true if the cluster has a client. If this returns false, create a client via InitializeClient().
func (*Cluster) HasID ¶
HasID returns true if the cluster has an id. If this returns false, initialize a new cluster via New() or InitializeID().
func (*Cluster) HasRESTConfig ¶
HasRESTConfig returns true if the cluster has a REST config. If this returns false, load the config via InitializeRESTConfig().
func (*Cluster) InitializeClient ¶
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 ¶
InitializeID sets the cluster's id. Panics if id is empty.
func (*Cluster) InitializeRESTConfig ¶
InitializeRESTConfig loads the cluster's REST config. Panics if the cluster's id is not set (InitializeID must be called first).
func (*Cluster) RESTConfig ¶
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 ¶
RegisterConfigPathFlag adds a flag '--<id>-cluster' for the cluster's config path to the given flag set. If only a single kubeconfig is required, RegisterSingleConfigPathFlag can be used instead to have the flag named '--kubeconfig'. Panics if the cluster's id is not set.
func (*Cluster) RegisterSingleConfigPathFlag ¶ added in v0.8.0
RegisterSingleConfigPathFlag adds a '--kubeconfig' flag for the cluster's config path to the given flag set. If more than one kubeconfig is required, consider using RegisterConfigPathFlag instead, which is identical, but names the flag '--<id>-cluster'.
func (*Cluster) Scheme ¶
Scheme returns the cluster's scheme. Returns nil if the client has not been initialized.
func (*Cluster) WithClientOptions ¶ added in v0.7.0
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
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 ¶
WithConfigPath sets the config path for the cluster. Returns the cluster for chaining.