Documentation
¶
Index ¶
- func ExecuteTemplate(tpl string, data map[string]interface{}) (string, error)
- func ExecuteTemplates(ctx context.Context, path, suffix string, images map[string]string, ...) (map[string]string, error)
- func ExecuteYAML(ctx context.Context, fsys fs.FS, images map[string]string, ...) (map[string]string, error)
- func ImagesFromFS(ctx context.Context, fsys fs.FS) []string
- func OutputYAML(out io.Writer, files map[string]string)
- func Parse(pathname string, recursive bool) ([]unstructured.Unstructured, error)
- func ParseTemplates(path string, images map[string]string, cfg map[string]interface{}) (string, error)
- func ParseTemplatesFS(ctx context.Context, fsys fs.FS, images map[string]string, ...) (string, error)
- func UpdateChanged(src, tgt map[string]interface{}) bool
- func WithIstioPodAnnotations(cfg map[string]interface{})
- func WithIstioPodLabels(cfg map[string]interface{})
- type CfgFn
- type Manifest
- type YamlManifest
- func (f *YamlManifest) Apply(spec *unstructured.Unstructured) error
- func (f *YamlManifest) ApplyAll() error
- func (f *YamlManifest) DeepCopyResources() []unstructured.Unstructured
- func (f *YamlManifest) Delete(spec *unstructured.Unstructured) error
- func (f *YamlManifest) DeleteAll() error
- func (f *YamlManifest) Find(apiVersion string, kind string, name string) *unstructured.Unstructured
- func (f *YamlManifest) Get(spec *unstructured.Unstructured) (*unstructured.Unstructured, error)
- func (f *YamlManifest) References() []corev1.ObjectReference
- func (f *YamlManifest) ResourceNames() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteTemplate ¶
ExecuteTemplate instantiates the given template with data
func ExecuteTemplates ¶
func ExecuteTemplates(ctx context.Context, path, suffix string, images map[string]string, data map[string]interface{}) (map[string]string, error)
ExecuteTemplates executes a set of templates found at path, filtering on suffix. Executed into memory and returned.
func ExecuteYAML ¶
func ExecuteYAML(ctx context.Context, fsys fs.FS, images map[string]string, cfg map[string]interface{}) (map[string]string, error)
ExecuteYAML process the templates found in files named "*.yaml" and return the f.
func OutputYAML ¶
OutputYAML writes out each file contents to out after removing comments and blank lines. This also adds a YAML file separator "---" between each file. Files is a map of "filename" to "file contents".
func Parse ¶
func Parse(pathname string, recursive bool) ([]unstructured.Unstructured, error)
Parse parses YAML files into Unstructured objects.
It supports 5 cases today:
- pathname = path to a file --> parses that file.
- pathname = path to a directory, recursive = false --> parses all files in that directory.
- pathname = path to a directory, recursive = true --> parses all files in that directory and it's descendants
- pathname = url --> fetches the contents of that URL and parses them as YAML.
- pathname = combination of all previous cases, the string can contain multiple records (file, directory or url) separated by comma
func ParseTemplates ¶
func ParseTemplates(path string, images map[string]string, cfg map[string]interface{}) (string, error)
ParseTemplates walks through all the template yaml file in the given directory and produces instantiated yaml file in a temporary directory. Returns the name of the temporary directory. Deprecated: Use ParseTemplatesFS.
func ParseTemplatesFS ¶
func ParseTemplatesFS(ctx context.Context, fsys fs.FS, images map[string]string, cfg map[string]interface{}) (string, error)
ParseTemplatesFS walks through all the template yaml file in the given FS and produces instantiated yaml file in a temporary directory. Returns the name of the temporary directory.
func UpdateChanged ¶
We need to preserve the top-level target keys, specifically 'metadata.resourceVersion', 'spec.clusterIP', and any existing entries in a ConfigMap's 'data' field. So we only overwrite fields set in our src resource.
func WithIstioPodAnnotations ¶
func WithIstioPodAnnotations(cfg map[string]interface{})
func WithIstioPodLabels ¶
func WithIstioPodLabels(cfg map[string]interface{})
Types ¶
type CfgFn ¶
type CfgFn func(map[string]interface{})
CfgFn is the function signature of configuration mutation options.
func PodSecurityCfgFn ¶
PodSecurityCfgFn returns a function for configuring security context for Pod, depending on security settings of the enclosing namespace.
func WithAnnotations ¶
WithAnnotations returns a function for configuring annototations of the resource
func WithLabels ¶
WithLabels returns a function for configuring labels of the resource
func WithPodAnnotations ¶
WithPodAnnotations appends pod annotations (usually used by types where pod template is embedded)
func WithPodLabels ¶
WithPodLabels appends pod labels (usually used by types where pod template is embedded)
type Manifest ¶
type Manifest interface { // Either updates or creates all resources in the manifest ApplyAll() error // Updates or creates a particular resource Apply(*unstructured.Unstructured) error // Deletes all resources in the manifest DeleteAll() error // Deletes a particular resource Delete(spec *unstructured.Unstructured) error // Returns a deep copy of the matching resource read from the file Find(apiVersion string, kind string, name string) *unstructured.Unstructured // Returns the resource fetched from the api server, nil if not found Get(spec *unstructured.Unstructured) (*unstructured.Unstructured, error) // Returns a deep copy of all resources in the manifest DeepCopyResources() []unstructured.Unstructured // ResourceNames is a convenient list of all the resource names in the manifest ResourceNames() []string // References is a convenient list of all resources in the manifest as object references References() []corev1.ObjectReference }
func InstallYamlFS ¶
type YamlManifest ¶
type YamlManifest struct {
// contains filtered or unexported fields
}
func (*YamlManifest) Apply ¶
func (f *YamlManifest) Apply(spec *unstructured.Unstructured) error
func (*YamlManifest) ApplyAll ¶
func (f *YamlManifest) ApplyAll() error
func (*YamlManifest) DeepCopyResources ¶
func (f *YamlManifest) DeepCopyResources() []unstructured.Unstructured
func (*YamlManifest) Delete ¶
func (f *YamlManifest) Delete(spec *unstructured.Unstructured) error
func (*YamlManifest) DeleteAll ¶
func (f *YamlManifest) DeleteAll() error
func (*YamlManifest) Find ¶
func (f *YamlManifest) Find(apiVersion string, kind string, name string) *unstructured.Unstructured
func (*YamlManifest) Get ¶
func (f *YamlManifest) Get(spec *unstructured.Unstructured) (*unstructured.Unstructured, error)
func (*YamlManifest) References ¶
func (f *YamlManifest) References() []corev1.ObjectReference
func (*YamlManifest) ResourceNames ¶
func (f *YamlManifest) ResourceNames() []string