readers

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(res any) kio.Reader

New returns a resource node reader or nil if the input is not recognized.

func NewJsonnetReader

func NewJsonnetReader(js *konjurev1beta2.Jsonnet) kio.Reader

Types

type Executor

type Executor func(cmd *exec.Cmd) ([]byte, error)

Executor is function that returns the output of a command.

type FileReader

type FileReader struct {
	konjurev1beta2.File

	// Flag indicating we are allowed to recurse into directories.
	Recurse bool
	// Function used to determine an absolute path.
	Abs func(path string) (string, error)
}

func (*FileReader) Read

func (r *FileReader) Read() ([]*yaml.RNode, error)

type Filter

type Filter struct {
	// The number of iterations to perform when expanding Konjure resources.
	Depth int
	// Configuration options for the readers.
	ReaderOptions []Option
}

Filter is a KYAML Filter that maps Konjure resource specifications to KYAML Readers, then reads and flattens the resulting RNodes into the final result. Due to the recursive nature of this filter, the depth (number of allowed recursive iterations) must be specified; the default value of 0 is effectively a no-op.

func (*Filter) Filter

func (f *Filter) Filter(nodes []*yaml.RNode) ([]*yaml.RNode, error)

Filter expands all the Konjure resources using the configured executors.

type GitReader

type GitReader struct {
	konjurev1beta2.Git
	// contains filtered or unexported fields
}

func (*GitReader) Clean

func (r *GitReader) Clean() error

func (*GitReader) Read

func (r *GitReader) Read() ([]*yaml.RNode, error)

type HTTPReader

type HTTPReader struct {
	konjurev1beta2.HTTP
	Client *http.Client
}

func (*HTTPReader) Read

func (r *HTTPReader) Read() ([]*yaml.RNode, error)

type HelmReader added in v0.3.3

type HelmReader struct {
	konjurev1beta2.Helm
	Runtime

	// The path to the Helm repository cache. Corresponds to the `helm --repository-cache` option.
	RepositoryCache string
}

func (*HelmReader) Read added in v0.3.3

func (helm *HelmReader) Read() ([]*yaml.RNode, error)

type JsonnetReader

type JsonnetReader struct {
	JsonnetBundlerPackageHome string
	FileImporter              jsonnet.FileImporter
	MakeVM                    func() *jsonnet.VM
	Filename                  string
	Snippet                   string
}

func (*JsonnetReader) Import

func (r *JsonnetReader) Import(importedFrom, importedPath string) (jsonnet.Contents, string, error)

func (*JsonnetReader) Read

func (r *JsonnetReader) Read() ([]*yaml.RNode, error)

type KubernetesReader added in v0.3.3

type KubernetesReader struct {
	konjurev1beta2.Kubernetes
	Runtime

	// Override the default path to the kubeconfig file.
	Kubeconfig string
	// Override the default kubeconfig context.
	Context string
	// The list of default types to use if none are specified.
	DefaultTypes []string
}

func (*KubernetesReader) Read added in v0.3.3

func (k *KubernetesReader) Read() ([]*yaml.RNode, error)

type KustomizeReader added in v0.3.3

type KustomizeReader struct {
	konjurev1beta2.Kustomize
	Runtime
}

func (*KustomizeReader) Read added in v0.3.3

func (kustomize *KustomizeReader) Read() ([]*yaml.RNode, error)

type Option

type Option func(src *yaml.RNode, r kio.Reader) kio.Reader

Option is used to configure or decorate a reader.

func WithDefaultInputStream

func WithDefaultInputStream(defaultReader io.Reader) Option

WithDefaultInputStream overrides the default input stream of stdin.

func WithDefaultTypes added in v0.4.1

func WithDefaultTypes(types ...string) Option

WithDefaultTypes controls the default types to fetch when none are specified.

func WithKubeconfig added in v0.3.3

func WithKubeconfig(kubeconfig string) Option

WithKubeconfig controls the default path of the kubeconfig file.

func WithKubectlExecutor added in v0.3.3

func WithKubectlExecutor(executor Executor) Option

WithKubectlExecutor controls the alternate executor for kubectl.

func WithKustomizeExecutor added in v0.3.3

func WithKustomizeExecutor(executor Executor) Option

WithKustomizeExecutor controls the alternate executor for kustomize.

func WithRecursiveDirectories

func WithRecursiveDirectories(recurse bool) Option

WithRecursiveDirectories controls the behavior for traversing directories.

func WithWorkingDirectory

func WithWorkingDirectory(dir string) Option

WithWorkingDirectory sets the base directory to resolve relative paths against.

func WithoutKindExpansion added in v0.4.7

func WithoutKindExpansion(kinds ...string) Option

WithoutKindExpansion disables specific Konjure kinds from being expanded.

type ResourceReader

type ResourceReader struct {
	// The list of resource specifications to generate Konjure resources from.
	konjurev1beta2.Resource
	// The byte stream of (possibly non-Konjure) resources to read give the
	// resource specification of "-". Defaults to `os.Stdin`.
	Reader io.Reader
}

ResourceReader generates Konjure resource nodes by parsing the configured resource specifications.

func (*ResourceReader) Read

func (r *ResourceReader) Read() ([]*yaml.RNode, error)

Read produces parses resource specifications and returns resource nodes.

type Runtime added in v0.3.3

type Runtime struct {
	// Bin can be configured to override the default path to the binary.
	Bin string
	// Executor can be set to change how the command is executed. If left `nil`,
	// commands will execute via their `Cmd.Output` function.
	Executor Executor
}

Runtime contains the base configuration for creating `exec.Cmd` instances.

type SecretReader

type SecretReader struct {
	konjurev1beta2.Secret
}

func (*SecretReader) Read

func (r *SecretReader) Read() ([]*yaml.RNode, error)

Jump to

Keyboard shortcuts

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