Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyPlatformSecret(ctx context.Context, config *config.CLI, 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, *storagev1.EntityInfo, error)
- func GetDeepValue(parameters interface{}, path string) interface{}
- func GetLatestMatchedVersion(versions storagev1.VersionsAccessor, versionPattern string) (latestVersion storagev1.VersionAccessor, ...)
- func GetLatestVersion(versions storagev1.VersionsAccessor) storagev1.VersionAccessor
- func LatestCompatibleVersion(ctx context.Context) (string, error)
- func ResolveTemplateParameters(set []string, parameters []storagev1.AppParameter, fileName string) (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 SelectSpaceInstance(ctx context.Context, client Client, spaceName, projectName string, ...) (string, string, string, error)
- func SelectSpaceTemplate(ctx context.Context, client Client, projectName, templateName string, ...) (*managementv1.SpaceTemplate, error)
- func SelectVirtualClusterInstance(ctx context.Context, client Client, virtualClusterName, projectName string, ...) (string, string, string, string, error)
- func SelectVirtualClusterTemplate(ctx context.Context, client Client, projectName, templateName string, ...) (*managementv1.VirtualClusterTemplate, error)
- func SetDeepValue(parameters interface{}, path string, value interface{})
- func VerifyValue(value string, parameter storagev1.AppParameter) (interface{}, 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)
- func WaitForVCluster(ctx context.Context, client Client, ...) error
- func WaitForVirtualClusterInstance(ctx context.Context, managementClient kube.Interface, namespace, name string, ...) (*managementv1.VirtualClusterInstance, error)
- type Client
- 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 = "v4.0.0-alpha.18" 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, *storagev1.EntityInfo, error)
func GetDeepValue ¶
func GetDeepValue(parameters interface{}, path string) interface{}
func GetLatestMatchedVersion ¶
func GetLatestMatchedVersion(versions storagev1.VersionsAccessor, versionPattern string) (latestVersion storagev1.VersionAccessor, latestMatchedVersion storagev1.VersionAccessor, err error)
func GetLatestVersion ¶
func GetLatestVersion(versions storagev1.VersionsAccessor) storagev1.VersionAccessor
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 SelectSpaceInstance ¶
func SelectSpaceTemplate ¶
func SelectSpaceTemplate(ctx context.Context, client Client, projectName, templateName string, log log.Logger) (*managementv1.SpaceTemplate, error)
func SelectVirtualClusterTemplate ¶
func SelectVirtualClusterTemplate(ctx context.Context, client Client, projectName, templateName string, log log.Logger) (*managementv1.VirtualClusterTemplate, error)
func SetDeepValue ¶
func SetDeepValue(parameters interface{}, path string, value interface{})
func VerifyValue ¶
func VerifyValue(value string, parameter storagev1.AppParameter) (interface{}, error)
func WaitForSpaceInstance ¶
func WaitForVCluster ¶
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) VirtualCluster(cluster, namespace, virtualCluster string) (kube.Interface, error) ManagementConfig() (*rest.Config, 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 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 { Project string ProjectSecret managementv1.ProjectSecret }
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 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.
func (*VirtualClusterInstanceProject) IsInstanceSleeping ¶
func (vci *VirtualClusterInstanceProject) IsInstanceSleeping() bool