Documentation ¶
Index ¶
- Constants
- func ConvertTemplateJSON2Object(capabilityName string, in *runtime.RawExtension, schematic *common.Schematic) (types.Capability, error)
- func GenerateCUETemplate(wl *Workload) (string, error)
- func GetOutputSecretNames(workloads *Workload) (string, error)
- func GetSecretAndConfigs(cli client.Client, workload *Workload, appName, ns string) error
- func NewBasicContext(wl *Workload, applicationName, revision, namespace string) process.Context
- func PrepareProcessContext(wl *Workload, applicationName, revision, namespace string) (process.Context, error)
- type Appfile
- func (af *Appfile) GenerateComponentManifest(wl *Workload) (*types.ComponentManifest, error)
- func (af *Appfile) GenerateComponentManifests() ([]*types.ComponentManifest, error)
- func (af *Appfile) GenerateWorkflowAndPolicy(ctx context.Context, m discoverymapper.DiscoveryMapper, cli client.Client, ...) (policies []*unstructured.Unstructured, steps []wfTypes.TaskRunner, err error)
- type Parser
- type Scope
- type Template
- type TemplateLoaderFn
- type Trait
- func (trait *Trait) EvalContext(ctx process.Context) error
- func (trait *Trait) EvalHealth(ctx process.Context, client client.Client, namespace string) (bool, error)
- func (trait *Trait) EvalStatus(ctx process.Context, cli client.Client, ns string) (string, error)
- func (trait *Trait) IsSecretConsumer() bool
- type Workload
- func (wl *Workload) EvalContext(ctx process.Context) error
- func (wl *Workload) EvalHealth(ctx process.Context, client client.Client, namespace string) (bool, error)
- func (wl *Workload) EvalStatus(ctx process.Context, cli client.Client, ns string) (string, error)
- func (wl *Workload) GetUserConfigName() string
- func (wl *Workload) IsSecretConsumer() bool
- func (wl *Workload) IsSecretProducer() bool
Constants ¶
const ( // UsageTag is usage comment annotation UsageTag = "+usage=" // ShortTag is the short alias annotation ShortTag = "+short" // InsertSecretToTag marks the value should be set as an context InsertSecretToTag = "+insertSecretTo=" )
const (
// AppfileBuiltinConfig defines the built-in config variable
AppfileBuiltinConfig = "config"
)
const WriteConnectionSecretToRefKey = "writeConnectionSecretToRef"
WriteConnectionSecretToRefKey is used to create a secret for cloud resource connection
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 GetOutputSecretNames ¶ added in v1.0.0
GetOutputSecretNames set all secret names, which are generated by cloud resource, to context
func GetSecretAndConfigs ¶ added in v1.1.0
GetSecretAndConfigs will get secrets and configs the workload requires
func NewBasicContext ¶ added in v1.0.5
NewBasicContext prepares a basic DSL process Context
Types ¶
type Appfile ¶ added in v0.3.1
type Appfile struct { Name string Namespace string RevisionName string Workloads []*Workload Policies []*Workload WorkflowSteps []v1beta1.WorkflowStep }
Appfile describes application
func (*Appfile) GenerateComponentManifest ¶ added in v1.1.0
func (af *Appfile) GenerateComponentManifest(wl *Workload) (*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) GenerateWorkflowAndPolicy ¶ added in v1.1.0
func (af *Appfile) GenerateWorkflowAndPolicy(ctx context.Context, m discoverymapper.DiscoveryMapper, cli client.Client, pd *packages.PackageDiscover, dispatcher kube.Dispatcher) (policies []*unstructured.Unstructured, steps []wfTypes.TaskRunner, err error)
GenerateWorkflowAndPolicy generates workflow steps and policies from an appFile
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 converts an application to an Appfile
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 schema.GroupVersionKind }
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 // TODO: Add scope definition too ComponentDefinition *v1beta1.ComponentDefinition WorkloadDefinition *v1beta1.WorkloadDefinition TraitDefinition *v1beta1.TraitDefinition 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.
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
func (*Trait) EvalHealth ¶ added in v0.3.1
func (trait *Trait) EvalHealth(ctx process.Context, client client.Client, namespace string) (bool, error)
EvalHealth eval trait health check
func (*Trait) EvalStatus ¶ added in v0.3.3
EvalStatus eval trait status
func (*Trait) IsSecretConsumer ¶ added in v1.1.0
IsSecretConsumer checks whether a trait is cloud resource consumer role
type Workload ¶ added in v0.3.1
type Workload struct { Name string Type string CapabilityCategory types.CapabilityCategory Params map[string]interface{} Traits []*Trait Scopes []Scope FullTemplate *Template // OutputSecretName is the secret name which this workload will generate after it successfully generate a cloud resource OutputSecretName string // RequiredSecrets stores secret names which the workload needs from cloud resource component and its context RequiredSecrets []process.RequiredSecrets UserConfigs []map[string]string // ConfigNotReady indicates there's RequiredSecrets and UserConfigs but they're not ready yet. ConfigNotReady 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
func (*Workload) EvalHealth ¶ added in v0.3.1
func (wl *Workload) EvalHealth(ctx process.Context, client client.Client, namespace string) (bool, error)
EvalHealth eval workload health check
func (*Workload) EvalStatus ¶ added in v0.3.3
EvalStatus eval workload status
func (*Workload) GetUserConfigName ¶ added in v0.3.1
GetUserConfigName get user config from AppFile, it will contain config file in it.
func (*Workload) IsSecretConsumer ¶ added in v1.1.0
IsSecretConsumer checks whether a workload is cloud resource consumer role
func (*Workload) IsSecretProducer ¶ added in v1.1.0
IsSecretProducer checks whether a workload is cloud resource producer role