Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyPlatformSecret(ctx context.Context, client Client, kubeClient kubernetes.Interface, ...) error
- func CanAccessInstance(ctx context.Context, managementClient kube.Interface, namespace, name string, ...) (bool, error)
- func CanAccessProjectSecret(ctx context.Context, managementClient kube.Interface, namespace, name string) (bool, error)
- func CreateSpaceInstanceOptions(ctx context.Context, client Client, config string, projectName string, ...) (kubeconfig.ContextOptions, error)
- func CreateVirtualClusterInstanceOptions(ctx context.Context, client Client, config string, projectName string, ...) (kubeconfig.ContextOptions, error)
- func GetCurrentUser(ctx context.Context, managementClient kube.Interface) (*managementv1.UserInfo, *clusterv1.EntityInfo, error)
- func LatestCompatibleVersion(ctx context.Context) (string, error)
- func ResolveVirtualClusterTemplate(ctx context.Context, client Client, project, template, templateVersion string, ...) (*managementv1.VirtualClusterTemplate, string, error)
- func RetrieveCaData(cluster *managementv1.Cluster) ([]byte, error)
- func SelectCluster(ctx context.Context, client Client, log log.Logger) (string, error)
- func SelectProjectCluster(ctx context.Context, client Client, project *managementv1.Project, ...) (string, error)
- func SelectProjectOrCluster(ctx context.Context, client Client, clusterName, projectName string, ...) (cluster string, project string, err error)
- func SelectSpaceAndClusterName(ctx context.Context, client Client, spaceName, clusterName string, ...) (string, string, error)
- func SelectSpaceInstanceOrSpace(ctx context.Context, client Client, spaceName, projectName, clusterName string, ...) (string, string, string, error)
- func SelectSpaceTemplate(ctx context.Context, client Client, projectName, templateName string, ...) (*managementv1.SpaceTemplate, error)
- func SelectUserOrTeam(ctx context.Context, client Client, clusterName string, log log.Logger) (*clusterv1.EntityInfo, *clusterv1.EntityInfo, error)
- func SelectVirtualClusterAndSpaceAndClusterName(ctx context.Context, client Client, ...) (string, string, string, error)
- func SelectVirtualClusterInstanceOrVirtualCluster(ctx context.Context, client Client, ...) (string, string, string, string, error)
- func SelectVirtualClusterTemplate(ctx context.Context, client Client, projectName, templateName string, ...) (*managementv1.VirtualClusterTemplate, error)
- func Timeout() time.Duration
- func VerifyVersion(platformClient Client) error
- func VirtualClusterAccessPointCertificate(client Client, project, virtualCluster string, forceRefresh bool) (string, string, error)
- func WaitForSpaceInstance(ctx context.Context, managementClient kube.Interface, namespace, name string, ...) (*managementv1.SpaceInstance, error)
- type Client
- type ClusterSpace
- type ClusterUserOrTeam
- type ClusterVirtualCluster
- type LoginClient
- type ProjectProjectSecret
- type SpaceInstanceProject
- type VirtualClusterInstanceProject
Constants ¶
const ( LoftDirectClusterEndpointCaData = "loft.sh/direct-cluster-endpoint-ca-data" VersionPath = "%s/version" LoginPath = "%s/login?cli=true" RedirectPath = "%s/spaces" AccessKeyPath = "%s/profile/access-keys" ConfigFileName = "platform.json" RefreshToken = time.Minute * 30 CacheFolder = ".vcluster" )
const DefaultPlatformSecretName = "vcluster-platform-api-key"
Variables ¶
var ( MinimumVersionTag = "v3.3.0-alpha.26" MinimumVersion = semver.MustParse(strings.TrimPrefix(MinimumVersionTag, "v")) )
var (
Self *managementv1.Self
)
Functions ¶
func ApplyPlatformSecret ¶
func CanAccessInstance ¶
func CanAccessProjectSecret ¶
func CreateSpaceInstanceOptions ¶
func CreateSpaceInstanceOptions(ctx context.Context, client Client, config string, projectName string, spaceInstance *managementv1.SpaceInstance, setActive bool) (kubeconfig.ContextOptions, error)
func CreateVirtualClusterInstanceOptions ¶
func CreateVirtualClusterInstanceOptions(ctx context.Context, client Client, config string, projectName string, virtualClusterInstance *managementv1.VirtualClusterInstance, setActive bool) (kubeconfig.ContextOptions, error)
func GetCurrentUser ¶
func GetCurrentUser(ctx context.Context, managementClient kube.Interface) (*managementv1.UserInfo, *clusterv1.EntityInfo, error)
func LatestCompatibleVersion ¶
LatestCompatibleVersion returns the latest compatible version of vCluster.Pro
func RetrieveCaData ¶
func RetrieveCaData(cluster *managementv1.Cluster) ([]byte, error)
func SelectCluster ¶
SelectCluster lets the user select a cluster
func SelectProjectCluster ¶
func SelectProjectCluster(ctx context.Context, client Client, project *managementv1.Project, log log.Logger) (string, error)
SelectProjectCluster lets the user select a cluster from the project's allowed clusters
func SelectProjectOrCluster ¶
func SelectSpaceAndClusterName ¶
func SelectSpaceAndClusterName(ctx context.Context, client Client, spaceName, clusterName string, log log.Logger) (string, string, error)
SelectSpaceAndClusterName selects a space and cluster name
func SelectSpaceTemplate ¶
func SelectSpaceTemplate(ctx context.Context, client Client, projectName, templateName string, log log.Logger) (*managementv1.SpaceTemplate, error)
func SelectUserOrTeam ¶
func SelectUserOrTeam(ctx context.Context, client Client, clusterName string, log log.Logger) (*clusterv1.EntityInfo, *clusterv1.EntityInfo, error)
SelectUserOrTeam lets the user select an user or team in a cluster
func SelectVirtualClusterTemplate ¶
func SelectVirtualClusterTemplate(ctx context.Context, client Client, projectName, templateName string, log log.Logger) (*managementv1.VirtualClusterTemplate, error)
func VerifyVersion ¶
VerifyVersion checks if the Loft version is compatible with this CLI version
func WaitForSpaceInstance ¶
Types ¶
type Client ¶
type Client interface { LoginClient Logout(ctx context.Context) error Self() *managementv1.Self RefreshSelf(ctx context.Context) error Management() (kube.Interface, error) Cluster(cluster string) (kube.Interface, error) Config() *config.CLI Save() error Version() (*auth.Version, error) }
func InitClientFromConfig ¶
InitClientFromConfig returns a client with the client identity initialized through the selves api. Use this by default, unless performing actions that don't require a log in (like login itself).
func NewClientFromConfig ¶
NewClientFromConfig returns a client without the client identity initialized through the selves api. Use this only when performing actions that don't require a log in (like login itself).
type ClusterSpace ¶
type ClusterUserOrTeam ¶
type ClusterUserOrTeam struct { Team bool ClusterMember managementv1.ClusterMember }
func SelectClusterUserOrTeam ¶
type ClusterVirtualCluster ¶
type ClusterVirtualCluster struct { clusterv1.VirtualCluster Cluster string }
func GetVirtualClusters ¶
func GetVirtualClusters(ctx context.Context, client Client, log log.Logger) ([]ClusterVirtualCluster, error)
GetVirtualClusters returns all virtual clusters the user has access to
type LoginClient ¶
type LoginClient interface { Login(host string, insecure bool, log log.Logger) error LoginWithAccessKey(host, accessKey string, insecure bool) error }
func NewLoginClientFromConfig ¶
func NewLoginClientFromConfig(config *config.CLI) LoginClient
type ProjectProjectSecret ¶
type ProjectProjectSecret struct { ProjectSecret managementv1.ProjectSecret Project string }
func GetProjectSecrets ¶
type SpaceInstanceProject ¶
type SpaceInstanceProject struct { SpaceInstance *managementv1.SpaceInstance Project *managementv1.Project }
func GetSpaceInstances ¶
func GetSpaceInstances(ctx context.Context, client Client) ([]*SpaceInstanceProject, error)
type VirtualClusterInstanceProject ¶
type VirtualClusterInstanceProject struct { VirtualCluster *managementv1.VirtualClusterInstance Project *managementv1.Project }
func GetVirtualClusterInstances ¶
func GetVirtualClusterInstances(ctx context.Context, client Client) ([]*VirtualClusterInstanceProject, error)
func ListVClusters ¶
func ListVClusters(ctx context.Context, client Client, virtualClusterName, projectName string) ([]*VirtualClusterInstanceProject, error)
ListVClusters lists all virtual clusters across all projects if virtualClusterName and projectName are empty. The list can be narrowed down by the given virtual cluster name and project name.