client

package
v3.4.1-beta.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MPL-2.0 Imports: 32 Imported by: 16

Documentation

Index

Constants

View Source
const (
	VersionPath   = "%s/version"
	LoginPath     = "%s/login?cli=true"
	RedirectPath  = "%s/spaces"
	AccessKeyPath = "%s/profile/access-keys"
	RefreshToken  = time.Minute * 30
)

Variables

View Source
var CacheFolder = ".loft"
View Source
var DefaultCacheConfig = "config.json"

DefaultCacheConfig is the path to the config

Functions

func GetKubeConfig

func GetKubeConfig(host, token, namespace string, insecure bool) clientcmd.ClientConfig

func GetRestConfig

func GetRestConfig(host, token string, insecure bool) (*rest.Config, error)

func VerifyVersion

func VerifyVersion(baseClient Client) error

VerifyVersion checks if the Loft version is compatible with this CLI version

Types

type Client

type Client interface {
	Management() (kube.Interface, error)
	ManagementConfig() (*rest.Config, error)

	SpaceInstance(project, name string) (kube.Interface, error)
	SpaceInstanceConfig(project, name string) (*rest.Config, error)

	VirtualClusterInstance(project, name string) (kube.Interface, error)
	VirtualClusterInstanceConfig(project, name string) (*rest.Config, error)

	Cluster(cluster string) (kube.Interface, error)
	ClusterConfig(cluster string) (*rest.Config, error)

	VirtualCluster(cluster, namespace, virtualCluster string) (kube.Interface, error)
	VirtualClusterConfig(cluster, namespace, virtualCluster string) (*rest.Config, error)

	Login(host string, insecure bool, log log.Logger) error
	LoginWithAccessKey(host, accessKey string, insecure bool) error
	LoginRaw(host, accessKey string, insecure bool) error

	Logout(ctx context.Context) error

	Version() (*auth.Version, error)
	Config() *Config
	DirectClusterEndpointToken(forceRefresh bool) (string, error)
	VirtualClusterAccessPointCertificate(project, virtualCluster string, forceRefresh bool) (string, string, error)
	Save() error
}

func NewClient

func NewClient() Client

func NewClientFromPath

func NewClientFromPath(path string) (Client, error)

type Config

type Config struct {
	metav1.TypeMeta `json:",inline"`

	// host is the http endpoint of how to access loft
	// +optional
	Host string `json:"host,omitempty"`

	// LastInstallContext is the last install context
	// +optional
	LastInstallContext string `json:"lastInstallContext,omitempty"`

	// insecure specifies if the loft instance is insecure
	// +optional
	Insecure bool `json:"insecure,omitempty"`

	// access key is the access key for the given loft host
	// +optional
	AccessKey string `json:"accesskey,omitempty"`

	// DEPRECATED: do not use anymore
	// the direct cluster endpoint token
	// +optional
	DirectClusterEndpointToken string `json:"directClusterEndpointToken,omitempty"`

	// DEPRECATED: do not use anymore
	// last time the direct cluster endpoint token was requested
	// +optional
	DirectClusterEndpointTokenRequested *metav1.Time `json:"directClusterEndpointTokenRequested,omitempty"`

	// map of cached certificates for "access point" mode virtual clusters
	// +optional
	VirtualClusterAccessPointCertificates map[string]VirtualClusterCertificatesEntry
}

Config defines the client config structure

func NewConfig

func NewConfig() *Config

NewConfig creates a new config

type VirtualClusterCertificatesEntry

type VirtualClusterCertificatesEntry struct {
	CertificateData string
	KeyData         string
	LastRequested   metav1.Time
	ExpirationTime  time.Time
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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