Documentation ¶
Index ¶
- func BuildKubernetesTarget(target *lsv1alpha1.Target, restConfig *rest.Config) error
- func CreateKubernetesTarget(namespace, name string, restConfig *rest.Config) (*lsv1alpha1.Target, error)
- func GetDeployItemExport(ctx context.Context, kubeClient client.Client, di *lsv1alpha1.DeployItem) ([]byte, error)
- func GetSubInstallationsOfInstallation(ctx context.Context, kubeClient client.Client, inst *lsv1alpha1.Installation) ([]*lsv1alpha1.Installation, error)
- func IsInstallationFinished(inst *lsv1alpha1.Installation, phase lsv1alpha1.InstallationPhase) (bool, error)
- func WaitForDeployItemToFinish(ctx context.Context, kubeClient client.Reader, ...) error
- func WaitForInstallationToBeDeleted(ctx context.Context, kubeClient client.Reader, inst *lsv1alpha1.Installation, ...) error
- func WaitForInstallationToFinish(ctx context.Context, kubeClient client.Reader, inst *lsv1alpha1.Installation, ...) error
- func WaitForInstallationToHaveCondition(ctx context.Context, kubeClient client.Reader, inst *lsv1alpha1.Installation, ...) error
- type BlueprintExports
- type BlueprintRenderer
- func (r *BlueprintRenderer) RenderDeployItemsAndSubInstallations(input *ResolvedInstallation, imports map[string]interface{}) (*RenderedDeployItemsSubInstallations, error)
- func (r *BlueprintRenderer) RenderExportExecutions(input *ResolvedInstallation, ...) (map[string]interface{}, error)
- func (r *BlueprintRenderer) RenderImportExecutions(input *ResolvedInstallation, imports map[string]interface{}) (map[string]interface{}, error)
- type ExportTemplate
- type ExportTemplates
- type Exports
- type InstallationConditionFunc
- type InstallationExports
- type InstallationPath
- type InstallationSimulator
- type InstallationSimulatorCallbacks
- type RenderedDeployItemsSubInstallations
- type ResolvedInstallation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildKubernetesTarget ¶
func BuildKubernetesTarget(target *lsv1alpha1.Target, restConfig *rest.Config) error
BuildKubernetesTarget adds all kubernetes type related attributes to the target
func CreateKubernetesTarget ¶
func CreateKubernetesTarget(namespace, name string, restConfig *rest.Config) (*lsv1alpha1.Target, error)
CreateKubernetesTarget creates a new target of type kubernetes
func GetDeployItemExport ¶
func GetDeployItemExport(ctx context.Context, kubeClient client.Client, di *lsv1alpha1.DeployItem) ([]byte, error)
GetDeployItemExport returns the exports for a deploy item
func GetSubInstallationsOfInstallation ¶
func GetSubInstallationsOfInstallation(ctx context.Context, kubeClient client.Client, inst *lsv1alpha1.Installation) ([]*lsv1alpha1.Installation, error)
GetSubInstallationsOfInstallation returns the direct subinstallations of a installation.
func IsInstallationFinished ¶
func IsInstallationFinished(inst *lsv1alpha1.Installation, phase lsv1alpha1.InstallationPhase) (bool, error)
func WaitForDeployItemToFinish ¶
func WaitForDeployItemToFinish( ctx context.Context, kubeClient client.Reader, deployItem *lsv1alpha1.DeployItem, phase lsv1alpha1.DeployItemPhase, timeout time.Duration) error
WaitForDeployItemToFinish waits until the given deploy item has finished with the given phase
func WaitForInstallationToBeDeleted ¶
func WaitForInstallationToBeDeleted( ctx context.Context, kubeClient client.Reader, inst *lsv1alpha1.Installation, timeout time.Duration) error
WaitForInstallationToBeDeleted waits until the given installation has finished with the given phase
func WaitForInstallationToFinish ¶
func WaitForInstallationToFinish( ctx context.Context, kubeClient client.Reader, inst *lsv1alpha1.Installation, phase lsv1alpha1.InstallationPhase, timeout time.Duration) error
WaitForInstallationToFinish waits until the given installation has finished with the given phase
func WaitForInstallationToHaveCondition ¶
func WaitForInstallationToHaveCondition( ctx context.Context, kubeClient client.Reader, inst *lsv1alpha1.Installation, cond InstallationConditionFunc, timeout time.Duration) error
WaitForInstallationToHaveCondition waits until the given installation fulfills the given condition.
Types ¶
type BlueprintExports ¶
type BlueprintExports Exports
BlueprintExports contains data exported by a blueprint.
type BlueprintRenderer ¶
type BlueprintRenderer struct {
// contains filtered or unexported fields
}
BlueprintRenderer is able to render a blueprint with given import values or exports for export templates.
func NewBlueprintRenderer ¶
func NewBlueprintRenderer(cdList *model.ComponentVersionList, registryAccess model.RegistryAccess, repositoryContext *types.UnstructuredTypedObject) *BlueprintRenderer
NewBlueprintRenderer creates a new blueprint renderer. The arguments are optional and may be nil.
func (*BlueprintRenderer) RenderDeployItemsAndSubInstallations ¶
func (r *BlueprintRenderer) RenderDeployItemsAndSubInstallations(input *ResolvedInstallation, imports map[string]interface{}) (*RenderedDeployItemsSubInstallations, error)
RenderDeployItemsAndSubInstallations renders deploy items and subinstallations of a given blueprint using the given imports. The import values are validated with the JSON schemas defined in the blueprint.
func (*BlueprintRenderer) RenderExportExecutions ¶
func (r *BlueprintRenderer) RenderExportExecutions(input *ResolvedInstallation, imports, installationDataImports, installationTargetImports, deployItemsExports map[string]interface{}) (map[string]interface{}, error)
RenderExportExecutions renders the export executions of the given blueprint and returns the rendered exports.
func (*BlueprintRenderer) RenderImportExecutions ¶
func (r *BlueprintRenderer) RenderImportExecutions(input *ResolvedInstallation, imports map[string]interface{}) (map[string]interface{}, error)
RenderImportExecutions renders the export executions of the given blueprint and returns the rendered exports.
type ExportTemplate ¶
type ExportTemplate struct { // Name is the name of the export template. Name string `json:"name"` // Selector; for deploy items: is a regular expression that must match the installation path and deploy item name. // Example: "root/installationA/.*/myDeployItem.* // for installations: is a regular expression that must match the installation path // Example: ".*/installationA" Selector string `json:"selector"` // Template contains the go template that must output a valid yaml structure. Template string `json:"template"` // SelectorRegexp is the compiled regular expression of the selector. SelectorRegexp *regexp.Regexp `json:"-"` }
ExportTemplate contains a template definition that is executed once the selector matches.
type ExportTemplates ¶
type ExportTemplates struct { // DeployItemExports is a list of export templates that are matched with deploy items of installations. // The template has to output a valid yaml structure that contains a map under the key "exports". // Input parameters for the template are: // "imports": the installation imports // "installationPath": the complete installation path that contains the deploy item, which is also used for selecting the template // "templateName": the user specified name of this template // "deployItem": the complete deploy item structure // "cd": the component descriptor // "components": the component descriptor list DeployItemExports []*ExportTemplate `json:"deployItems"` // InstallationExports is a list of export templates that are matched with installations. // The template has to output a valid yaml structure that contains a map under the key "dataExports" and the key "targetExports". // Input parameters for the template are: // "imports": the installation imports // "installationPath": the complete path to the installation, which is also used for selecting the template // "templateName": the user specified name of this template // "installation": the complete installation structure // "cd": the component descriptor // "components": the component descriptor list // "state": contains the calculated installation state InstallationExports []*ExportTemplate `json:"installations"` }
ExportTemplates contains a list of deploy item export templates.
type Exports ¶
type Exports struct { // DataObjects contains data object exports. DataObjects map[string]interface{} // Targets contains target exports. Targets map[string]interface{} }
Exports contains exported data objects and targets.
type InstallationConditionFunc ¶
type InstallationConditionFunc func(installation *lsv1alpha1.Installation) (bool, error)
InstallationConditionFunc defines a condition function that is used to in the wait helper function.
type InstallationExports ¶
type InstallationExports Exports
InstallationExports contains data exported by an installation.
type InstallationPath ¶
type InstallationPath struct {
// contains filtered or unexported fields
}
InstallationPath defines elements in an installation, subinstallation chain
func NewInstallationPath ¶
func NewInstallationPath(name string) *InstallationPath
NewInstallationPath creates a new installation path with the root installation named after given name.
func (*InstallationPath) Child ¶
func (p *InstallationPath) Child(name string) *InstallationPath
Child creates a new child installation element with the given name.
func (*InstallationPath) String ¶
func (p *InstallationPath) String() string
String converts the installation path into a file system path representation, starting at the root installation.
type InstallationSimulator ¶
type InstallationSimulator struct {
// contains filtered or unexported fields
}
InstallationSimulator simulations the landscaper handling of installations with its deploy items and subinstallations. The exports of deploy items are simulated via user defined ExportTemplates.
func NewInstallationSimulator ¶
func NewInstallationSimulator(cdList *model.ComponentVersionList, registryAccess model.RegistryAccess, repositoryContext *types.UnstructuredTypedObject, exportTemplates ExportTemplates) (*InstallationSimulator, error)
NewInstallationSimulator creates a new installation simulator. The repositoryContext parameter is optional and can be set to nil.
func (*InstallationSimulator) Run ¶
func (s *InstallationSimulator) Run(componentVersion model.ComponentVersion, blueprint *blueprints.Blueprint, imports map[string]interface{}) (*BlueprintExports, error)
Run starts the simulation for the given component descriptor, blueprint and imports and returns the calculated exports.
func (*InstallationSimulator) SetCallbacks ¶
func (s *InstallationSimulator) SetCallbacks(callbacks InstallationSimulatorCallbacks) *InstallationSimulator
SetCallbacks sets user defined simulator callbacks.
type InstallationSimulatorCallbacks ¶
type InstallationSimulatorCallbacks interface { // OnInstallation is called when a new installation was found. OnInstallation(path string, installation *lsv1alpha1.Installation) // OnInstallationTemplateState is called when a new installation template state was found. OnInstallationTemplateState(path string, state map[string][]byte) // OnImports is called when imports of an installation are found. OnImports(path string, imports map[string]interface{}) // OnDeployItem is called when a new deploy item was found. OnDeployItem(path string, deployItem *lsv1alpha1.DeployItem) // OnDeployItemTemplateState is called when a new deploy item template state was found. OnDeployItemTemplateState(path string, state map[string][]byte) // OnExports is called when exports of an installation are found. OnExports(path string, exports map[string]interface{}) }
InstallationSimulatorCallbacks are called when installations, deploy items, imports, exports or state elements are found during the simulation run.
type RenderedDeployItemsSubInstallations ¶
type RenderedDeployItemsSubInstallations struct { // DeployItems contains the list of rendered deployitems. DeployItems []*lsv1alpha1.DeployItem // DeployItemTemplateState contains the rendered state of the deployitems templates. DeployItemTemplateState map[string][]byte // Installations contains the rendered installations. Installations []ResolvedInstallation // InstallationTemplateState contains the rendered state of the installation templates. InstallationTemplateState map[string][]byte }
RenderedDeployItemsSubInstallations contains a list of rendered deployitems, deployitem state, installations and installation state.
type ResolvedInstallation ¶
type ResolvedInstallation struct { ComponentVersion model.ComponentVersion *lsv1alpha1.Installation *blueprints.Blueprint }
ResolvedInstallation contains a tuple of component descriptor, installation and blueprint.