render

package
v0.0.0-...-7736bfe Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 12 Imported by: 7

README

Template rendering

The operator will render all files in a directory that end with ".json" or ".yaml". The files will be passed through the Go templating engine.

The aim is to mimic the parsing behavior of kubectl create -f <dir> as much as reasonably possible.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderDir

func RenderDir(manifestDir string, d *RenderData) ([]*unstructured.Unstructured, error)

RenderDir will render all manifests in a directory, descending in to subdirectories It will perform template substitutions based on the data supplied by the RenderData

func RenderDirs

func RenderDirs(manifestDirs []string, d *RenderData) ([]*unstructured.Unstructured, error)

RenderDirs renders multiple directories, but sorts the discovered files *globally* first. In other words, if you have the structure - a/001.yaml - a/003.yaml - b/002.yaml It will still render 001, 002, and 003 in order.

func RenderTemplate

func RenderTemplate(path string, d *RenderData) ([]*unstructured.Unstructured, error)

RenderTemplate reads, renders, and attempts to parse a yaml or json file representing one or more k8s api objects

Types

type RenderData

type RenderData struct {
	Funcs template.FuncMap
	Data  map[string]interface{}
}

func MakeRenderData

func MakeRenderData() RenderData

Jump to

Keyboard shortcuts

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