cli

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 99 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// ClusterCredentialLabelKey identifies the cluster secrets
	ClusterCredentialLabelKey = "cluster.core.oam.dev/cluster-credential"
	// FlagClusterName specifies the cluster name
	FlagClusterName = "name"
)
View Source
const (
	App       = "app"
	Service   = "svc"
	Namespace = "namespace"
)

constants used in `svc` command

View Source
const (
	// FlagDescription command flag to specify the description of the definition
	FlagDescription = "desc"
	// FlagDryRun command flag to disable actual changes and only display intend changes
	FlagDryRun = "dry-run"
	// FlagTemplateYAML command flag to specify which existing template YAML file to use
	FlagTemplateYAML = "template-yaml"
	// FlagOutput command flag to specify which file to save
	FlagOutput = "output"
	// FlagMessage command flag to specify which file to save
	FlagMessage = "message"
	// FlagType command flag to specify which definition type to use
	FlagType = "type"
	// FlagNamespace command flag to specify which namespace to use
	FlagNamespace = "namespace"
	// FlagInteractive command flag to specify the use of interactive process
	FlagInteractive = "interactive"
	// HelmChartNamespacePlaceholder is used as a placeholder for rendering definitions into helm chart format
	HelmChartNamespacePlaceholder = "###HELM_NAMESPACE###"
	// HelmChartFormatEnvName is the name of the environment variable to enable render helm chart format YAML
	HelmChartFormatEnvName = "AS_HELM_CHART"
)
View Source
const (
	// SideBar file name for docsify
	SideBar = "_sidebar.md"
	// NavBar file name for docsify
	NavBar = "_navbar.md"
	// IndexHTML file name for docsify
	IndexHTML = "index.html"
	// CSS file name for custom CSS
	CSS = "custom.css"
	// README file name for docsify
	README = "README.md"
)
View Source
const (
	// HealthStatusHealthy represents healthy status.
	HealthStatusHealthy = v1alpha2.StatusHealthy
	// HealthStatusUnhealthy represents unhealthy status.
	HealthStatusUnhealthy = v1alpha2.StatusUnhealthy
	// HealthStatusUnknown represents unknown status.
	HealthStatusUnknown = v1alpha2.StatusUnknown
)
View Source
const (
	ErrNotLoadAppConfig  = "cannot load the application"
	ErrFmtNotInitialized = "service: %s not ready"
	ErrServiceNotFound   = "service %s not found in app"
)

Error msg used in `status` command

View Source
const (
	// DescAnnotation records the description of addon
	DescAnnotation = "addons.oam.dev/description"
)
View Source
const (
	// Port is the port for reference docs website
	Port = ":18081"
)

Variables

View Source
var DefaultRegistry = "oss://registry.kubevela.net"

DefaultRegistry is default capability center of kubectl-vela

Functions

func AddTokenVarFlags

func AddTokenVarFlags(cmd *cobra.Command)

AddTokenVarFlags adds token flag to a command

func CapabilityCommandGroup

func CapabilityCommandGroup(c common2.Args, ioStream cmdutil.IOStreams) *cobra.Command

CapabilityCommandGroup commands for capability center

func CheckVelaRuntimeInstalledAndReady

func CheckVelaRuntimeInstalledAndReady(ioStreams cmdutil.IOStreams, c client.Client) (bool, error)

CheckVelaRuntimeInstalledAndReady checks whether vela-core runtime is installed and ready

func ClusterCommandGroup added in v1.1.1

func ClusterCommandGroup(c common.Args) *cobra.Command

ClusterCommandGroup create a group of cluster command

func CreateOrUpdateEnv

func CreateOrUpdateEnv(ctx context.Context, c client.Client, envArgs *types.EnvMeta, args []string, ioStreams cmdutil.IOStreams) error

CreateOrUpdateEnv creates or updates an environment

func DefinitionCommandGroup added in v1.1.0

func DefinitionCommandGroup(c common.Args) *cobra.Command

