Documentation ¶
Index ¶
- Constants
- func AddCapabilityCenter(capName, capURL, capToken string) error
- func AddCapabilityIntoCluster(c client.Client, mapper discoverymapper.DiscoveryMapper, capability string) (string, error)
- func AddOrUpdateTrait(env *types.EnvMeta, appName string, componentName string, ...) (*api.Application, error)
- func BaseComplete(envName string, workloadName string, appName string, flagSet *pflag.FlagSet, ...) (*api.Application, error)
- func BaseRun(staging bool, app *api.Application, kubeClient client.Client, ...) (string, error)
- func ConvertApplyTo(applyTo []string, workloads []types.Capability) []string
- func GetCapabilityFromCenter(repoName, addonName string) (types.Capability, error)
- func GetDefinition(name string) ([]byte, error)
- func GetServicesWhenDescribingApplication(cmd *cobra.Command, app *api.Application) ([]string, error)
- func GetTraitDefinition(workloadName *string, traitType string) (types.Capability, error)
- func HackForStandardTrait(tp types.Capability, client client.Client) error
- func InstallCapability(client client.Client, mapper discoverymapper.DiscoveryMapper, ...) error
- func InstallPrometheusInstance(kubecli client.Client) error
- func ListApplicationConfigurations(ctx context.Context, c client.Reader, opt Option) (corev1alpha2.ApplicationConfigurationList, error)
- func ListApplications(ctx context.Context, c client.Client, opt Option) ([]apis.ApplicationMeta, error)
- func ListCapabilities(capabilityCenterName string) ([]types.Capability, error)
- func ListCapabilityCenters() ([]apis.CapabilityCenterMeta, error)
- func ListComponents(ctx context.Context, c client.Client, opt Option) ([]apis.ComponentMeta, error)
- func ListTraitDefinitions(workloadName *string) ([]types.Capability, error)
- func LoadIfExist(envName string, workloadName string, appGroup string) (*api.Application, error)
- func Parse(applyTo string) string
- func PrepareDetachTrait(envName string, traitType string, componentName string, appName string) (*api.Application, error)
- func RemoveCapability(client client.Client, capabilityName string, ioStreams cmdutil.IOStreams) error
- func RemoveCapabilityCenter(centerName string) (string, error)
- func RemoveCapabilityFromCluster(client client.Client, capabilityName string) (string, error)
- func RetrieveApplicationStatusByName(ctx context.Context, c client.Client, applicationName string, namespace string) (apis.ApplicationMeta, error)
- func RetrieveComponent(ctx context.Context, c client.Client, ...) (apis.ComponentMeta, error)
- func SyncCapabilityCenter(capabilityCenterName string) error
- func SyncCapabilityFromCenter(capName, capURL, capToken string) error
- func TraitOperationRun(ctx context.Context, c client.Client, env *types.EnvMeta, ...) (string, error)
- func ValidateAndMutateForCore(traitType, workloadName string, flags *pflag.FlagSet, env *types.EnvMeta) error
- type AppfileOptions
- func (o *AppfileOptions) ApplyApp(app *corev1alpha2.Application, scopes []oam.Object) error
- func (o *AppfileOptions) BaseAppFileRun(result *BuildResult, data []byte, dm discoverymapper.DiscoveryMapper) error
- func (o *AppfileOptions) Export(filePath string, quiet bool) (*BuildResult, []byte, error)
- func (o *AppfileOptions) ExportFromAppFile(app *api.AppFile, quiet bool) (*BuildResult, []byte, error)
- func (o *AppfileOptions) Info(app *corev1alpha2.Application) string
- func (o *AppfileOptions) Run(filePath string, config *rest.Config) error
- type BuildResult
- type Components
- type DeleteOptions
- type OpenAPISchema
- type Option
- type RunOptions
- type Schemas
Constants ¶
const ( DefaultChosenAllSvc = "ALL SERVICES" FlagNotSet = "FlagNotSet" FlagIsInvalid = "FlagIsInvalid" FlagIsValid = "FlagIsValid" )
nolint:golint
const ( // OpenAPISchemaDir is the folder name under ~/.vela/capabilities OpenAPISchemaDir = "openapi" // UsageTag is usage comment annotation UsageTag = "+usage=" // ShortTag is the short alias annotation ShortTag = "+short" )
Variables ¶
This section is empty.
Functions ¶
func AddCapabilityCenter ¶
AddCapabilityCenter will add a cap center
func AddCapabilityIntoCluster ¶
func AddCapabilityIntoCluster(c client.Client, mapper discoverymapper.DiscoveryMapper, capability string) (string, error)
AddCapabilityIntoCluster will add a capability into K8s cluster, it is equal to apply a definition yaml and run `vela workloads/traits`
func AddOrUpdateTrait ¶
func AddOrUpdateTrait(env *types.EnvMeta, appName string, componentName string, flagSet *pflag.FlagSet, template types.Capability) (*api.Application, error)
AddOrUpdateTrait attach trait to workload
func BaseComplete ¶
func BaseComplete(envName string, workloadName string, appName string, flagSet *pflag.FlagSet, workloadType string) (*api.Application, error)
BaseComplete will construct an Application from cli parameters.
func BaseRun ¶
func BaseRun(staging bool, app *api.Application, kubeClient client.Client, env *types.EnvMeta, io util.IOStreams) (string, error)
BaseRun will check if it's a stating operation before run
func ConvertApplyTo ¶
func ConvertApplyTo(applyTo []string, workloads []types.Capability) []string
ConvertApplyTo will convert applyTo slice to workload capability name if CRD matches
func GetCapabilityFromCenter ¶
func GetCapabilityFromCenter(repoName, addonName string) (types.Capability, error)
GetCapabilityFromCenter will list all synced capabilities from cap center and return the specified one
func GetDefinition ¶ added in v0.3.0
GetDefinition is the main function for GetDefinition API
func GetServicesWhenDescribingApplication ¶
func GetServicesWhenDescribingApplication(cmd *cobra.Command, app *api.Application) ([]string, error)
GetServicesWhenDescribingApplication gets the target services list either from cli `--svc` flag or from survey
func GetTraitDefinition ¶
func GetTraitDefinition(workloadName *string, traitType string) (types.Capability, error)
GetTraitDefinition will get trait capability with applyTo converted
func HackForStandardTrait ¶ added in v0.3.1
func HackForStandardTrait(tp types.Capability, client client.Client) error
HackForStandardTrait will do some hack install for standard capability
func InstallCapability ¶
func InstallCapability(client client.Client, mapper discoverymapper.DiscoveryMapper, centerName, capabilityName string, ioStreams cmdutil.IOStreams) error
InstallCapability will add a cap into K8s cluster and install it's controller(helm charts)
func InstallPrometheusInstance ¶ added in v0.3.1
InstallPrometheusInstance will install prometheus instance when the Capability is 'metrics'
func ListApplicationConfigurations ¶
func ListApplicationConfigurations(ctx context.Context, c client.Reader, opt Option) (corev1alpha2.ApplicationConfigurationList, error)
ListApplicationConfigurations lists all OAM ApplicationConfiguration
func ListApplications ¶
func ListApplications(ctx context.Context, c client.Client, opt Option) ([]apis.ApplicationMeta, error)
ListApplications lists all applications
func ListCapabilities ¶
func ListCapabilities(capabilityCenterName string) ([]types.Capability, error)
ListCapabilities will list all caps from specified center
func ListCapabilityCenters ¶
func ListCapabilityCenters() ([]apis.CapabilityCenterMeta, error)
ListCapabilityCenters will list all capabilities from center
func ListComponents ¶
ListComponents will list all components for dashboard
func ListTraitDefinitions ¶
func ListTraitDefinitions(workloadName *string) ([]types.Capability, error)
ListTraitDefinitions will list all definition include traits and workloads
func LoadIfExist ¶
LoadIfExist will load Application from local dir
func Parse ¶
Parse will parse applyTo(with format apigroup/Version.Kind) to crd name by just calculate the plural of kind word. TODO we should use discoverymapper instead of calculate plural
func PrepareDetachTrait ¶
func PrepareDetachTrait(envName string, traitType string, componentName string, appName string) (*api.Application, error)
PrepareDetachTrait will detach trait in local AppFile
func RemoveCapability ¶
func RemoveCapability(client client.Client, capabilityName string, ioStreams cmdutil.IOStreams) error
RemoveCapability will remove a capability from cluster. 1. remove definition 2. uninstall chart 3. remove local files
func RemoveCapabilityCenter ¶
RemoveCapabilityCenter will remove a cap center from local
func RemoveCapabilityFromCluster ¶
RemoveCapabilityFromCluster will remove a capability from cluster. 1. remove definition 2. uninstall chart 3. remove local files
func RetrieveApplicationStatusByName ¶
func RetrieveApplicationStatusByName(ctx context.Context, c client.Client, applicationName string, namespace string) (apis.ApplicationMeta, error)
RetrieveApplicationStatusByName will get app status
func RetrieveComponent ¶
func RetrieveComponent(ctx context.Context, c client.Client, applicationName, componentName, namespace string) (apis.ComponentMeta, error)
RetrieveComponent will get component status
func SyncCapabilityCenter ¶
SyncCapabilityCenter will sync capabilities from center to local
func SyncCapabilityFromCenter ¶
SyncCapabilityFromCenter will sync all capabilities from center
Types ¶
type AppfileOptions ¶ added in v0.3.1
AppfileOptions is some configuration that modify options for an Appfile
func (*AppfileOptions) ApplyApp ¶ added in v0.3.1
func (o *AppfileOptions) ApplyApp(app *corev1alpha2.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 ¶ added in v0.3.1
func (o *AppfileOptions) BaseAppFileRun(result *BuildResult, data []byte, dm discoverymapper.DiscoveryMapper) error
BaseAppFileRun starts an application according to Appfile
func (*AppfileOptions) Export ¶ added in v0.3.1
func (o *AppfileOptions) Export(filePath string, quiet bool) (*BuildResult, []byte, error)
Export export Application object from the path of Appfile
func (*AppfileOptions) ExportFromAppFile ¶ added in v0.3.1
func (o *AppfileOptions) ExportFromAppFile(app *api.AppFile, quiet bool) (*BuildResult, []byte, error)
ExportFromAppFile exports Application from appfile object
func (*AppfileOptions) Info ¶ added in v0.3.1
func (o *AppfileOptions) Info(app *corev1alpha2.Application) string
Info shows the status of each service in the Appfile
type BuildResult ¶ added in v0.3.1
type BuildResult struct {
// contains filtered or unexported fields
}
BuildResult is the export struct from AppFile yaml or AppFile object
type Components ¶ added in v0.3.0
type Components struct {
Schemas Schemas `json:"schemas"`
}
Components is the struct filed of OpenAPISchema
type DeleteOptions ¶
type DeleteOptions struct { AppName string CompName string Client client.Client Env *types.EnvMeta }
DeleteOptions is options for delete
func (*DeleteOptions) DeleteApp ¶
func (o *DeleteOptions) DeleteApp() (string, error)
DeleteApp will delete app including server side
func (*DeleteOptions) DeleteComponent ¶
func (o *DeleteOptions) DeleteComponent(io cmdutil.IOStreams) (string, error)
DeleteComponent will delete one component including server side.
type OpenAPISchema ¶ added in v0.3.0
type OpenAPISchema struct { OpenAPI string `json:"openapi"` Components Components `json:"components"` }
OpenAPISchema is the struct for OpenAPI Schema generated by Cue OpenAPI
type Option ¶
type Option struct { // Optional filter, if specified, only components in such app will be listed AppName string Namespace string }
Option is option work with dashboard api server