Documentation ¶
Overview ¶
Copyright 2017 The kubecfg authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 Pelotech - Apache License, Version 2.0.
- Adaptation for latest go-jsonnet and goembed
- Adds HTTP caching
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeUniversalImporter ¶
Types ¶
type BuildOutput ¶
type BuildOutput struct {
// contains filtered or unexported fields
}
BuildOutput contains the output from a build operation.
func (*BuildOutput) SHA1Sum ¶
func (b *BuildOutput) SHA1Sum() (string, error)
SHA1Sum returns the SHA1 sum of the YAML stream for this build output. The checksum is cached internally, so changes to this output will not affect the produced value from the first call.
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
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)