pkgbuilder

package
v0.0.0-...-c7d747a Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DeploymentResource = "deployment"
	ConfigMapResource  = "configmap"
	SecretResource     = "secret"
)

Functions

This section is empty.

Types

type AnnotationSetter

type AnnotationSetter struct {
	Name string

	Value string
}

func SetAnnotation

func SetAnnotation(name, value string) AnnotationSetter

SetAnnotation returns a new AnnotationSetters that sets an annotation with the given name and value.

func (AnnotationSetter) Filter

func (a AnnotationSetter) Filter(rn *yaml.RNode) (*yaml.RNode, error)

type FieldPathSetter

type FieldPathSetter struct {
	Path []string

	Value string
}

FieldPathSetter updates the value of the field given by the path.

func SetFieldPath

func SetFieldPath(value string, path ...string) FieldPathSetter

SetFieldPath returns a new FieldPathSetter that updates the property given by the path with the given value.

func (FieldPathSetter) Filter

func (f FieldPathSetter) Filter(rn *yaml.RNode) (*yaml.RNode, error)

type Function

type Function struct {
	Image      string
	ConfigPath string
}

func NewFunction

func NewFunction(image string) Function

func (Function) WithConfigPath

func (f Function) WithConfigPath(configPath string) Function

type Inventory

type Inventory struct {
	Name      string
	Namespace string
	ID        string
}

type Kptfile

type Kptfile struct {
	Upstream     *Upstream
	UpstreamLock *UpstreamLock
	Pipeline     *Pipeline
	Inventory    *Inventory
}

Kptfile represents the Kptfile of a package.

func NewKptfile

func NewKptfile() *Kptfile

func (*Kptfile) WithInventory

func (k *Kptfile) WithInventory(inv Inventory) *Kptfile

func (*Kptfile) WithPipeline

func (k *Kptfile) WithPipeline(functions ...Function) *Kptfile

func (*Kptfile) WithUpstream

func (k *Kptfile) WithUpstream(repo, dir, ref, strategy string) *Kptfile

WithUpstream adds information about the upstream information to the Kptfile. The upstream section of the Kptfile is only added if this information is provided.

func (*Kptfile) WithUpstreamLock

func (k *Kptfile) WithUpstreamLock(repo, dir, ref, commit string) *Kptfile

WithUpstreamLock adds upstreamLock information to the Kptfile. If no upstreamLock information is provided,

func (*Kptfile) WithUpstreamLockRef

func (k *Kptfile) WithUpstreamLockRef(repoRef, dir, ref string, index int) *Kptfile

WithUpstreamLockRef adds upstreamLock information to the Kptfile. But unlike WithUpstreamLock, this function takes a the name to a repo and will resolve the actual path when expanding the package. The commit SHA is also not provided, but rather the index of a commit that will be resolved when expanding the package.

func (*Kptfile) WithUpstreamRef

func (k *Kptfile) WithUpstreamRef(repoRef, dir, ref, strategy string) *Kptfile

WithUpstreamRef adds information about the upstream information to the Kptfile. Unlike WithUpstream, this function allows providing just a reference to the repo rather than the actual path. The reference will be resolved to an actual path when the package is written to disk.

type Pipeline

type Pipeline struct {
	Functions []Function
}

type RGFile

type RGFile struct {
	Name, Namespace, ID string
}

RGFile represents a minimal resourcegroup.

func NewRGFile

func NewRGFile() *RGFile

func (*RGFile) WithInventory

func (rg *RGFile) WithInventory(inv Inventory) *RGFile

type RemoteSubpackage

type RemoteSubpackage struct {
	// Name is the name of the remote subpackage. It will be used as the value
	// for the LocalDir property and also used to resolve the Repo path from
	// other defined repos.
	RepoRef   string
	Repo      string
	Directory string
	Ref       string
	Strategy  string
	LocalDir  string
}

RemoteSubpackage contains information about remote subpackages that should be listed in the Kptfile.

type ReposInfo

type ReposInfo interface {
	ResolveRepoRef(repoRef string) (string, bool)
	ResolveCommitIndex(repoRef string, index int) (string, bool)
}

