object

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: LGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// YAMLSeparator is a separator for multi-document YAML files.
	YAMLSeparator = "\n---\n"
)

Variables

This section is empty.

Functions

func GetCapabilities

capabilities builds a Capabilities from discovery information.

func GetDefaultValues

func GetDefaultValues(fs http.FileSystem) ([]byte, error)

func GetRequestedChart

func GetRequestedChart(chartPackage []byte) (*chart.Chart, error)

func GetVersionSet

GetVersionSet retrieves a set of available k8s API versions

func Hash

func Hash(kind, namespace, name string) string

Hash returns a unique, insecure hash based on kind, namespace and name.

func HashNameKind

func HashNameKind(kind, name string) string

HashNameKind returns a unique, insecure hash based on kind and name.

func InstallObjectOrder

func InstallObjectOrder() func(o *K8sObject) int

func LoadObjs

func LoadObjs(f io.Reader) ([]runtime.Object, error)

func RemoveNonYAMLLines

func RemoveNonYAMLLines(yms string) string

func UninstallObjectOrder

func UninstallObjectOrder() func(o *K8sObject) int

Types

type K8sObject

type K8sObject struct {
	Group     string
	Kind      string
	Name      string
	Namespace string
	// contains filtered or unexported fields
}

K8sObject is an in-memory representation of a k8s object, used for moving between different representations (Unstructured, JSON, YAML) with cached rendering.

func NewK8sObject

func NewK8sObject(u *unstructured.Unstructured, json, yaml []byte) *K8sObject

NewK8sObject creates a new K8sObject and returns a ptr to it.

func ParseJSONToK8sObject

func ParseJSONToK8sObject(json []byte) (*K8sObject, error)

ParseJSONToK8sObject parses JSON to an K8sObject.

func ParseYAMLToK8sObject

func ParseYAMLToK8sObject(yaml []byte) (*K8sObject, error)

ParseYAMLToK8sObject parses YAML to an Object.

func (*K8sObject) AddLabels

func (o *K8sObject) AddLabels(labels map[string]string)

AddLabels adds labels to the K8sObject. This method will override the value if there is already label with the same key.

func (*K8sObject) GroupKind

func (o *K8sObject) GroupKind() schema.GroupKind

GroupKind returns the GroupKind for the K8sObject

func (*K8sObject) GroupVersionKind

func (o *K8sObject) GroupVersionKind() schema.GroupVersionKind

GroupVersionKind returns the GroupVersionKind for the K8sObject

func (*K8sObject) Hash

func (o *K8sObject) Hash() string

Hash returns a unique hash for the K8sObject

func (*K8sObject) HashNameKind

func (o *K8sObject) HashNameKind() string

HashNameKind returns a hash for the K8sObject based on the name and kind only.

func (*K8sObject) JSON

func (o *K8sObject) JSON() ([]byte, error)

JSON returns a JSON representation of the K8sObject, using an internal cache.

func (*K8sObject) UnstructuredObject

func (o *K8sObject) UnstructuredObject() *unstructured.Unstructured

UnstructuredObject exposes the raw object, primarily for testing

func (*K8sObject) Valid

func (o *K8sObject) Valid() bool

Valid checks returns true if Kind and Name of K8sObject are both not empty.

func (*K8sObject) YAML

func (o *K8sObject) YAML() ([]byte, error)

YAML returns a YAML representation of the K8sObject, using an internal cache.

func (*K8sObject) YAMLDebugString

func (o *K8sObject) YAMLDebugString() string

YAMLDebugString returns a YAML representation of the K8sObject, or an error string if the K8sObject cannot be rendered to YAML.

type K8sObjects

type K8sObjects []*K8sObject

K8sObjects holds a collection of k8s objects, so that we can filter / sequence them

func K8sObjectsFromUnstructuredSlice

func K8sObjectsFromUnstructuredSlice(objs []*unstructured.Unstructured) (K8sObjects, error)

K8sObjectsFromUnstructuredSlice returns an Objects ptr type from a slice of Unstructured.

func ParseK8sObjectsFromYAMLManifest

func ParseK8sObjectsFromYAMLManifest(manifest string) (K8sObjects, error)

ParseK8sObjectsFromYAMLManifest returns a K8sObjects represetation of manifest.

func Render

func Render(fs http.FileSystem, rlsName, ns, chartName string, overrideValue string) (K8sObjects, error)

func RenderTemplate

func RenderTemplate(chartPackage []byte, rlsName, ns string, overrideValue string) (K8sObjects, error)

func (K8sObjects) JSONManifest

func (os K8sObjects) JSONManifest() (string, error)

JSONManifest returns a JSON representation of K8sObjects os.

func (K8sObjects) Sort

func (os K8sObjects) Sort(score func(o *K8sObject) int)

Sort will order the items in K8sObjects in order of score, group, kind, name. The intent is to have a deterministic ordering in which K8sObjects are applied.

func (K8sObjects) ToMap

func (os K8sObjects) ToMap() map[string]*K8sObject

ToMap returns a map of K8sObject hash to K8sObject.

func (K8sObjects) ToNameKindMap

func (os K8sObjects) ToNameKindMap() map[string]*K8sObject

ToNameKindMap returns a map of K8sObject name/kind hash to K8sObject.

func (K8sObjects) YAMLManifest

func (os K8sObjects) YAMLManifest() (string, error)

YAMLManifest returns a YAML representation of K8sObjects os.

Jump to

Keyboard shortcuts

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