client

package
v0.0.0-...-66691d1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPreferredFleetAddress

func GetPreferredFleetAddress(fleet *corev1alpha1.Fleet, preferredAddressTypes []corev1alpha1.FleetAddressType) (string, error)

GetPreferredFleetAddress returns the address of the provided node, using the provided preference order. If none of the preferred address types are found, an error is returned.

func MakeInsecureTransport

func MakeInsecureTransport(config *SphereletClientConfig) (http.RoundTripper, error)

MakeInsecureTransport creates an insecure RoundTripper for HTTP Transport.

func MakeTransport

func MakeTransport(config *SphereletClientConfig) (http.RoundTripper, error)

MakeTransport creates a secure RoundTripper for HTTP Transport.

Types

type ConnectionInfo

type ConnectionInfo struct {
	Scheme                         string
	Hostname                       string
	Port                           string
	Transport                      http.RoundTripper
	InsecureSkipTLSVerifyTransport http.RoundTripper
}

ConnectionInfo provides the information needed to connect to a spherelet.

type ConnectionInfoGetter

type ConnectionInfoGetter interface {
	GetConnectionInfo(ctx context.Context, fleetName string) (*ConnectionInfo, error)
}

func NewFleetConnectionInfoGetter

func NewFleetConnectionInfoGetter(fleets FleetGetter, config SphereletClientConfig) (ConnectionInfoGetter, error)

type FleetConnectionInfoGetter

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

FleetConnectionInfoGetter obtains connection info from the status of a Fleet API object

func (*FleetConnectionInfoGetter) GetConnectionInfo

func (k *FleetConnectionInfoGetter) GetConnectionInfo(ctx context.Context, fleetName string) (*ConnectionInfo, error)

GetConnectionInfo retrieves connection info from the status of a Node API object.

type FleetGetter

type FleetGetter interface {
	Get(ctx context.Context, name string, options metav1.GetOptions) (*corev1alpha1.Fleet, error)
}

FleetGetter defines an interface for looking up a node by name

type FleetGetterFunc

type FleetGetterFunc func(ctx context.Context, name string, options metav1.GetOptions) (*corev1alpha1.Fleet, error)

FleetGetterFunc allows implementing FleetGetter with a function

func (FleetGetterFunc) Get

Get fetches information via FleetGetterFunc.

type NoMatchError

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

NoMatchError is a typed implementation of the error interface. It indicates a failure to get a matching Node.

func (*NoMatchError) Error

func (e *NoMatchError) Error() string

Error is the implementation of the conventional interface for representing an error condition, with the nil value representing no error.

type SphereletClientConfig

type SphereletClientConfig struct {
	// Port specifies the default port - used if no information about Spherelet port can be found in Node.NodeStatus.DaemonEndpoints.
	Port uint

	// ReadOnlyPort specifies the Port for ReadOnly communications.
	ReadOnlyPort uint

	// PreferredAddressTypes - used to select an address from Node.NodeStatus.Addresses
	PreferredAddressTypes []string

	// TLSClientConfig contains settings to enable transport layer security
	rest.TLSClientConfig

	// Server requires Bearer authentication
	BearerToken string `datapolicy:"token"`

	// HTTPTimeout is used by the client to timeout http requests to Spherelet.
	HTTPTimeout time.Duration

	// Dial is a custom dialer used for the client
	Dial utilnet.DialFunc

	// Lookup will give us a dialer if the egress selector is configured for it
	Lookup egressselector.Lookup
}

Jump to

Keyboard shortcuts

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