DefinitionCommandGroup create the command group for `vela def` command to manage definitions

func DeleteEnv

func DeleteEnv(ctx context.Context, args []string, ioStreams cmdutil.IOStreams) error

DeleteEnv deletes an environment

func DryRunApplication added in v1.0.3

func DryRunApplication(cmdOption *DryRunCmdOptions, c common.Args, namespace string) (bytes.Buffer, error)

DryRunApplication will dry-run an application and return the render result

func GetCapabilityByName

func GetCapabilityByName(name string, workloads []types.Capability) (types.Capability, error)

GetCapabilityByName get eponymous types.Capability from workloads by name

func GetEnv

func GetEnv(cmd *cobra.Command) (*types.EnvMeta, error)

GetEnv gets environment by name or current environment if no env exists, then init default environment

func GetOAMReleaseVersion

func GetOAMReleaseVersion(ns string) (string, error)

GetOAMReleaseVersion gets version of vela-core runtime helm release

func InstallCompByName added in v1.1.0

func InstallCompByName(args common2.Args, ioStream cmdutil.IOStreams, compName, regURL string) error

InstallCompByName will install given componentName comp to cluster from registry

func InstallTraitByName added in v1.1.0

func InstallTraitByName(args common2.Args, ioStream cmdutil.IOStreams, traitName, regURL string) error

InstallTraitByName will install given traitName trait to cluster

func ListConfigs

func ListConfigs(ioStreams cmdutil.IOStreams, cmd *cobra.Command) error

ListConfigs will list all configs

func ListEnvs

func ListEnvs(args []string, ioStreams cmdutil.IOStreams) error

ListEnvs shows info of all environments

func LiveDiffApplication added in v1.0.3

func LiveDiffApplication(cmdOption *LiveDiffCmdOptions, c common.Args, namespace string) (bytes.Buffer, error)

LiveDiffApplication can return user what would change if upgrade an application.

func NewAddonCommand added in v1.1.0

