meta

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstanceLabels

func InstanceLabels(m Instance) map[string]string

Instance labels returns the app.kubernetes.io labels

func MergeObjectMeta

func MergeObjectMeta(src Instance, dest Instance)

func MutateMeta

func MutateMeta(o Meta, obj interfaces.Object) error

MutateMeta mutates an Object meta

func SetObjectMeta

func SetObjectMeta(src Instance, dest Instance)

TODO use Object interface and rename Merge ?

func SetObjectMetaFromInstance

func SetObjectMetaFromInstance(src Instance, dest Instance)

Types

type Instance

type Instance interface {
	Meta
	// The name of the application - app.kubernetes.io/name
	GetApplication() string
	SetApplication(string)
	// A unique name identifying the instance of an application - app.kubernetes.io/instance
	GetInstance() string
	SetInstance(string)
	// The current version of the application (e.g., a semantic version, revision hash, etc.) - app.kubernetes.io/version
	GetVersion() string
	SetVersion(string)
	// The component within the architecture -  app.kubernetes.io/component
	GetComponent() string
	SetComponent(string)
	//  The name of a higher level application this one is part of - app.kubernetes.io/part-of
	GetPartOf() string
	SetPartOf(string)
	// The tool being used to manage the operation of an application - app.kubernetes.io/managed-by
	GetManagedBy() string
	SetManagedBy(string)
}

TODO remove meta in interface, not needed Instance interface can work with the commons app.kubernetes.io labels - https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/#labels

type Meta

type Meta interface {
	GetLabels() map[string]string
	SetLabels(labels map[string]string)
	GetAnnotations() map[string]string
	SetAnnotations(annotations map[string]string)
	GetName() string
	SetName(string)
	GetNamespace() string
	SetNamespace(string)
}

Meta interface is a stripped down version of https://godoc.org/k8s.io/apimachinery/pkg/apis/meta/v1#Object with only user definied specs.

To mutates an object a type must implements this interface

type ObjectMeta

type ObjectMeta struct {
	// Name must be unique within a namespace. Is required when creating resources, although
	// some resources may allow a client to request the generation of an appropriate name
	// automatically. Name is primarily intended for creation idempotence and configuration
	// definition.
	// Cannot be updated.
	// More info: http://kubernetes.io/docs/user-guide/identifiers#names
	// +optional
	Name string `json:"name,omitempty"`

	// Namespace defines the space within each name must be unique. An empty namespace is
	// equivalent to the "default" namespace, but "default" is the canonical representation.
	// Not all objects are required to be scoped to a namespace - the value of this field for
	// those objects will be empty.
	//
	// Must be a DNS_LABEL.
	// Cannot be updated.
	// More info: http://kubernetes.io/docs/user-guide/namespaces
	// +optional
	Namespace string `json:"namespace,omitempty"`

	// Map of string keys and values that can be used to organize and categorize
	// (scope and select) objects. May match selectors of replication controllers
	// and services.
	// More info: http://kubernetes.io/docs/user-guide/labels
	// +optional
	Labels map[string]string `json:"labels,omitempty"`

	// Annotations is an unstructured key value map stored with a resource that may be
	// set by external tools to store and retrieve arbitrary metadata. They are not
	// queryable and should be preserved when modifying objects.
	// More info: http://kubernetes.io/docs/user-guide/annotations
	// +optional
	Annotations map[string]string `json:"annotations,omitempty"`
}

ObjectMeta meta is a stripped down version of the ObjectMeta type https://godoc.org/k8s.io/apimachinery/pkg/apis/meta/v1#ObjectMeta with only user defined specs

This type can be used in an application CRD ObjectMeta implements the Meta interface and can be used to mutates an object

+kubebuilder:object:generate=true

func (*ObjectMeta) DeepCopy

func (in *ObjectMeta) DeepCopy() *ObjectMeta

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectMeta.

func (*ObjectMeta) DeepCopyInto

func (in *ObjectMeta) DeepCopyInto(out *ObjectMeta)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ObjectMeta) GetAnnotations

func (c *ObjectMeta) GetAnnotations() map[string]string

GetAnnotations returns the Annotations labels

func (*ObjectMeta) GetApplication

func (c *ObjectMeta) GetApplication() string

GetApplication returns the ObjectMeta application name from the app.kubernetes.io/name label

func (*ObjectMeta) GetComponent

func (c *ObjectMeta) GetComponent() string

GetComponent returns the ObjectMeta application name from the app.kubernetes.io/component label

func (*ObjectMeta) GetInstance

func (c *ObjectMeta) GetInstance() string

GetInstance returns the ObjectMeta application name from the app.kubernetes.io/instance label

func (*ObjectMeta) GetLabels

func (c *ObjectMeta) GetLabels() map[string]string

GetLabels returns the ObjectMeta labels

func (*ObjectMeta) GetManagedBy

func (c *ObjectMeta) GetManagedBy() string

GetManagedBy returns the ObjectMeta application name from the app.kubernetes.io/managed-by label

func (*ObjectMeta) GetName

func (o *ObjectMeta) GetName() string

GetName returns the ObjectMeta name

func (*ObjectMeta) GetNamespace

func (o *ObjectMeta) GetNamespace() string

GetNamespace returns the ObjectMeta namespace

func (*ObjectMeta) GetPartOf

func (c *ObjectMeta) GetPartOf() string

GetPartOf returns the ObjectMeta application name from the app.kubernetes.io/part-of label

func (*ObjectMeta) GetVersion

func (c *ObjectMeta) GetVersion() string

GetVersion returns the ObjectMeta application name from the app.kubernetes.io/version label

func (*ObjectMeta) SetAnnotations

func (c *ObjectMeta) SetAnnotations(annotations map[string]string)

SetAnnotations sets the ObjectMeta annotations

func (*ObjectMeta) SetApplication

func (c *ObjectMeta) SetApplication(s string)

SetApplication sets the ObjectMeta application name from the app.kubernetes.io/name label

func (*ObjectMeta) SetComponent

func (c *ObjectMeta) SetComponent(s string)

func (*ObjectMeta) SetInstance

func (c *ObjectMeta) SetInstance(s string)

func (*ObjectMeta) SetLabels

func (c *ObjectMeta) SetLabels(labels map[string]string)

SetLabels sets the ObjectMeta labels

func (*ObjectMeta) SetManagedBy

func (c *ObjectMeta) SetManagedBy(s string)

func (*ObjectMeta) SetName

func (o *ObjectMeta) SetName(name string)

SetName sets the ObjectMeta name

func (*ObjectMeta) SetNamespace

func (o *ObjectMeta) SetNamespace(namespace string)

SetNamespace sets the ObjectMeta namespace

func (*ObjectMeta) SetPartOf

func (c *ObjectMeta) SetPartOf(s string)

func (*ObjectMeta) SetVersion

func (c *ObjectMeta) SetVersion(s string)

Jump to

Keyboard shortcuts

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