module

package
v1.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultKustomizerOptions = &krusty.Options{
	Reorder:           krusty.ReorderOptionNone,
	AddManagedbyLabel: false,
	LoadRestrictions:  ktypes.LoadRestrictionsNone,
	PluginConfig:      ktypes.DisabledPluginConfig(),
}

Functions

func IsRemote

func IsRemote(name string) bool

Types

type Bundle

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

func NewBundle

func NewBundle(m Module, opts ...BundleOpts) (*Bundle, error)

NewBundle returns a new Bundle for the given module and options provided

func (*Bundle) AddResource

func (b *Bundle) AddResource(res Resource)

AddResource adds a resource to this bundle

func (*Bundle) Export

func (b *Bundle) Export(fs filesys.FileSystem, opts ...ExportOpts) error

Export writes each resource in the bundle to individual yaml files on the provided filesystem. It effectivly runs resource.Flatten on each resource in this bundle. If a v1.Secret is encountered and a list of age recipient are known, then the resource is encrypted before writing to the file.

func (*Bundle) FindByGVK

func (b *Bundle) FindByGVK(gvk GroupVersionKind) []*resource.Resource

FindByGVK attempts to find a resource with the specific kind group, version and kind specified in the provided GroupVersionKind paramter

func (*Bundle) Flatten

func (b *Bundle) Flatten(w io.Writer) error

func (*Bundle) FlattenSecure

func (b *Bundle) FlattenSecure(recipients []string, w io.Writer) error

func (*Bundle) Resources

func (b *Bundle) Resources() []Resource

Resources returns a list of Resources on this module

type BundleOpts

type BundleOpts func(*Bundle) error

func WithAgeRecipients

func WithAgeRecipients(recipients []string) BundleOpts

WithAgeRecipients configures the bundle adding age recipients used for encryption

func WithResMap

func WithResMap(rm resmap.ResMap) BundleOpts

func WithSecrets

func WithSecrets(secrets []Secret) BundleOpts

WithSecrets applies all secrets defined in this module to the provided ResMap. Searches through the given resmap for Secret resources, updating/adding secrets on this module. The Secret resource to update is determined by the secret key name itself. This function only adds or updates values in the Secret resource if the key matches that of the module.

func WithURLs

func WithURLs(s string) BundleOpts

WithURLs applies all the URLs defined in this module to the provided ResMap.

type ExportOpts

type ExportOpts func(*Bundle) error

func WithExportRootDir

func WithExportRootDir(root string) ExportOpts

type GroupVersionKind

type GroupVersionKind struct {
	Group   string
	Version string
	Kind    string
}

type KustomizeModule

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

func NewKustomizeModule

func NewKustomizeModule(fs filesys.FileSystem, mod types.Module, prefix string) *KustomizeModule

NewKustomizeModule creates a new Kustomize implemented Module. It expects a filesystem, module type and a prefix. The prefix argument is a string that will prefix this module's name. This is so that the name module can be mapped to a Git repository, without having to reference the module by it's entire URL.

func (*KustomizeModule) Build

func (m *KustomizeModule) Build(w io.Writer) error

func (*KustomizeModule) BuildEncrypted

func (m *KustomizeModule) BuildEncrypted(data []byte, recipients []string) ([]byte, error)

func (*KustomizeModule) Bundle

func (m *KustomizeModule) Bundle(opts ...BundleOpts) (*Bundle, error)

func (*KustomizeModule) Components

func (m *KustomizeModule) Components() []string

func (*KustomizeModule) Host

func (m *KustomizeModule) Host() string

getHostName returns a string that can be used as value in an ingress host field. This function parses the modules Host struct and builds a hostname value based on the params provided. Prefix & Wildcard fields on the Host struct will be prepended and appended to the string provided to this function.

func (*KustomizeModule) Name

func (m *KustomizeModule) Name() string

Name returns a human readable version of this module. Returns m.Version if there is a value assigned. Otherwise the URL will be used to construct a value

func (*KustomizeModule) Namespace

func (m *KustomizeModule) Namespace() string

func (*KustomizeModule) Ref

func (m *KustomizeModule) Ref() string

func (*KustomizeModule) Resolve

func (m *KustomizeModule) Resolve() error

func (*KustomizeModule) Secrets

func (m *KustomizeModule) Secrets() []Secret

func (*KustomizeModule) URL

func (m *KustomizeModule) URL() string

func (*KustomizeModule) Version

func (m *KustomizeModule) Version() string

type Loader

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

func NewLoader

func NewLoader(fsys filesys.FileSystem) *Loader

func (*Loader) Load

func (l *Loader) Load(mod types.Module, prefix string) Module

Parse parses a module by its name and returns a module instance

type Module

type Module interface {
	Version() string
	Ref() string
	Name() string
	URL() string
	Namespace() string
	Components() []string
	Resolve() error
	Secrets() []Secret
	Host() string
	Build(io.Writer) error
	Bundle(...BundleOpts) (*Bundle, error)
}

type Resource

type Resource struct {
	*resource.Resource
}

func (*Resource) FileName

func (r *Resource) FileName() string

func (*Resource) Flatten

func (r *Resource) Flatten() ([]byte, error)

FlattenSecure flattenes the resource returning a byte array containing a YAML representation of the resource.

func (*Resource) FlattenSecure

func (r *Resource) FlattenSecure(recipients []string, secs []Secret) ([]byte, error)

FlattenSecure flattenes the resource returning a byte array containing a YAML representation of the resource. If the resource is a v1.Secret, then the output will be encrypted using sops.

type Secret

type Secret struct {
	Key   string
	Value string
}

func (*Secret) IsFile

func (s *Secret) IsFile() bool

IsFile returns true if secret is a path to a file. This is determined by the key. If it is prefixed with '@' then the secret is assumed to be a path.

Jump to

Keyboard shortcuts

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