manifest

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(pathname string, recursive bool) ([]unstructured.Unstructured, error)

Parse parses YAML files into Unstructured objects.

It supports 5 cases today:

  1. pathname = path to a file --> parses that file.
  2. pathname = path to a directory, recursive = false --> parses all files in that directory.
  3. pathname = path to a directory, recursive = true --> parses all files in that directory and it's descendants
  4. pathname = url --> fetches the contents of that URL and parses them as YAML.
  5. pathname = combination of all previous cases, the string can contain multiple records (file, directory or url) separated by comma

func UpdateChanged

func UpdateChanged(src, tgt map[string]interface{}) bool

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.

Types

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 NewYamlManifest

func NewYamlManifest(pathname string, recursive bool, client dynamic.Interface) (Manifest, error)

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 (*YamlManifest) References

func (f *YamlManifest) References() []corev1.ObjectReference

func (*YamlManifest) ResourceNames

func (f *YamlManifest) ResourceNames() []string

Jump to

Keyboard shortcuts

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