jsonnet

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package jsonnet contains the builder interface for rendering the jsonnet in a Konfiguration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeUniversalImporter

func MakeUniversalImporter(log logr.Logger, searchURLs []*url.URL, cacheDir string) jsonnet.Importer

MakeUniversalImporter returns an importer that can handle filepaths, HTTP urls, and internal paths.

func NewHTTPCache

func NewHTTPCache(log logr.Logger, t *http.Transport, cacheDir string) *httpCache

NewHTTPCache creates a new http cache using the given transport and cache directory.

Types

type BuildOutput

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

BuildOutput contains the output from a build operation.

func (*BuildOutput) SortedObjects

func (b *BuildOutput) SortedObjects() []*unstructured.Unstructured

SortedObjects returns a sorted list of objects in this output. Objects are sorted in the following order: - Namespaces (alphabetically) - CustomResourceDefinitions (alphabetically) - Resource namespaced names (alphabetically)

func (*BuildOutput) YAMLStream

func (b *BuildOutput) YAMLStream() ([]byte, error)

YAMLStream produces a yaml stream of the objects in this build output. The stream is cached internally so modifications to this output will not affect the produced stream from the first call.

type Builder

type Builder interface {
	// Build will render the jsonnet at the given path using the configurations in the supplied konfig.
	// The restMapper is used to determine if objects are registered with the target API and their
	// cluster scope. A nil restMapper can be provided to skip this process.
	Build(ctx context.Context, restMapper meta.RESTMapper, path string) (*BuildOutput, error)

	// Evaluate will evaluate the jsonnet code at the given path, and produce it's raw output.
	// This method is really only exposed for testing. The Build() method runs this first before
	// walking and building an output of unstructured objects.
	Evaluate(path string) (string, error)
}

Builder is the main interface for rendering jsonnet to Kubernetes manifests.

func NewBuilder

func NewBuilder(konfig *konfigurationv1.Konfiguration, workdir, cacheDir string) (Builder, error)

NewBuilder constructs a jsonnet builder according to the konfiguration. Assets fetched over HTTP will be cached to the cacheDir.

type ObjectSorter

type ObjectSorter []*unstructured.Unstructured

ObjectSorter is a list of unstructured objects that satisfies the Sort interface.

func (ObjectSorter) Len

func (o ObjectSorter) Len() int

func (ObjectSorter) Less

func (o ObjectSorter) Less(i, j int) bool

func (ObjectSorter) Swap

func (o ObjectSorter) Swap(i, j int)

Jump to

Keyboard shortcuts

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