manifests

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrChildResourceResourceMarkerInspect = errors.New("error inspecting resource markers for child resource")
	ErrChildResourceResourceMarkerProcess = errors.New("error processing resource markers for child resource")
	ErrChildResourceRBACGenerate          = errors.New("error generating RBAC for child resource")
)
View Source
var ErrProcessManifest = errors.New("error processing manifest file")

Functions

This section is empty.

Types

type ChildResource

type ChildResource struct {
	Name          string
	UniqueName    string
	Group         string
	Version       string
	Kind          string
	StaticContent string
	SourceCode    string
	IncludeCode   []string
	MutateFile    string
	UseStrConv    bool
	RBAC          *rbac.Rules
}

ChildResource contains attributes for resources created by the custom resource. These definitions are inferred from the resource manifests. They can be thought of as the individual resources which are managed by the controller during reconciliation and represent all resources which are passed in via the `spec.resources` field of the workload configuration.

func NewChildResource

func NewChildResource(object unstructured.Unstructured) (*ChildResource, error)

NewChildResource returns a representation of a ChildResource object given an unstructured Kubernetes object.

func (*ChildResource) CreateFuncName

func (resource *ChildResource) CreateFuncName() string

CreateFuncName returns the create func name for a child resource.

func (*ChildResource) InitFuncName

func (resource *ChildResource) InitFuncName() string

InitFuncName returns the init func name for a child resource.

func (*ChildResource) MutateFileName

func (resource *ChildResource) MutateFileName() string

MutateFileName returns the file name relative to the mutate directory. It is responsible for turning capital letters into lowercase letter prefixed with an underscore.

func (*ChildResource) MutateFuncName

func (resource *ChildResource) MutateFuncName() string

MutateFuncName returns the mutate func name for a child resource.

func (*ChildResource) NameComment

func (resource *ChildResource) NameComment() string

NameComment returns the name of a child resource to be used in generated code for the purposed of comments. It takes into account tags and can return a more friendly value that will strip the tags.

func (*ChildResource) NameConstant

func (resource *ChildResource) NameConstant() string

NameConstant returns the constant which is generated in the code for re-use. It is needed for instances that the metadata.name field is a field marker, in which case we have no way to return the name constant.

func (*ChildResource) ProcessResourceMarkers

func (resource *ChildResource) ProcessResourceMarkers(markerCollection *markers.MarkerCollection) error

func (ChildResource) String

func (resource ChildResource) String() string

type Manifest

type Manifest struct {
	Content                  []byte          `json:",omitempty" yaml:",omitempty" validate:"omitempty"`
	Filename                 string          `json:",omitempty" yaml:",omitempty" validate:"omitempty"`
	SourceFilename           string          `json:",omitempty" yaml:",omitempty" validate:"omitempty"`
	ChildResources           []ChildResource `json:",omitempty" yaml:",omitempty" validate:"omitempty"`
	PreferredSourceFileNames []string        `json:",omitempty" yaml:",omitempty" validate:"omitempty"`
}

Manifest represents a single input manifest for a given config.

func (*Manifest) ExtractManifests

func (manifest *Manifest) ExtractManifests() []string

ExtractManifests extracts the manifests as YAML strings from a manifest with existing manifest content.

func (*Manifest) LoadContent

func (manifest *Manifest) LoadContent(isCollection bool) error

LoadContent sets the Content field of the manifest in raw format as []byte.

type Manifests

type Manifests []*Manifest

Manifests represents a collection of manifests.

func ExpandManifests

func ExpandManifests(workloadPath string, manifestPaths []string) (*Manifests, error)

ExpandManifests expands manifests from its globbed pattern and return the resultant manifest filenames from the glob.

func FromFiles

func FromFiles(manifestFiles []string) *Manifests

FromFiles returns new manifest objects given a set of file paths.

func (Manifests) FuncNames

func (manifests Manifests) FuncNames() (createFuncNames, initFuncNames []string)

FuncNames returns the function names for a set of resources. The function names are derived from the child resource unique names and refer to the functions that actually create the child resource objects in memory for the purposes of shipping to the Kubernetes API for deployment into the cluster.

Jump to

Keyboard shortcuts

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