istio: istio.io/istio/operator/pkg/object Index | Files

package object

import "istio.io/istio/operator/pkg/object"

Package manifest provides functions for going between in-memory k8s objects (unstructured.Unstructured) and their JSON or YAML representations.

Index

Package Files

objects.go

Constants

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

func AllObjectHashes Uses

func AllObjectHashes(m string) map[string]bool

AllObjectHashes returns a map with object hashes of all the objects contained in cmm as the keys.

func DefaultObjectOrder Uses

func DefaultObjectOrder() func(o *K8sObject) int

DefaultObjectOrder is default sorting function used to sort k8s objects.

func FromHash Uses

func FromHash(hash string) (kind, namespace, name string)

FromHash parses kind, namespace and name from a hash.

func Hash Uses

func Hash(kind, namespace, name string) string

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

func HashNameKind Uses

func HashNameKind(kind, name string) string

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

func ParseK8SYAMLToIstioOperator Uses

func ParseK8SYAMLToIstioOperator(yml string) (*v1alpha1.IstioOperator, *schema.GroupVersionKind, error)

ParseK8SYAMLToIstioOperator parses a IstioOperator CustomResource YAML string and unmarshals in into an IstioOperatorSpec object. It returns the object and an API group/version with it.

type K8sObject Uses

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 Uses

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

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

func ParseJSONToK8sObject Uses

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

ParseJSONToK8sObject parses JSON to an K8sObject.

func ParseYAMLToK8sObject Uses

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

ParseYAMLToK8sObject parses YAML to an Object.

func (*K8sObject) Container Uses

func (o *K8sObject) Container(name string) map[string]interface{}

Container returns a container subtree for Deployment objects if one is found, or nil otherwise.

func (*K8sObject) Equal Uses

func (o *K8sObject) Equal(other *K8sObject) bool

Equal returns true if o and other are both valid and equal to each other.

func (*K8sObject) FullName Uses

func (o *K8sObject) FullName() string

FullName returns namespace/name of K8s object

func (*K8sObject) GroupVersionKind Uses

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

GroupVersionKind returns the GroupVersionKind for the K8sObject

func (*K8sObject) Hash Uses

func (o *K8sObject) Hash() string

Hash returns a unique hash for the K8sObject

func (*K8sObject) HashNameKind Uses

func (o *K8sObject) HashNameKind() string

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

func (*K8sObject) JSON Uses

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

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

func (*K8sObject) Unstructured Uses

func (o *K8sObject) Unstructured() map[string]interface{}

Unstructured exposes the raw object content, primarily for testing

func (*K8sObject) UnstructuredObject Uses

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

UnstructuredObject exposes the raw object, primarily for testing

func (*K8sObject) Valid Uses

func (o *K8sObject) Valid() bool

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

func (*K8sObject) Version Uses

func (o *K8sObject) Version() string

Version returns the APIVersion of the K8sObject

func (*K8sObject) YAML Uses

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

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

func (*K8sObject) YAMLDebugString Uses

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 Uses

type K8sObjects []*K8sObject

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

func KindObjects Uses

func KindObjects(objs K8sObjects, kind string) K8sObjects

KindObjects returns the subset of objs with the given kind.

func ObjectsNotInLists Uses

func ObjectsNotInLists(objects K8sObjects, lists ...K8sObjects) K8sObjects

func ParseK8sObjectsFromYAMLManifest Uses

func ParseK8sObjectsFromYAMLManifest(manifest string) (K8sObjects, error)

ParseK8sObjectsFromYAMLManifest returns a K8sObjects representation of manifest.

func ParseK8sObjectsFromYAMLManifestFailOption Uses

func ParseK8sObjectsFromYAMLManifestFailOption(manifest string, failOnError bool) (K8sObjects, error)

ParseK8sObjectsFromYAMLManifestFailOption returns a K8sObjects representation of manifest. Continues parsing when a bad object is found if failOnError is set to false.

func (K8sObjects) Keys Uses

func (os K8sObjects) Keys() []string

Keys returns a slice with the keys of os.

func (K8sObjects) Sort Uses

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) String Uses

func (os K8sObjects) String() string

String implements the Stringer interface.

func (K8sObjects) ToMap Uses

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

ToMap returns a map of K8sObject hash to K8sObject.

func (K8sObjects) ToNameKindMap Uses

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

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

func (K8sObjects) UnstructuredItems Uses

func (os K8sObjects) UnstructuredItems() []unstructured.Unstructured

UnstructuredItems returns the list of items of unstructured.Unstructured.

func (K8sObjects) YAMLManifest Uses

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

YAMLManifest returns a YAML representation of K8sObjects os.

Package object imports 15 packages (graph) and is imported by 7 packages. Updated 2020-10-29. Refresh now. Tools for package owners.