Documentation ¶
Index ¶
- Constants
- Variables
- func AddCapabilityCenter(capName, capURL, capToken string) error
- func AddCapabilityIntoCluster(c client.Client, mapper discoverymapper.DiscoveryMapper, capability string) (string, error)
- 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 BuildRun(ctx context.Context, app *api.Application, client client.Client, ...) error
- func CheckLabelExistence(labels map[string]string, label string) bool
- func ConvertApplyTo(applyTo []string, workloads []types.Capability) []string
- func GetCapabilityConfigMap(kubeClient client.Client, capabilityName string) (corev1.ConfigMap, error)
- func GetCapabilityFromCenter(mapper discoverymapper.DiscoveryMapper, repoName, addonName string) (types.Capability, error)
- func GetDefinitionDefaultSpec(kind string) map[string]interface{}
- func GetServicesWhenDescribingApplication(cmd *cobra.Command, app *api.Application) ([]string, error)
- func GetTraitDefinition(userNamespace string, c common.Args, workloadName *string, traitType string) (types.Capability, error)
- func HackForStandardTrait(tp types.Capability, client client.Client) error
- func InitApplication(namespace string, c common.Args, workloadName string, appGroup string) (*api.Application, error)
- func InstallCapability(client client.Client, mapper discoverymapper.DiscoveryMapper, ...) error
- func InstallComponentDefinition(client client.Client, workloadData []byte, ioStreams cmdutil.IOStreams, ...) error
- func InstallPrometheusInstance(kubecli client.Client) error
- func InstallTraitDefinition(client client.Client, mapper discoverymapper.DiscoveryMapper, traitdata []byte, ...) error
- func ListApplicationConfigurations(ctx context.Context, c client.Reader, opt Option) (corev1alpha2.ApplicationConfigurationList, error)
- func ListApplications(ctx context.Context, c client.Reader, opt Option) ([]apis.ApplicationMeta, error)
- func ListCapabilities(userNamespace string, c common.Args, capabilityCenterName string) ([]types.Capability, error)
- func ListCapabilityCenters() ([]apis.CapabilityCenterMeta, error)
- func ListComponents(ctx context.Context, c client.Reader, opt Option) ([]apis.ComponentMeta, error)
- func ListRawComponentDefinitions(userNamespace string, c common.Args) ([]v1beta1.ComponentDefinition, error)
- func ListRawTraitDefinitions(userNamespace string, c common.Args) ([]v1beta1.TraitDefinition, error)
- func ListRawWorkloadDefinitions(userNamespace string, c common.Args) ([]v1beta1.WorkloadDefinition, error)
- func ListTraitDefinitions(userNamespace string, c common.Args, workloadName *string) ([]types.Capability, error)
- func Parse(applyTo string) string
- func RemoveCapability(userNamespace string, c common.Args, client client.Client, ...) error
- func RemoveCapabilityCenter(centerName string) (string, error)
- func RemoveCapabilityFromCluster(userNamespace string, c common.Args, client client.Client, ...) (string, error)
- func RetrieveApplicationStatusByName(ctx context.Context, c client.Reader, applicationName string, namespace string) (apis.ApplicationMeta, error)
- func RetrieveComponent(ctx context.Context, c client.Reader, ...) (apis.ComponentMeta, error)
- func SearchDefinition(definitionName string, c client.Client, definitionType string, ...) ([]unstructured.Unstructured, error)
- func SyncCapabilityCenter(capabilityCenterName string) error
- func SyncCapabilityFromCenter(capName, capURL, capToken string) error
- func ValidDefinitionTypes() []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) Info(app *corev1beta1.Application) string
- func (o *AppfileOptions) Run(filePath, namespace string, c common.Args) error
- type BuildResult
- type Definition
- func (def *Definition) FromCUE(val *cue.Value, templateString string) error
- func (def *Definition) FromCUEString(cueString string, config *rest.Config) error
- func (def *Definition) GetType() string
- func (def *Definition) SetGVK(kind string)
- func (def *Definition) SetType(t string) error
- func (def *Definition) ToCUE() (*cue.Value, string, error)
- func (def *Definition) ToCUEString() (string, error)
- type DeleteOptions
- type Option
Constants ¶
const ( DefaultChosenAllSvc = "ALL SERVICES" FlagNotSet = "FlagNotSet" FlagIsInvalid = "FlagIsInvalid" FlagIsValid = "FlagIsValid" )
nolint:golint
const ( // DefinitionDescriptionKey the key for accessing definition description DefinitionDescriptionKey = "definition.oam.dev/description" // DefinitionUserPrefix defines the prefix of user customized label or annotation DefinitionUserPrefix = "custom.definition.oam.dev/" )
Variables ¶
var ( // DefinitionTemplateKeys the keys for accessing definition template DefinitionTemplateKeys = []string{"spec", "schematic", "cue", "template"} // DefinitionTypeToKind maps the definition types to corresponding kinds DefinitionTypeToKind = map[string]string{ "component": v1beta1.ComponentDefinitionKind, "trait": v1beta1.TraitDefinitionKind, "policy": v1beta1.PolicyDefinitionKind, "workload": v1beta1.WorkloadDefinitionKind, "scope": v1beta1.ScopeDefinitionKind, "workflow-step": v1beta1.WorkflowStepDefinitionKind, } )
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 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 BuildRun ¶
func BuildRun(ctx context.Context, app *api.Application, client client.Client, namespace string, io util.IOStreams) error
BuildRun will build application and deploy from Appfile
func CheckLabelExistence ¶ added in v1.1.1
CheckLabelExistence checks whether a label `key=value` exists in definition labels
func ConvertApplyTo ¶
func ConvertApplyTo(applyTo []string, workloads []types.Capability) []string
ConvertApplyTo will convert applyTo slice to workload capability name if CRD matches
func GetCapabilityConfigMap ¶
func GetCapabilityConfigMap(kubeClient client.Client, capabilityName string) (corev1.ConfigMap, error)
GetCapabilityConfigMap gets the ConfigMap which stores the information of a capability
func GetCapabilityFromCenter ¶
func GetCapabilityFromCenter(mapper discoverymapper.DiscoveryMapper, repoName, addonName string) (types.Capability, error)
GetCapabilityFromCenter will list all synced capabilities from cap center and return the specified one
func GetDefinitionDefaultSpec ¶ added in v1.1.0
GetDefinitionDefaultSpec returns the default spec of Definition with given kind. This may be implemented with cue in the future.
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(userNamespace string, c common.Args, workloadName *string, traitType string) (types.Capability, error)
GetTraitDefinition will get trait capability with applyTo converted
func HackForStandardTrait ¶
func HackForStandardTrait(tp types.Capability, client client.Client) error
HackForStandardTrait will do some hack install for standard capability
func InitApplication ¶
func InitApplication(namespace string, c common.Args, workloadName string, appGroup string) (*api.Application, error)
InitApplication will load Application from cluster
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 InstallComponentDefinition ¶ added in v1.1.0
func InstallComponentDefinition(client client.Client, workloadData []byte, ioStreams cmdutil.IOStreams, tp *types.Capability) error
InstallComponentDefinition will add a component into K8s cluster and install it's controller
func InstallPrometheusInstance ¶
InstallPrometheusInstance will install prometheus instance when the Capability is 'metrics'
func InstallTraitDefinition ¶ added in v1.1.0
func InstallTraitDefinition(client client.Client, mapper discoverymapper.DiscoveryMapper, traitdata []byte, ioStreams cmdutil.IOStreams, cap *types.Capability) error
InstallTraitDefinition will add a trait into K8s cluster and install it's controller
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.Reader, opt Option) ([]apis.ApplicationMeta, error)
ListApplications lists all applications
func ListCapabilities ¶
func ListCapabilities(userNamespace string, c common.Args, 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 ListRawComponentDefinitions ¶
func ListRawComponentDefinitions(userNamespace string, c common.Args) ([]v1beta1.ComponentDefinition, error)
ListRawComponentDefinitions will list raw component definition
func ListRawTraitDefinitions ¶
func ListRawTraitDefinitions(userNamespace string, c common.Args) ([]v1beta1.TraitDefinition, error)
ListRawTraitDefinitions will list raw definition
func ListRawWorkloadDefinitions ¶
func ListRawWorkloadDefinitions(userNamespace string, c common.Args) ([]v1beta1.WorkloadDefinition, error)
ListRawWorkloadDefinitions will list raw definition
func ListTraitDefinitions ¶
func ListTraitDefinitions(userNamespace string, c common.Args, workloadName *string) ([]types.Capability, error)
ListTraitDefinitions will list all definition include traits and workloads
func Parse ¶
Parse will parse applyTo(with format Group/Version.Kind) to crd name by just calculate the plural of kind word. TODO we should use discoverymapper instead of calculate plural
func RemoveCapability ¶
func RemoveCapability(userNamespace string, c common.Args, 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 ¶
func RemoveCapabilityFromCluster(userNamespace string, c common.Args, client client.Client, capabilityName string) (string, error)
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.Reader, applicationName string, namespace string) (apis.ApplicationMeta, error)
RetrieveApplicationStatusByName will get app status
func RetrieveComponent ¶
func RetrieveComponent(ctx context.Context, c client.Reader, applicationName, componentName, namespace string) (apis.ComponentMeta, error)
RetrieveComponent will get component status
func SearchDefinition ¶ added in v1.1.0
func SearchDefinition(definitionName string, c client.Client, definitionType string, namespace string) ([]unstructured.Unstructured, error)
SearchDefinition search the Definition in k8s by traversing all possible results across types or namespaces
func SyncCapabilityCenter ¶
SyncCapabilityCenter will sync capabilities from center to local
func SyncCapabilityFromCenter ¶
SyncCapabilityFromCenter will sync all capabilities from center
func ValidDefinitionTypes ¶ added in v1.1.0
func ValidDefinitionTypes() []string
ValidDefinitionTypes return the list of valid definition types
Types ¶
type AppfileOptions ¶
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
func (*AppfileOptions) Info ¶
func (o *AppfileOptions) Info(app *corev1beta1.Application) string
Info shows the status of each service in the Appfile
type BuildResult ¶
type BuildResult struct {
// contains filtered or unexported fields
}
BuildResult is the export struct from AppFile yaml or AppFile object
type Definition ¶ added in v1.1.0
type Definition struct {
unstructured.Unstructured
}
Definition the general struct for handling all kinds of definitions like ComponentDefinition or TraitDefinition
func (*Definition) FromCUE ¶ added in v1.1.0
func (def *Definition) FromCUE(val *cue.Value, templateString string) error
FromCUE converts CUE value (predefined Definition's cue format) to Definition nolint:gocyclo
func (*Definition) FromCUEString ¶ added in v1.1.0
func (def *Definition) FromCUEString(cueString string, config *rest.Config) error
FromCUEString converts cue string into Definition
func (*Definition) GetType ¶ added in v1.1.0
func (def *Definition) GetType() string
GetType gets the type of Definition
func (*Definition) SetGVK ¶ added in v1.1.0
func (def *Definition) SetGVK(kind string)
SetGVK set the GroupVersionKind of Definition
func (*Definition) SetType ¶ added in v1.1.0
func (def *Definition) SetType(t string) error
SetType sets the type of Definition
func (*Definition) ToCUE ¶ added in v1.1.0
func (def *Definition) ToCUE() (*cue.Value, string, error)
ToCUE converts Definition to CUE value (with predefined Definition's cue format)
func (*Definition) ToCUEString ¶ added in v1.1.0
func (def *Definition) ToCUEString() (string, error)
ToCUEString converts definition to CUE value and then encode to string
type DeleteOptions ¶
type DeleteOptions struct { Namespace string AppName string CompName string Client client.Client C common.Args }
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.