type RootPkg

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

RootPkg is a package without any parent package.

func NewRootPkg

func NewRootPkg() *RootPkg

NewRootPkg creates a new package for testing.

func (*RootPkg) AllReferencedRepos

func (rp *RootPkg) AllReferencedRepos() []string

AllReferencedRepos returns the name of all remote subpackages referenced in the package (including any local subpackages).

func (*RootPkg) Build

func (rp *RootPkg) Build(path string, pkgName string, reposInfo ReposInfo) error

Build outputs the current data structure as a set of (nested) package in the provided path.

func (*RootPkg) ExpandPkg

func (rp *RootPkg) ExpandPkg(t *testing.T, reposInfo ReposInfo) string

ExpandPkg writes the provided package to disk. The name of the root package will just be set to "base".

func (*RootPkg) ExpandPkgWithName

func (rp *RootPkg) ExpandPkgWithName(t *testing.T, rootName string, reposInfo ReposInfo) string

ExpandPkgWithName writes the provided package to disk and uses the given rootName to set the value of the package directory and the metadata.name field of the root package.

func (*RootPkg) HasKptfile

func (rp *RootPkg) HasKptfile() bool

HasKptfile tells whether the package contains a Kptfile.

func (*RootPkg) WithFile

func (rp *RootPkg) WithFile(name, content string) *RootPkg

WithFile configures the package to contain a file with the provided name and the given content.

func (*RootPkg) WithKptfile

func (rp *RootPkg) WithKptfile(kf ...*Kptfile) *RootPkg

WithKptfile configures the current package to have a Kptfile. Only zero or one Kptfiles are accepted.

func (*RootPkg) WithRGFile

func (rp *RootPkg) WithRGFile(rg *RGFile) *RootPkg

WithRGFile configures the current package to have a resourcegroup file.

func (*RootPkg) WithRawResource

func (rp *RootPkg) WithRawResource(resourceName, manifest string, mutators ...yaml.Filter) *RootPkg

WithRawResource configures the package to include the provided resource

func (*RootPkg) WithResource

func (rp *RootPkg) WithResource(resourceName string, mutators ...yaml.Filter) *RootPkg

WithResource configures the package to include the provided resource

func (*RootPkg) WithSubPackages

func (rp *RootPkg) WithSubPackages(ps ...*SubPkg) *RootPkg

WithSubPackages adds the provided packages as subpackages to the current package

type SubPkg

type SubPkg struct {
	Name string
	// contains filtered or unexported fields
}

SubPkg is a subpackage, so it is contained inside another package. The name sets both the name of the directory in which the package is stored and the metadata.name field in the Kptfile (if there is one).

func NewSubPkg

func NewSubPkg(name string) *SubPkg

NewSubPkg returns a new subpackage for testing.

func (*SubPkg) WithFile

func (sp *SubPkg) WithFile(name, content string) *SubPkg

WithFile configures the package to contain a file with the provided name and the given content.

func (*SubPkg) WithKptfile

func (sp *SubPkg) WithKptfile(kf ...*Kptfile) *SubPkg

WithKptfile configures the current package to have a Kptfile. Only zero or one Kptfiles are accepted.

func (*SubPkg) WithRawResource

func (sp *SubPkg) WithRawResource(resourceName, manifest string, mutators ...yaml.Filter) *SubPkg

WithRawResource configures the package to include the provided resource

func (*SubPkg) WithResource

func (sp *SubPkg) WithResource(resourceName string, mutators ...yaml.Filter) *SubPkg

WithResource configures the package to include the provided resource

func (*SubPkg) WithSubPackages

func (sp *SubPkg) WithSubPackages(ps ...*SubPkg) *SubPkg

WithSubPackages adds the provided packages as subpackages to the current package

type Upstream

type Upstream struct {
	Repo     string
	RepoRef  string
	Dir      string
	Ref      string
	Strategy string
}

type UpstreamLock

type UpstreamLock struct {
	Repo    string
	RepoRef string
	Dir     string
	Ref     string
	Index   int
	Commit  string
}

Jump to

Keyboard shortcuts

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