pkgbuilder

package
v0.39.3 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func ExpandPkg

func ExpandPkg(t *testing.T, pkg *Pkg) string

Types

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 Kptfile

type Kptfile struct {
	Setters []Setter
	Repo    string
	Ref     string
}

Kptfile represents the Kptfile of a package.

func NewKptfile

func NewKptfile() *Kptfile

func (*Kptfile) WithSetters

func (k *Kptfile) WithSetters(setters ...Setter) *Kptfile

WithSetters adds information about the setters for a Kptfile.

func (*Kptfile) WithUpstream

func (k *Kptfile) WithUpstream(repo, ref 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.

type Pkg

type Pkg struct {
	Name string

	Kptfile *Kptfile
	// contains filtered or unexported fields
}

Pkg represents a package that can be created on the file system by using the Build function

func NewPackage

func NewPackage(name string) *Pkg

NewPackage creates a new package for testing.

func (*Pkg) Build

func (p *Pkg) Build(path string) error

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

func (*Pkg) WithFile

func (p *Pkg) WithFile(name, content string) *Pkg

func (*Pkg) WithKptfile

func (p *Pkg) WithKptfile(kf ...*Kptfile) *Pkg

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

func (*Pkg) WithResource

func (p *Pkg) WithResource(resourceName string, mutators ...yaml.Filter) *Pkg

WithResource configures the package to include the provided resource

func (*Pkg) WithResourceAndSetters

func (p *Pkg) WithResourceAndSetters(resourceName string, setterRefs []SetterRef, mutators ...yaml.Filter) *Pkg

WithResourceAndSetters configures the package to have the provided resource. It also allows for specifying setterRefs for the resource and a set of mutators that will update the content of the resource.

func (*Pkg) WithSubPackages

func (p *Pkg) WithSubPackages(ps ...*Pkg) *Pkg

WithSubPackages adds the provided packages as subpackages to the current package

type Setter

type Setter struct {
	Name  string
	Value string
	IsSet bool
}

Setter contains the properties required for adding a setter to the Kptfile.

func NewSetSetter

func NewSetSetter(name, value string) Setter

NewSetSetter creates a new setter that is marked as set.

func NewSetter

func NewSetter(name, value string) Setter

NewSetter creates a new setter that is not marked as set

type SetterRef

type SetterRef struct {
	Path []string
	Name string
}

SetterRef specifies the information for creating a new reference to a setter in a resource.

func NewSetterRef

func NewSetterRef(name string, path ...string) SetterRef

NewSetterRef creates a new setterRef with the given name and path.

Jump to

Keyboard shortcuts

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