_package

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TerraformVersionAnnotation = "corral.cattle.io/terraform-version"
	PublisherAnnotation        = "corral.cattle.io/published-by"
	CorralVersionAnnotation    = "corral.cattle.io/corral-version"
	PublishTimestampAnnotation = "corral.cattle.io/published-at"
)

Variables

View Source
var ErrOverlayNotFound = errors.New("overlay folder not found")

Functions

func AddRegistryCredentials

func AddRegistryCredentials(registry, username, password string) error

func NewCachedFetcher

func NewCachedFetcher(source remotes.Fetcher) remotes.Fetcher

func Template

func Template(name, description string, packages ...string) error

func UploadPackage

func UploadPackage(pkg Package, ref string) error

func Validate

func Validate(name string) error

func ValidateManifest

func ValidateManifest(manifest []byte) error

ValidateManifest returns an error of the manifest violates any rules defined in the package-manifest.schema.json

Types

type CachedFetcher

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

func (*CachedFetcher) Fetch

func (c *CachedFetcher) Fetch(ctx context.Context, desc v1.Descriptor) (io.ReadCloser, error)

type Command

type Command struct {
	// shell fields
	Command       string   `yaml:"command,omitempty"`
	NodePoolNames []string `yaml:"node_pools,omitempty"`
	Parallel      *bool    `yaml:"parallel,omitempty"`

	// terraform module fields
	Module      string `yaml:"module,omitempty"`
	SkipCleanup bool   `yaml:"skip_cleanup,omitempty"`
}

type Manifest

type Manifest struct {
	Name            string            `yaml:"name"`
	Annotations     map[string]string `yaml:"annotations,omitempty"`
	Description     string            `yaml:"description,omitempty"`
	Commands        []Command         `yaml:"commands"`
	Overlay         map[string]string `yaml:"overlay,omitempty"`
	VariableSchemas VariableSchemas   `yaml:"variables,omitempty"`
}

func LoadManifest

func LoadManifest(_fs fs.FS, path string) (Manifest, error)

LoadManifest reads a manifest file and validates it is a valid manifest.

func (*Manifest) ApplyDefaultVars

func (m *Manifest) ApplyDefaultVars(vs vars.VarSet) error

func (*Manifest) FilterSensitiveVars

func (m *Manifest) FilterSensitiveVars(vs vars.VarSet) vars.VarSet

FilterSensitiveVars returns the given VarSet without any variables marked as sensitive in the manifest

func (*Manifest) FilterVars

func (m *Manifest) FilterVars(vs vars.VarSet) vars.VarSet

FilterVars returns the given VarSet without any variables not defined in the manifest

func (*Manifest) GetAnnotation

func (m *Manifest) GetAnnotation(key string) string

func (*Manifest) ValidateDefaults

func (m *Manifest) ValidateDefaults() error

ValidateDefaults returns an error if the var set does not match the manifest variable schemas.

func (*Manifest) ValidateVarSet

func (m *Manifest) ValidateVarSet(vs vars.VarSet, write bool) error

ValidateVarSet returns an error if the var set does not match the manifest variable schemas.

type Package

type Package struct {
	RootPath string

	Manifest
}

func LoadPackage

func LoadPackage(ref string) (Package, error)

func (Package) ManifestPath

func (b Package) ManifestPath() string

func (*Package) OverlayPath

func (b *Package) OverlayPath() string

func (Package) TerraformModulePath

func (b Package) TerraformModulePath(name string) string

func (Package) TerraformVersion

func (b Package) TerraformVersion() string

type Schema

type Schema struct {
	*jsonschema.Schema

	Sensitive   bool
	Optional    bool
	Description string
	Default     any
}

type TemplateManifest

type TemplateManifest struct {
	Name            string            `yaml:"name"`
	Annotations     map[string]string `yaml:"annotations,omitempty"`
	Description     string            `yaml:"description"`
	Commands        []Command         `yaml:"commands"`
	Overlay         map[string]string `yaml:"overlay,omitempty"`
	VariableSchemas map[string]any    `yaml:"variables,omitempty"`
}

func MergePackages

func MergePackages(name, description string, pkgs []Package) (TemplateManifest, error)

type VariableSchemas

type VariableSchemas map[string]Schema

func (*VariableSchemas) UnmarshalYAML

func (s *VariableSchemas) UnmarshalYAML(unmarshal func(any) error) error

Jump to

Keyboard shortcuts

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