Documentation ¶
Index ¶
- Constants
- func ConvertTemplateJSON2Object(capabilityName string, in *runtime.RawExtension, schematic *common.Schematic) (types.Capability, error)
- func GenerateCUETemplate(wl *Workload) (string, error)
- func GenerateContextDataFromAppFile(appfile *Appfile, wlName string) velaprocess.ContextData
- func GetScopeDefAndGVK(ctx context.Context, cli client.Reader, dm discoverymapper.DiscoveryMapper, ...) (*v1beta1.ScopeDefinition, metav1.GroupVersionKind, error)
- func GetScopeDefAndGVKFromRevision(name string, appRev *v1beta1.ApplicationRevision) (*v1beta1.ScopeDefinition, metav1.GroupVersionKind, error)
- func NewBasicContext(contextData velaprocess.ContextData, params map[string]interface{}) process.Context
- func PrepareProcessContext(wl *Workload, ctxData velaprocess.ContextData) (process.Context, error)
- type Appfile
- func (af *Appfile) GenerateComponentManifest(wl *Workload, mutate func(*velaprocess.ContextData)) (*types.ComponentManifest, error)
- func (af *Appfile) GenerateComponentManifests() ([]*types.ComponentManifest, error)
- func (af *Appfile) GeneratePolicyManifests(ctx context.Context) ([]*unstructured.Unstructured, error)
- func (af *Appfile) LoadDynamicComponent(ctx context.Context, cli client.Client, comp *common.ApplicationComponent) (*common.ApplicationComponent, error)
- func (af *Appfile) PolicyClient(cli client.Client) client.Client
- func (af *Appfile) SetOAMContract(comp *types.ComponentManifest) error
- func (af *Appfile) WorkflowClient(cli client.Client) client.Client
- type Parser
- func (p *Parser) GenerateAppFile(ctx context.Context, app *v1beta1.Application) (*Appfile, error)
- func (p *Parser) GenerateAppFileFromApp(ctx context.Context, app *v1beta1.Application) (*Appfile, error)
- func (p *Parser) GenerateAppFileFromRevision(appRev *v1beta1.ApplicationRevision) (*Appfile, error)
- func (p *Parser) ParseWorkloadFromRevision(comp common.ApplicationComponent, appRev *v1beta1.ApplicationRevision) (*Workload, error)
- func (p *Parser) ValidateCUESchematicAppfile(a *Appfile) error
- func (p *Parser) ValidateComponentNames(ctx context.Context, af *Appfile) (int, error)
- type Scope
- type Template
- type TemplateLoaderFn
- type Trait
- type Workload
Constants ¶
const ( // WriteConnectionSecretToRefKey is used to create a secret for cloud resource connection WriteConnectionSecretToRefKey = "writeConnectionSecretToRef" // RegionKey is the region of a Cloud Provider // It's used to override the region of a Cloud Provider // Refer to https://github.com/oam-dev/terraform-controller/blob/master/api/v1beta2/configuration_types.go#L66 for details RegionKey = "customRegion" // ProviderRefKey is the reference of a Provider ProviderRefKey = "providerRef" // ForceDeleteKey is used to force delete Configuration ForceDeleteKey = "forceDelete" )
const ( // UsageTag is usage comment annotation UsageTag = "+usage=" // ShortTag is the short alias annotation ShortTag = "+short" )
Variables ¶
This section is empty.
Functions ¶
func ConvertTemplateJSON2Object ¶ added in v1.0.3
func ConvertTemplateJSON2Object(capabilityName string, in *runtime.RawExtension, schematic *common.Schematic) (types.Capability, error)
ConvertTemplateJSON2Object convert spec.extension or spec.schematic to object
func GenerateCUETemplate ¶ added in v1.1.0
GenerateCUETemplate generate CUE Template from Kube module and Helm module
func GenerateContextDataFromAppFile ¶ added in v1.2.5
func GenerateContextDataFromAppFile(appfile *Appfile, wlName string) velaprocess.ContextData
GenerateContextDataFromAppFile generates process context data from app file
func GetScopeDefAndGVK ¶ added in v1.1.1
func GetScopeDefAndGVK(ctx context.Context, cli client.Reader, dm discoverymapper.DiscoveryMapper, name string) (*v1beta1.ScopeDefinition, metav1.GroupVersionKind, error)
GetScopeDefAndGVK get grouped API version of the given scope
func GetScopeDefAndGVKFromRevision ¶ added in v1.1.1
func GetScopeDefAndGVKFromRevision(name string, appRev *v1beta1.ApplicationRevision) (*v1beta1.ScopeDefinition, metav1.GroupVersionKind, error)
GetScopeDefAndGVKFromRevision get grouped API version of the given scope
func NewBasicContext ¶ added in v1.0.5
func NewBasicContext(contextData velaprocess.ContextData, params map[string]interface{}) process.Context
NewBasicContext prepares a basic DSL process Context
func PrepareProcessContext ¶ added in v0.3.1
func PrepareProcessContext(wl *Workload, ctxData velaprocess.ContextData) (process.Context, error)
PrepareProcessContext prepares a DSL process Context
Types ¶
type Appfile ¶ added in v0.3.1
type Appfile struct { Name string Namespace string Workloads []*Workload AppRevision *v1beta1.ApplicationRevision AppRevisionName string AppRevisionHash string AppLabels map[string]string AppAnnotations map[string]string RelatedTraitDefinitions map[string]*v1beta1.TraitDefinition RelatedComponentDefinitions map[string]*v1beta1.ComponentDefinition RelatedWorkflowStepDefinitions map[string]*v1beta1.WorkflowStepDefinition RelatedScopeDefinitions map[string]*v1beta1.ScopeDefinition Policies []v1beta1.AppPolicy PolicyWorkloads []*Workload Components []common.ApplicationComponent Artifacts []*types.ComponentManifest WorkflowSteps []workflowv1alpha1.WorkflowStep WorkflowMode *workflowv1alpha1.WorkflowExecuteMode ExternalPolicies map[string]*v1alpha1.Policy ExternalWorkflow *workflowv1alpha1.Workflow ReferredObjects []*unstructured.Unstructured Debug bool // contains filtered or unexported fields }
Appfile describes application
func (*Appfile) GenerateComponentManifest ¶ added in v1.1.0
func (af *Appfile) GenerateComponentManifest(wl *Workload, mutate func(*velaprocess.ContextData)) (*types.ComponentManifest, error)
GenerateComponentManifest generate only one ComponentManifest
func (*Appfile) GenerateComponentManifests ¶ added in v1.1.0
func (af *Appfile) GenerateComponentManifests() ([]*types.ComponentManifest, error)
GenerateComponentManifests converts an appFile to a slice of ComponentManifest
func (*Appfile) GeneratePolicyManifests ¶ added in v1.3.0
func (af *Appfile) GeneratePolicyManifests(ctx context.Context) ([]*unstructured.Unstructured, error)
GeneratePolicyManifests generates policy manifests from an appFile internal policies like apply-once, topology, will not render manifests
func (*Appfile) LoadDynamicComponent ¶ added in v1.4.0
func (af *Appfile) LoadDynamicComponent(ctx context.Context, cli client.Client, comp *common.ApplicationComponent) (*common.ApplicationComponent, error)
LoadDynamicComponent for ref-objects typed components, this function will load referred objects from stored revisions
func (*Appfile) PolicyClient ¶ added in v1.3.0
PolicyClient cache retrieved policy if ApplicationRevision not exists in appfile else use the policy in ApplicationRevision
func (*Appfile) SetOAMContract ¶ added in v1.1.1
func (af *Appfile) SetOAMContract(comp *types.ComponentManifest) error
SetOAMContract will set OAM labels and annotations for resources as contract
type Parser ¶ added in v0.3.1
type Parser struct {
// contains filtered or unexported fields
}
Parser is an application parser
func NewApplicationParser ¶ added in v0.3.1
func NewApplicationParser(cli client.Client, dm discoverymapper.DiscoveryMapper, pd *packages.PackageDiscover) *Parser
NewApplicationParser create appfile parser
func NewDryRunApplicationParser ¶ added in v1.0.3
func NewDryRunApplicationParser(cli client.Client, dm discoverymapper.DiscoveryMapper, pd *packages.PackageDiscover, defs []oam.Object) *Parser
NewDryRunApplicationParser create an appfile parser for DryRun
func (*Parser) GenerateAppFile ¶ added in v0.3.1
GenerateAppFile generate appfile for the application to run, if the application is controlled by PublishVersion, the application revision will be used to create the appfile
func (*Parser) GenerateAppFileFromApp ¶ added in v1.3.0
func (p *Parser) GenerateAppFileFromApp(ctx context.Context, app *v1beta1.Application) (*Appfile, error)
GenerateAppFileFromApp converts an application to an Appfile
func (*Parser) GenerateAppFileFromRevision ¶ added in v1.1.1
func (p *Parser) GenerateAppFileFromRevision(appRev *v1beta1.ApplicationRevision) (*Appfile, error)
GenerateAppFileFromRevision converts an application revision to an Appfile
func (*Parser) ParseWorkloadFromRevision ¶ added in v1.1.1
func (p *Parser) ParseWorkloadFromRevision(comp common.ApplicationComponent, appRev *v1beta1.ApplicationRevision) (*Workload, error)
ParseWorkloadFromRevision resolve an ApplicationComponent and generate a Workload containing ALL information required by an Appfile from app revision.
func (*Parser) ValidateCUESchematicAppfile ¶ added in v1.0.3
ValidateCUESchematicAppfile validates CUE schematic workloads in an Appfile
type Scope ¶ added in v0.3.1
type Scope struct { Name string GVK metav1.GroupVersionKind ResourceVersion string }
Scope defines the scope of workload
type Template ¶ added in v1.0.3
type Template struct { TemplateStr string Health string CustomStatus string CapabilityCategory types.CapabilityCategory Reference common.WorkloadTypeDescriptor Helm *common.Helm Kube *common.Kube Terraform *common.Terraform ComponentDefinition *v1beta1.ComponentDefinition WorkloadDefinition *v1beta1.WorkloadDefinition TraitDefinition *v1beta1.TraitDefinition ScopeDefinition *v1beta1.ScopeDefinition PolicyDefinition *v1beta1.PolicyDefinition WorkflowStepDefinition *v1beta1.WorkflowStepDefinition }
Template is a helper struct for processing capability including ComponentDefinition, TraitDefinition, ScopeDefinition. It mainly collects schematic and status data of a capability definition.
func LoadTemplate ¶ added in v1.0.3
func LoadTemplate(ctx context.Context, dm discoverymapper.DiscoveryMapper, cli client.Reader, capName string, capType types.CapType) (*Template, error)
LoadTemplate gets the capability definition from cluster and resolve it. It returns a helper struct, Template, which will be used for further processing.
func LoadTemplateFromRevision ¶ added in v1.1.1
func LoadTemplateFromRevision(capName string, capType types.CapType, apprev *v1beta1.ApplicationRevision, dm discoverymapper.DiscoveryMapper) (*Template, error)
LoadTemplateFromRevision will load Definition template from app revision
type TemplateLoaderFn ¶ added in v1.0.3
type TemplateLoaderFn func(context.Context, discoverymapper.DiscoveryMapper, client.Reader, string, types.CapType) (*Template, error)
TemplateLoaderFn load template of a capability definition
func DryRunTemplateLoader ¶ added in v1.0.3
func DryRunTemplateLoader(defs []oam.Object) TemplateLoaderFn
DryRunTemplateLoader return a function that do the same work as LoadTemplate, but load template from provided ones before loading from cluster through LoadTemplate
func (TemplateLoaderFn) LoadTemplate ¶ added in v1.0.3
func (fn TemplateLoaderFn) LoadTemplate(ctx context.Context, dm discoverymapper.DiscoveryMapper, c client.Reader, capName string, capType types.CapType) (*Template, error)
LoadTemplate load template of a capability definition
type Trait ¶ added in v0.3.1
type Trait struct { // The Name is name of TraitDefinition, actually it's a type of the trait instance Name string CapabilityCategory types.CapabilityCategory Params map[string]interface{} Template string HealthCheckPolicy string CustomStatusFormat string // RequiredSecrets stores secret names which the trait needs from cloud resource component and its context RequiredSecrets []process.RequiredSecrets FullTemplate *Template // contains filtered or unexported fields }
Trait is ComponentTrait
func (*Trait) EvalContext ¶ added in v0.3.1
EvalContext eval trait template and set result to context
type Workload ¶ added in v0.3.1
type Workload struct { Name string Type string ExternalRevision string CapabilityCategory types.CapabilityCategory Params map[string]interface{} Traits []*Trait Scopes []Scope ScopeDefinition []*v1beta1.ScopeDefinition FullTemplate *Template Ctx process.Context Patch *value.Value SkipApplyWorkload bool // contains filtered or unexported fields }
Workload is component
func (*Workload) EvalContext ¶ added in v0.3.1
EvalContext eval workload template and set result to context