Documentation ¶
Index ¶
- Constants
- func ApplyApplication(app corev1beta1.Application, ioStream cmdutil.IOStreams, clt client.Client) error
- func BaseComplete(namespace string, c common.Args, workloadName string, appName string, ...) (*api.Application, error)
- func CheckLabelExistence(labels map[string]string, label string) bool
- func CollectApplicationResource(ctx context.Context, c client.Client, opt query.Option) ([]unstructured.Unstructured, error)
- func GetPodMetrics(conf *rest.Config, podName, namespace, cluster string) (*v1beta1.PodMetrics, error)
- func GetPodOfManagedResource(c client.Client, app *appv1beta1.Application, components string) []*v1.Pod
- func GetPodResourceSpecAndUsage(c client.Client, pod *v1.Pod, metrics *v1beta1.PodMetrics) (MetricsLR, MetricsUsage)
- func GetPodStorage(client client.Client, pod *v1.Pod) (storages []v1.PersistentVolumeClaim)
- func Info(app *corev1beta1.Application) string
- func InitApplication(namespace string, c common.Args, workloadName string, appGroup string) (*api.Application, error)
- func InstallComponentDefinition(client client.Client, componentData []byte, ioStreams cmdutil.IOStreams) error
- func InstallTraitDefinition(client client.Client, traitdata []byte, ioStreams cmdutil.IOStreams) error
- func IsAppfile(body []byte) bool
- func ListApplicationResource(c client.Client, name, namespace string) ([]query.Resource, error)
- func ListRawWorkloadDefinitions(userNamespace string, c common.Args) ([]v1beta1.WorkloadDefinition, error)
- func LoadAppFile(pathOrURL string) (*api.AppFile, error)
- func PrepareToForceDeleteTerraformComponents(ctx context.Context, k8sClient client.Client, namespace, name string) error
- func ToPercentage(v1, v2 int64) int
- func ToPercentageStr(v1, v2 int64) string
- type AppfileOptions
- func (o *AppfileOptions) ApplyApp(app *corev1beta1.Application, scopes []oam.Object) error
- func (o *AppfileOptions) BaseAppFileRun(result *BuildResult, args common.Args) error
- func (o *AppfileOptions) Export(filePath, namespace string, quiet bool, c common.Args) (*BuildResult, []byte, error)
- func (o *AppfileOptions) ExportFromAppFile(app *api.AppFile, namespace string, quiet bool, c common.Args) (*BuildResult, []byte, error)
- func (o *AppfileOptions) Run(filePath, namespace string, c common.Args) error
- type ApplicationMetrics
- type ApplicationMetricsStatus
- type ApplicationResourceNum
- type BuildResult
- type MetricsLR
- type MetricsUsage
- type PodMetricStatus
Constants ¶
const (
// MetricsNA is the value of metrics when it is not available
MetricsNA = "N/A"
)
Variables ¶
This section is empty.
Functions ¶
func ApplyApplication ¶ added in v1.1.0
func ApplyApplication(app corev1beta1.Application, ioStream cmdutil.IOStreams, clt client.Client) error
ApplyApplication will apply an application file in K8s GVK format
func BaseComplete ¶
func BaseComplete(namespace string, c common.Args, workloadName string, appName string, flagSet *pflag.FlagSet, workloadType string) (*api.Application, error)
BaseComplete will construct an Application from cli parameters.
func CheckLabelExistence ¶ added in v1.1.1
CheckLabelExistence checks whether a label `key=value` exists in definition labels
func CollectApplicationResource ¶ added in v1.8.0
func CollectApplicationResource(ctx context.Context, c client.Client, opt query.Option) ([]unstructured.Unstructured, error)
CollectApplicationResource collects all resources of an application
func GetPodMetrics ¶ added in v1.8.0
func GetPodMetrics(conf *rest.Config, podName, namespace, cluster string) (*v1beta1.PodMetrics, error)
GetPodMetrics get pod metrics object
func GetPodOfManagedResource ¶ added in v1.8.0
func GetPodOfManagedResource(c client.Client, app *appv1beta1.Application, components string) []*v1.Pod
GetPodOfManagedResource get pod of managed resource
func GetPodResourceSpecAndUsage ¶ added in v1.8.0
func GetPodResourceSpecAndUsage(c client.Client, pod *v1.Pod, metrics *v1beta1.PodMetrics) (MetricsLR, MetricsUsage)
GetPodResourceSpecAndUsage return the usage metrics of a pod and specified metric including requests and limits metrics
func GetPodStorage ¶ added in v1.8.0
GetPodStorage get pod storage
func Info ¶ added in v1.2.0
func Info(app *corev1beta1.Application) string
Info shows the status of each service in the Appfile
func InitApplication ¶
func InitApplication(namespace string, c common.Args, workloadName string, appGroup string) (*api.Application, error)
InitApplication will load Application from cluster
func InstallComponentDefinition ¶ added in v1.1.0
func InstallComponentDefinition(client client.Client, componentData []byte, ioStreams cmdutil.IOStreams) error
InstallComponentDefinition will add a component into K8s cluster and install its controller
func InstallTraitDefinition ¶ added in v1.1.0
func InstallTraitDefinition(client client.Client, traitdata []byte, ioStreams cmdutil.IOStreams) error
InstallTraitDefinition will add a trait into K8s cluster and install it's controller
func IsAppfile ¶ added in v1.2.0
IsAppfile check if a file is Appfile format or application format, return true if it's appfile, false means application object
func ListApplicationResource ¶ added in v1.8.0
ListApplicationResource list application resource
func ListRawWorkloadDefinitions ¶
func ListRawWorkloadDefinitions(userNamespace string, c common.Args) ([]v1beta1.WorkloadDefinition, error)
ListRawWorkloadDefinitions will list raw definition
func LoadAppFile ¶ added in v1.2.0
LoadAppFile will load vela appfile from remote URL or local file system.
func PrepareToForceDeleteTerraformComponents ¶ added in v1.7.0
func PrepareToForceDeleteTerraformComponents(ctx context.Context, k8sClient client.Client, namespace, name string) error
PrepareToForceDeleteTerraformComponents sets Terraform typed Component to force-delete mode
func ToPercentage ¶ added in v1.8.0
ToPercentage computes percentage as string otherwise n/aa.
func ToPercentageStr ¶ added in v1.8.0
ToPercentageStr computes percentage, but if v2 is 0, it will return NAValue instead of 0.
Types ¶
type AppfileOptions ¶
type AppfileOptions struct { Kubecli client.Client IO cmdutil.IOStreams Namespace string Name string }
AppfileOptions is some configuration that modify options for an Appfile
func (*AppfileOptions) ApplyApp ¶
func (o *AppfileOptions) ApplyApp(app *corev1beta1.Application, scopes []oam.Object) error
ApplyApp applys config resources for the app. It differs by create and update:
- for create, it displays app status along with information of url, metrics, ssh, logging.
- for update, it rolls out a canary deployment and prints its information. User can verify the canary deployment. This will wait for user approval. If approved, it continues upgrading the whole; otherwise, it would rollback.
func (*AppfileOptions) BaseAppFileRun ¶
func (o *AppfileOptions) BaseAppFileRun(result *BuildResult, args common.Args) error
BaseAppFileRun starts an application according to Appfile
func (*AppfileOptions) Export ¶
func (o *AppfileOptions) Export(filePath, namespace string, quiet bool, c common.Args) (*BuildResult, []byte, error)
Export export Application object from the path of Appfile
func (*AppfileOptions) ExportFromAppFile ¶
func (o *AppfileOptions) ExportFromAppFile(app *api.AppFile, namespace string, quiet bool, c common.Args) (*BuildResult, []byte, error)
ExportFromAppFile exports Application from appfile object
type ApplicationMetrics ¶ added in v1.8.0
type ApplicationMetrics struct { Metrics *ApplicationMetricsStatus ResourceNum *ApplicationResourceNum }
ApplicationMetrics is the metrics of application
func GetApplicationMetrics ¶ added in v1.8.0
func GetApplicationMetrics(c client.Client, conf *rest.Config, app *appv1beta1.Application) (*ApplicationMetrics, error)
GetApplicationMetrics get application metrics
type ApplicationMetricsStatus ¶ added in v1.8.0
type ApplicationMetricsStatus struct { CPUUsage int64 CPURequest int64 CPULimit int64 MemoryUsage int64 MemoryRequest int64 MemoryLimit int64 Storage int64 }
ApplicationMetricsStatus is the status of application metrics
type ApplicationResourceNum ¶ added in v1.8.0
ApplicationResourceNum is the resource number of application
type BuildResult ¶
type BuildResult struct {
// contains filtered or unexported fields
}
BuildResult is the export struct from AppFile yaml or AppFile object
type MetricsUsage ¶ added in v1.8.0
type MetricsUsage struct {
CPU, Mem, Storage int64
}
MetricsUsage is the metric of resource usage
type PodMetricStatus ¶ added in v1.8.0
type PodMetricStatus struct { Spec MetricsLR Usage MetricsUsage }
PodMetricStatus is the status of pod metrics