konjure

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: Apache-2.0 Imports: 21 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReader

func NewReader(obj interface{}) kio.Reader

NewReader returns a KYAML reader for an individual Konjure resource specification. If the object is not recognized, the resulting reader will silently generate nothing.

Types

type EnvWriter

type EnvWriter struct {
	Writer   io.Writer
	Unset    bool
	Shell    string
	Selector string
}

EnvWriter is a writer which only emits name/value pairs found in the data of config maps and secrets.

func (*EnvWriter) Write

func (w *EnvWriter) Write(nodes []*yaml.RNode) error

Write outputs the data pairings from the supplied list of resource nodes.

type Filter

type Filter struct {
	// The number of times to recursively filter the resource list.
	Depth int
	// The default reader to use, defaults to stdin.
	DefaultReader io.Reader
	// Filter to determine which resources are retained.
	filters.ResourceMetaFilter
	// Flag indicating that status fields should not be stripped.
	KeepStatus bool
	// Flag indicating that comments should not be stripped.
	KeepComments bool
	// Flag indicating that output should be formatted.
	Format bool
	// The explicit working directory used to resolve relative paths.
	WorkingDirectory string
	// Flag indicating we can process directories recursively.
	RecursiveDirectories bool
	// Override the default path to the kubeconfig file.
	Kubeconfig string
	// Override the default Kubectl executor.
	KubectlExecutor func(cmd *exec.Cmd) ([]byte, error)
	// Override the default Kustomize executor.
	KustomizeExecutor func(cmd *exec.Cmd) ([]byte, error)
}

Filter replaces Konjure resources with the expanded resources they represent.

func (*Filter) Filter

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

Filter evaluates Konjure resources according to the filter configuration.

type GroupWriter added in v0.3.3

type GroupWriter struct {
	GroupNode   func(node *yaml.RNode) (group string, ordinal string, err error)
	GroupWriter func(name string) (io.Writer, error)

	KeepReaderAnnotations     bool
	ClearAnnotations          []string
	Sort                      bool
	RestoreVerticalWhiteSpace bool
}

GroupWriter writes nodes based on a functional grouping definition.

func (*GroupWriter) Write added in v0.3.3

func (w *GroupWriter) Write(nodes []*yaml.RNode) error

Write sends all the output on the files back to where it came from.

type JSONWriter added in v0.3.2

type JSONWriter struct {
	Writer                io.Writer
	KeepReaderAnnotations bool
	ClearAnnotations      []string
	WrappingKind          string
	WrappingAPIVersion    string
	Sort                  bool
}

JSONWriter is a writer which emits JSON instead of YAML. This is useful if you like `jq`.

func (*JSONWriter) Write added in v0.3.2

func (w *JSONWriter) Write(nodes []*yaml.RNode) error

Write encodes each node as a single line of JSON.

type Resource

type Resource struct {
	Resource   *konjurev1beta2.Resource   `json:"resource,omitempty" yaml:"resource,omitempty"`
	Helm       *konjurev1beta2.Helm       `json:"helm,omitempty" yaml:"helm,omitempty"`
	Jsonnet    *konjurev1beta2.Jsonnet    `json:"jsonnet,omitempty" yaml:"jsonnet,omitempty"`
	Kubernetes *konjurev1beta2.Kubernetes `json:"kubernetes,omitempty" yaml:"kubernetes,omitempty"`
	Kustomize  *konjurev1beta2.Kustomize  `json:"kustomize,omitempty" yaml:"kustomize,omitempty"`
	Secret     *konjurev1beta2.Secret     `json:"secret,omitempty" yaml:"secret,omitempty"`
	Git        *konjurev1beta2.Git        `json:"git,omitempty" yaml:"git,omitempty"`
	HTTP       *konjurev1beta2.HTTP       `json:"http,omitempty" yaml:"http,omitempty"`
	File       *konjurev1beta2.File       `json:"file,omitempty" yaml:"file,omitempty"`
	// contains filtered or unexported fields
}

Resource is a Konjure resource. This type may be used to collect Konjure resource specifications: either by URL-like string or by specifying the structured form of a resource. Only one of the pointers may be non-nil at a time.

func NewResource

func NewResource(arg ...string) Resource

NewResource returns a resource for parsing the supplied resource specifications. This is a convenience function for abstracting away gratuitous use of the word "resource".

func (*Resource) DeepCopyInto

func (r *Resource) DeepCopyInto(rout *Resource)

DeepCopyInto is meant to allow Resource to be used with code generated by Kubernetes controller-gen. It is not a true deep copy, it will only copy the destination of the non-nil pointers.

func (*Resource) MarshalJSON

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

MarshalJSON produces JSON for this Konjure resource. If it was initially read from a string, the string representation is used, however changes made to the object will not be reflected.

func (*Resource) Read added in v0.3.2

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

Read returns a KYAML resource nodes representing this Konjure resource.

func (*Resource) UnmarshalJSON

func (r *Resource) UnmarshalJSON(bytes []byte) error

UnmarshalJSON allows a Konjure resource to be represented by a plain URL-like string or a typed structure.

type Resources

type Resources []Resource

Resources is a list of Konjure resources, it can be used as a KYAML Reader to obtain YAML representations of the Konjure resources.

func (Resources) Read

func (rs Resources) Read() ([]*yaml.RNode, error)

Read returns the RNode representations of the Konjure resources.

type TemplateWriter added in v0.3.3

type TemplateWriter struct {
	Writer             io.Writer
	Template           string
	Functions          template.FuncMap
	WrappingKind       string
	WrappingAPIVersion string
}

TemplateWriter is a writer which emits each resource evaluated using a configured Go template.

func (*TemplateWriter) Write added in v0.3.3

func (w *TemplateWriter) Write(nodes []*yaml.RNode) error

Write evaluates the template using each resource.

type Writer

type Writer struct {
	// The desired format.
	Format string
	// The output stream to write to.
	Writer io.Writer
	// Flag to keep the intermediate annotations introduced during reading.
	KeepReaderAnnotations bool
	// List of additional annotations to clear.
	ClearAnnotations []string
	// Flag indicating nodes should be sorted before writing.
	Sort bool
	// Flag indicating we should attempt to restore vertical white space using
	// line numbers prior to writing.
	RestoreVerticalWhiteSpace bool
}

Writer is a multi-format writer for emitting resource nodes.

func (*Writer) Write

func (w *Writer) Write(nodes []*yaml.RNode) error

Write delegates to the format specific writer.

Jump to

Keyboard shortcuts

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