assets

package
v0.0.0-...-58d4ac4 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTemplateFunc

func AddTemplateFunc(name string, fn interface{}) error

func AddTemplateFuncOrDie

func AddTemplateFuncOrDie(name string, fn interface{})

func LoadFilesRecursively

func LoadFilesRecursively(dir string, predicates ...FileInfoPredicate) (map[string][]byte, error)

LoadFilesRecursively returns a map from relative path names to file content.

func OnlyYaml

func OnlyYaml(_ string, info os.FileInfo) (bool, error)

OnlyYaml is a predicate for LoadFilesRecursively filters out non-yaml files.

func SubstituteAndCopyFiles

func SubstituteAndCopyFiles(assetInputDir, assetOutputDir, featureSet, clusterProfile string, templateData interface{}, additionalPredicates ...FileInfoPredicate) error

SubstituteAndCopyFiles read files from the input dir, selects some by predicate, transforms them, and writes the content to output dir.

Types

type Asset

type Asset struct {
	Name           string
	FilePermission Permission
	Data           []byte
}

Asset defines a single static asset.

func MustCreateAssetFromTemplate

func MustCreateAssetFromTemplate(name string, template []byte, config interface{}) Asset

MustCreateAssetFromTemplate process the given template using and return an asset.

func (Asset) WriteFile

func (a Asset) WriteFile(path string) error

WriteFile writes a single asset into specified path.

type Assets

type Assets []Asset

Assets is a list of assets.

func New

func New(dir string, data interface{}, manifestPredicates []FileContentsPredicate, predicates ...FileInfoPredicate) (Assets, error)

New walks through a directory recursively and renders each file as asset. Only those files are rendered that make all predicates true.

func (Assets) WriteFiles

func (as Assets) WriteFiles(path string) error

WriteFiles writes the assets to specified path.

type FileContentsPredicate

type FileContentsPredicate func(manifest []byte) (bool, error)

func BootstrapRequiredCRD

func BootstrapRequiredCRD() FileContentsPredicate

BootstrapRequiredCRD returns a predicate for LoadFilesRecursively that filters manifests based on whether they are marked as being required for bootstrap or not.

func ClusterProfile

func ClusterProfile(clusterProfile string) FileContentsPredicate

ClusterProfile returns a predicate for LoadFilesRecursively that filters manifests based on the specified FeatureSet.

func InstallerFeatureSet

func InstallerFeatureSet(featureSet string) FileContentsPredicate

InstallerFeatureSet returns a predicate for LoadFilesRecursively that filters manifests based on the specified FeatureSet.

type FileInfoPredicate

type FileInfoPredicate func(path string, info os.FileInfo) (bool, error)

type Permission

type Permission os.FileMode
const (
	PermissionDirectoryDefault Permission = 0755
	PermissionFileDefault      Permission = 0644
	PermissionFileRestricted   Permission = 0600
)

type RenderedManifest

type RenderedManifest struct {
	OriginalFilename string
	Content          []byte
	// contains filtered or unexported fields
}

func (*RenderedManifest) GetDecodedObj

func (c *RenderedManifest) GetDecodedObj() (runtime.Object, error)

type RenderedManifests

type RenderedManifests []RenderedManifest

func (RenderedManifests) GetManifest

func (renderedManifests RenderedManifests) GetManifest(gvk schema.GroupVersionKind, namespace, name string) (RenderedManifest, error)

func (RenderedManifests) GetObject

func (renderedManifests RenderedManifests) GetObject(gvk schema.GroupVersionKind, namespace, name string) (runtime.Object, error)

func (RenderedManifests) ListManifestOfType

func (renderedManifests RenderedManifests) ListManifestOfType(gvk schema.GroupVersionKind) []RenderedManifest

Jump to

Keyboard shortcuts

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