template

package
v0.42.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2024 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package template provides conversion of cluster templates to Omni resources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SyncResult

type SyncResult struct {
	// Resources to create.
	Create []resource.Resource
	// Resources to update.
	Update []UpdateChange
	// Resources to delete split by phases.
	Destroy [][]resource.Resource
}

SyncResult describes the actions to perform to sync the template resources.

type Template

type Template struct {
	// contains filtered or unexported fields
}

Template is a cluster template.

func Load

func Load(input io.Reader) (*Template, error)

Load the template from input.

func WithCluster

func WithCluster(clusterName string) *Template

WithCluster creates an empty template which contains only cluster model.

Such template can be used for reading a cluster status, deleting a cluster, etc.

func (*Template) ClusterName

func (t *Template) ClusterName() (string, error)

ClusterName returns the name of the cluster associated with the template.

func (*Template) Delete

func (t *Template) Delete(ctx context.Context, st state.State) (*SyncResult, error)

Delete returns a sync result which lists what needs to be deleted from state to remove template from the cluster.

func (*Template) Sync

func (t *Template) Sync(ctx context.Context, st state.State) (*SyncResult, error)

Sync the template against the resource state.

func (*Template) Translate

func (t *Template) Translate() ([]resource.Resource, error)

Translate the template into resources.

func (*Template) Validate

func (t *Template) Validate() error

Validate the template.

type UpdateChange

type UpdateChange struct {
	Old resource.Resource
	New resource.Resource
}

UpdateChange is a pair of old/new resources.

Directories

Path Synopsis
internal
models
Package models provides cluster template models (for each sub-document of multi-doc YAML).
Package models provides cluster template models (for each sub-document of multi-doc YAML).
Package operations provides higher level operations on cluster templates.
Package operations provides higher level operations on cluster templates.
internal/statustree
Package statustree contains helpers to render cluster status to the terminal.
Package statustree contains helpers to render cluster status to the terminal.
internal/utils
Package utils contains various utility functions for template operations.
Package utils contains various utility functions for template operations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL