remoteclient

package
v1.1.16 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectToRemoteCluster added in v1.0.1

func ConnectToRemoteCluster(
	cd *hivev1.ClusterDeployment,
	remoteClientBuilder Builder,
	localClient client.Client,
	logger log.FieldLogger,
) (remoteClient client.Client, unreachable, requeue bool)

ConnectToRemoteCluster connects to a remote cluster using the specified builder. If the ClusterDeployment is marked as unreachable, then no connection will be made. If there are problems connecting, then the specified clusterdeployment will be marked as unreachable.

func InitialURL added in v1.0.1

func InitialURL(c client.Client, cd *hivev1.ClusterDeployment) (string, error)

InitialURL returns the initial API URL for the ClusterDeployment.

func IsPrimaryURLActive added in v1.0.1

func IsPrimaryURLActive(cd *hivev1.ClusterDeployment) bool

IsPrimaryURLActive returns true if the remote cluster is reachable via the primary API URL.

func SetUnreachableCondition added in v1.0.1

func SetUnreachableCondition(cd *hivev1.ClusterDeployment, connectionError error) (changed bool)

SetUnreachableCondition sets the Unreachable condition on the ClusterDeployment based on the specified error encountered when attempting to connect to the remote cluster.

func Unreachable added in v1.0.1

func Unreachable(cd *hivev1.ClusterDeployment) (unreachable bool, lastCheck time.Time)

Unreachable returns true if Hive has not been able to reach the remote cluster. Note that this function will not attempt to reach the remote cluster. It only checks the current conditions on the ClusterDeployment to determine if the remote cluster is reachable.

Types

type Builder

type Builder interface {
	// Build will return a static controller-runtime client for the remote cluster.
	Build() (client.Client, error)

	// BuildDynamic will return a dynamic kubeclient for the remote cluster.
	BuildDynamic() (dynamic.Interface, error)

	// BuildKubeClient will return a kubernetes client for the remote cluster.
	BuildKubeClient() (kubeclient.Interface, error)

	// RESTConfig returns the config for a REST client that connects to the remote cluster.
	RESTConfig() (*rest.Config, error)

	// UsePrimaryAPIURL will use the primary API URL. If there is an API URL override, then that is the primary.
	// Otherwise, the primary is the default API URL.
	UsePrimaryAPIURL() Builder

	// UseSecondaryAPIURL will use the secondary API URL. If there is an API URL override, then the initial API URL
	// is the secondary.
	UseSecondaryAPIURL() Builder
}

Builder is used to build API clients to the remote cluster

func NewBuilder

func NewBuilder(c client.Client, cd *hivev1.ClusterDeployment, controllerName hivev1.ControllerName) Builder

NewBuilder creates a new Builder for creating a client to connect to the remote cluster associated with the specified ClusterDeployment. The controllerName is needed for metrics. If the ClusterDeployment carries the fake cluster annotation, a fake client will be returned populated with runtime.Objects we need to query for in all our controllers.

func NewBuilderFromKubeconfig added in v1.0.6

func NewBuilderFromKubeconfig(c client.Client, secret *corev1.Secret) Builder

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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