func NewAddonCommand(c common.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewAddonCommand create `addon` command

func NewAddonDisableCommand added in v1.1.0

func NewAddonDisableCommand(ioStream cmdutil.IOStreams) *cobra.Command

NewAddonDisableCommand create addon disable command

func NewAddonEnableCommand added in v1.1.0

func NewAddonEnableCommand(ioStream cmdutil.IOStreams) *cobra.Command

NewAddonEnableCommand create addon enable command

func NewAddonListCommand added in v1.1.0

func NewAddonListCommand() *cobra.Command

NewAddonListCommand create addon list command

func NewAdminInfoCommand

func NewAdminInfoCommand(ioStreams cmdutil.IOStreams) *cobra.Command

NewAdminInfoCommand creates `system info` command

func NewAppStatusCommand

func NewAppStatusCommand(c common.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewAppStatusCommand creates `status` command for showing status

func NewCUEPackageCommand added in v1.0.2

func NewCUEPackageCommand(c common.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewCUEPackageCommand creates `cue-package` command

func NewCapCenterConfigCommand

func NewCapCenterConfigCommand(ioStreams cmdutil.IOStreams) *cobra.Command

NewCapCenterConfigCommand Configure (add if not exist) a capability center, default is local (built-in capabilities)

func NewCapCenterListCommand

func NewCapCenterListCommand(ioStreams cmdutil.IOStreams) *cobra.Command

NewCapCenterListCommand List all capability centers

func NewCapCenterRemoveCommand

func NewCapCenterRemoveCommand(ioStreams cmdutil.IOStreams) *cobra.Command

NewCapCenterRemoveCommand Remove specified capability center

func NewCapCenterSyncCommand

func NewCapCenterSyncCommand(ioStreams cmdutil.IOStreams) *cobra.Command

NewCapCenterSyncCommand Sync capabilities from remote center, default to sync all centers

func NewCapInstallCommand

func NewCapInstallCommand(c common2.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewCapInstallCommand Install capability into cluster

func NewCapListCommand

func NewCapListCommand(c common2.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewCapListCommand List capabilities from cap-center

func NewCapUninstallCommand

func NewCapUninstallCommand(c common2.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewCapUninstallCommand Uninstall capability from cluster

func NewCapabilityShowCommand

func NewCapabilityShowCommand(c common.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewCapabilityShowCommand shows the reference doc for a workload type or trait

func NewCenterCommand

func NewCenterCommand(ioStream cmdutil.IOStreams) *cobra.Command

NewCenterCommand Manage Capability Center

func NewClusterDetachCommand added in v1.1.1

func NewClusterDetachCommand(c *common.Args) *cobra.Command

NewClusterDetachCommand create command to help user detach existing cluster

func NewClusterJoinCommand added in v1.1.1

func NewClusterJoinCommand(c *common.Args) *cobra.Command

NewClusterJoinCommand create command to help user join cluster to multicluster management

func NewClusterListCommand added in v1.1.1

func NewClusterListCommand(c *common.Args) *cobra.Command

NewClusterListCommand create cluster list command

func NewClusterRenameCommand added in v1.1.1

func NewClusterRenameCommand(c *common.Args) *cobra.Command

NewClusterRenameCommand create command to help user rename cluster

func NewCommand

func NewCommand() *cobra.Command

NewCommand will contain all commands

func NewCompletionCommand

func NewCompletionCommand() *cobra.Command

NewCompletionCommand Output shell completion code for the specified shell (bash or zsh)

func NewComponentsCommand

func NewComponentsCommand(c common2.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewComponentsCommand creates `components` command

func NewConfigCommand

func NewConfigCommand(io cmdutil.IOStreams) *cobra.Command

NewConfigCommand will create command for config management for AppFile

func NewConfigDeleteCommand

func NewConfigDeleteCommand(io cmdutil.IOStreams) *cobra.Command

NewConfigDeleteCommand delete a config from local

func NewConfigGetCommand

func NewConfigGetCommand(io cmdutil.IOStreams) *cobra.Command

NewConfigGetCommand get config from local

func NewConfigListCommand

func NewConfigListCommand(io cmdutil.IOStreams) *cobra.Command

NewConfigListCommand list all created configs

func NewConfigSetCommand

func NewConfigSetCommand(io cmdutil.IOStreams) *cobra.Command

NewConfigSetCommand set a config data in local

func NewDashboardCommand

func NewDashboardCommand(c common.Args, ioStreams cmdutil.IOStreams, frontendSource string) *cobra.Command

NewDashboardCommand creates `dashboard` command and its nested children commands

func NewDefinitionApplyCommand added in v1.1.0

func NewDefinitionApplyCommand(c common.Args) *cobra.Command

NewDefinitionApplyCommand create the `vela def apply` command to help user apply local definitions to k8s

func NewDefinitionDelCommand added in v1.1.0

func NewDefinitionDelCommand(c common.Args) *cobra.Command

NewDefinitionDelCommand create the `vela def del` command to help user delete existing definitions conveniently

func NewDefinitionEditCommand added in v1.1.0

func NewDefinitionEditCommand(c common.Args) *cobra.Command

NewDefinitionEditCommand create the `vela def edit` command to help user edit remote definitions

func NewDefinitionGetCommand added in v1.1.0

func NewDefinitionGetCommand(c common.Args) *cobra.Command

NewDefinitionGetCommand create the `vela def get` command to get definition from k8s

func NewDefinitionInitCommand added in v1.1.0

func NewDefinitionInitCommand(c common.Args) *cobra.Command

NewDefinitionInitCommand create the `vela def init` command to help user initialize a definition locally

func NewDefinitionListCommand added in v1.1.0

func NewDefinitionListCommand(c common.Args) *cobra.Command

NewDefinitionListCommand create the `vela def list` command to list definition from k8s

func NewDefinitionRenderCommand added in v1.1.0

func NewDefinitionRenderCommand(c common.Args) *cobra.Command

NewDefinitionRenderCommand create the `vela def render` command to help user render definition cue file into k8s YAML file, if used without kubernetes environment, set IGNORE_KUBE_CONFIG=true

func NewDefinitionValidateCommand added in v1.1.0

func NewDefinitionValidateCommand(c common.Args) *cobra.Command

NewDefinitionValidateCommand create the `vela def vet` command to help user validate the definition

func NewDeleteCommand

func NewDeleteCommand(c common2.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewDeleteCommand Delete App

func NewDryRunCommand

func NewDryRunCommand(c common.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewDryRunCommand creates `dry-run` command

func NewEnvCommand

func NewEnvCommand(c common.Args, ioStream cmdutil.IOStreams) *cobra.Command

NewEnvCommand creates `env` command and its nested children

func NewEnvDeleteCommand

func NewEnvDeleteCommand(ioStreams cmdutil.IOStreams) *cobra.Command

NewEnvDeleteCommand creates `env delete` command for deleting environments

func NewEnvInitCommand

func NewEnvInitCommand(c common.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewEnvInitCommand creates `env init` command for initializing environments

func NewEnvListCommand

func NewEnvListCommand(ioStream cmdutil.IOStreams) *cobra.Command

NewEnvListCommand creates `env list` command for listing all environments

func NewEnvSetCommand

func NewEnvSetCommand(ioStreams cmdutil.IOStreams) *cobra.Command

NewEnvSetCommand creates `env set` command for setting current environment

func NewExecCommand

func NewExecCommand(c common.Args, ioStreams util.IOStreams) *cobra.Command

NewExecCommand creates `exec` command

func NewExportCommand

func NewExportCommand(c common2.Args, ioStream cmdutil.IOStreams) *cobra.Command

NewExportCommand will create command for exporting deploy manifests from an AppFile

func NewHelpCommand

func NewHelpCommand() *cobra.Command

NewHelpCommand get any command help

func NewInitCommand

func NewInitCommand(c common2.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewInitCommand creates `init` command

func NewListCommand

func NewListCommand(c common.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewListCommand creates `ls` command and its nested children command

func NewLiveDiffCommand added in v1.0.3

func NewLiveDiffCommand(c common.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewLiveDiffCommand creates `live-diff` command

func NewLogsCommand

func NewLogsCommand(c common.Args, ioStreams util.IOStreams) *cobra.Command

NewLogsCommand creates `logs` command to tail logs of application

func NewPortForwardCommand

func NewPortForwardCommand(c common.Args, ioStreams util.IOStreams) *cobra.Command

NewPortForwardCommand is vela port-forward command

func NewSystemCUEPackageCommand added in v1.1.1

func NewSystemCUEPackageCommand(_ common.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewSystemCUEPackageCommand is deprecated

func NewSystemDryRunCommand added in v1.1.1

func NewSystemDryRunCommand(_ common.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewSystemDryRunCommand is deprecated

func NewSystemLiveDiffCommand added in v1.1.1

func NewSystemLiveDiffCommand(_ common.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewSystemLiveDiffCommand is deprecated

func NewTemplateCommand

func NewTemplateCommand(ioStream cmdutil.IOStreams) *cobra.Command

NewTemplateCommand creates `template` command and its nested children command

func NewTemplateContextCommand

func NewTemplateContextCommand(ioStream cmdutil.IOStreams) *cobra.Command

NewTemplateContextCommand creates `context` command

func NewTraitsCommand

func NewTraitsCommand(c common2.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewTraitsCommand creates `traits` command

func NewUpCommand

func NewUpCommand(c common2.Args, ioStream cmdutil.IOStreams) *cobra.Command

NewUpCommand will create command for applying an AppFile

func NewVersionCommand

func NewVersionCommand() *cobra.Command

NewVersionCommand print client version

func NewWorkflowCommand added in v1.1.0

func NewWorkflowCommand(c common.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewWorkflowCommand create `workflow` command

func NewWorkflowRestartCommand added in v1.1.0

func NewWorkflowRestartCommand(c common.Args, ioStream cmdutil.IOStreams) *cobra.Command

NewWorkflowRestartCommand create workflow restart command

func NewWorkflowResumeCommand added in v1.1.0

func NewWorkflowResumeCommand(c common.Args, ioStream cmdutil.IOStreams) *cobra.Command

NewWorkflowResumeCommand create workflow resume command

func NewWorkflowSuspendCommand added in v1.1.0

func NewWorkflowSuspendCommand(c common.Args, ioStream cmdutil.IOStreams) *cobra.Command

NewWorkflowSuspendCommand create workflow suspend command

func NewWorkflowTerminateCommand added in v1.1.0

func NewWorkflowTerminateCommand(c common.Args, ioStream cmdutil.IOStreams) *cobra.Command

NewWorkflowTerminateCommand create workflow terminate command

func NewWorkloadsCommand

func NewWorkloadsCommand(c common2.Args, ioStreams cmdutil.IOStreams) *cobra.Command

NewWorkloadsCommand creates `workloads` command

func OpenBrowser

func OpenBrowser(url string) error

OpenBrowser will open browser by url in different OS system nolint:gosec

func PrintComponentListFromRegistry added in v1.1.0

func PrintComponentListFromRegistry(isDiscover bool, url string, ioStreams cmdutil.IOStreams) error

PrintComponentListFromRegistry print a table which shows all components from registry

func PrintHelpByTag

func PrintHelpByTag(cmd *cobra.Command, all []*cobra.Command, tag string)

PrintHelpByTag print custom defined help message

func PrintTrackVelaRuntimeStatus

func PrintTrackVelaRuntimeStatus(ctx context.Context, c client.Client, ioStreams cmdutil.IOStreams, trackTimeout time.Duration) (bool, error)

PrintTrackVelaRuntimeStatus prints status of installing vela-core runtime

func PrintTraitListFromRegistry added in v1.1.0

func PrintTraitListFromRegistry(isDiscover bool, url string, ioStreams cmdutil.IOStreams) error

PrintTraitListFromRegistry print a table which shows all traits from registry

func ReadObjectsFromFile

func ReadObjectsFromFile(path string) ([]oam.Object, error)

ReadObjectsFromFile will read objects from file or dir in the format of yaml

func RunHelp

func RunHelp(cmd *cobra.Command, args []string)

RunHelp exec help [command]

func SetEnv

func SetEnv(args []string, ioStreams cmdutil.IOStreams) error

SetEnv sets current environment

func SetupAPIServer

func SetupAPIServer(c common.Args, cmd *cobra.Command, o Options) error

SetupAPIServer starts a RESTfulAPI server

func ShowReferenceConsole added in v1.0.3

func ShowReferenceConsole(ctx context.Context, c common.Args, ioStreams cmdutil.IOStreams, capabilityName string, ns string) error

ShowReferenceConsole will show capability reference in console

func SystemCommandGroup

func SystemCommandGroup(c common.Args, ioStream cmdutil.IOStreams) *cobra.Command

SystemCommandGroup creates `system` command and its nested children command

func TransAddonName added in v1.1.1

func TransAddonName(name string) string

TransAddonName will turn addon's name from xxx/yyy to xxx-yyy

Types

type Addon added in v1.1.0

type Addon struct {

	// Args is map for renderInitializer
	Args map[string]string
	// contains filtered or unexported fields
}

Addon consist of a Initializer resource to enable an addon

type AddonRepo added in v1.1.0

type AddonRepo interface {
	// contains filtered or unexported methods
}

AddonRepo is a place to store addon info

func NewAddonRepo added in v1.1.0

func NewAddonRepo() (AddonRepo, error)

NewAddonRepo create new addon repo,now only support ConfigMap

type Args

type Args struct {
	Output string
	Env    *types.EnvMeta
	C      common.Args
	App    *v1beta1.Application
}

Args creates arguments for `logs` command

func (*Args) Run

func (l *Args) Run(ctx context.Context, ioStreams util.IOStreams) error

Run refer to the implementation at https://github.com/oam-dev/stern/blob/master/stern/main.go

type CompStatus

type CompStatus int

CompStatus represents the status of a component during "vela init"

func TrackDeployStatus

func TrackDeployStatus(c common.Args, appName string, env *types.EnvMeta) (CompStatus, string, error)

TrackDeployStatus will only check AppConfig is deployed successfully,

type DryRunCmdOptions added in v1.0.3

type DryRunCmdOptions struct {
	cmdutil.IOStreams
	ApplicationFile string
	DefinitionFile  string
}

DryRunCmdOptions contains dry-run cmd options

type HealthStatus

type HealthStatus = v1alpha2.HealthStatus

HealthStatus represents health status strings.

const (
	// HealthStatusNotDiagnosed means there's no health scope referred or unknown health status returned
	HealthStatusNotDiagnosed HealthStatus = "NOT DIAGNOSED"
)

type LiveDiffCmdOptions added in v1.0.3

type LiveDiffCmdOptions struct {
	DryRunCmdOptions
	Revision string
	Context  int
}

LiveDiffCmdOptions contains the live-diff cmd options

type Options

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

Options creates options for `dashboard` command

func (*Options) GetStaticPath

func (o *Options) GetStaticPath() error

GetStaticPath gets the path of front-end directory

type ScopeHealthCondition

type ScopeHealthCondition = v1alpha2.ScopeHealthCondition

ScopeHealthCondition holds health condition of a scope

type VelaExecOptions

type VelaExecOptions struct {
	Cmd         *cobra.Command
	Args        []string
	Stdin       bool
	TTY         bool
	ServiceName string

	context.Context
	VelaC common.Args
	Env   *types.EnvMeta
	App   *v1beta1.Application

	ClientSet kubernetes.Interface
	// contains filtered or unexported fields
}

VelaExecOptions creates options for `exec` command

func (*VelaExecOptions) Complete

func (o *VelaExecOptions) Complete() error

Complete loads data from the command environment

func (*VelaExecOptions) Init

func (o *VelaExecOptions) Init(ctx context.Context, c *cobra.Command, argsIn []string) error

Init prepares the arguments accepted by the Exec command

func (*VelaExecOptions) Run

func (o *VelaExecOptions) Run() error

Run executes a validated remote execution against a pod

type VelaPortForwardOptions

type VelaPortForwardOptions struct {
	Cmd  *cobra.Command
	Args []string

	context.Context
	VelaC common.Args
	Env   *types.EnvMeta
	App   *v1beta1.Application

	ClientSet kubernetes.Interface
	Client    client.Client
	// contains filtered or unexported fields
}

VelaPortForwardOptions for vela port-forward

func (*VelaPortForwardOptions) Complete

func (o *VelaPortForwardOptions) Complete() error

Complete will complete the config of port-forward

func (*VelaPortForwardOptions) Init

func (o *VelaPortForwardOptions) Init(ctx context.Context, cmd *cobra.Command, argsIn []string) error

Init will initialize

func (*VelaPortForwardOptions) Run

func (o *VelaPortForwardOptions) Run() error

Run will execute port-forward

type VelaRuntimeStatus

type VelaRuntimeStatus int

VelaRuntimeStatus enums vela-core runtime status

const (
	NotFound VelaRuntimeStatus = iota
	Pending
	Ready
	Error
)

Enums of VelaRuntimeStatus

type WorkloadHealthCondition

type WorkloadHealthCondition = v1alpha2.WorkloadHealthCondition

WorkloadHealthCondition holds health status of any resource

Jump to

Keyboard shortcuts

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