Documentation ¶
Index ¶
- Constants
- func Clientset() *clientset
- func ConfigMap(namespace, name string) *configmap
- func CreateUnstructuredFromJson(document string) (*unstructured.Unstructured, error)
- func CreateUnstructuredFromYaml(document string) (*unstructured.Unstructured, error)
- func CreateUnstructuredFromYamlBytes(raw []byte) (*unstructured.Unstructured, error)
- func Dynamic() *dynamic
- func GetOSAndKernelVersion() (string, error)
- func GetServerVersion() (*version.Info, error)
- func GroupVersionResourceFromGVK(unstructured *unstructured.Unstructured) (gvr schema.GroupVersionResource)
- func IsCASTemplate(given *unstructured.Unstructured) bool
- func IsNameUnVersioned(given *unstructured.Unstructured) bool
- func IsNameVersioned(given *unstructured.Unstructured) bool
- func IsNamespaceScoped(given *unstructured.Unstructured) bool
- func IsRunTask(given *unstructured.Unstructured) bool
- func Namespace() *namespace
- func Node() *node
- func NumberOfNodes() (int, error)
- func Resource(gvr schema.GroupVersionResource, namespace string) *resource
- type ClientsetGetter
- type ConfigGetter
- type ConfigGetters
- type ConfigMapGetter
- type Delete
- func (r Delete) Create(obj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
- func (d *Delete) Delete(obj *unstructured.Unstructured, subresources ...string) error
- func (r Delete) Get(name string, opts metav1.GetOptions, subresources ...string) (u *unstructured.Unstructured, err error)
- func (r Delete) List(opts metav1.ListOptions) (u *unstructured.UnstructuredList, err error)
- func (r Delete) String() string
- func (r Delete) Update(oldobj, newobj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
- type DynamicProvider
- type Get
- func (r Get) Create(obj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
- func (r Get) Delete(obj *unstructured.Unstructured, subresources ...string) error
- func (g *Get) Get(name string, opts metav1.GetOptions, subresources ...string) (u *unstructured.Unstructured, err error)
- func (r Get) List(opts metav1.ListOptions) (u *unstructured.UnstructuredList, err error)
- func (r Get) String() string
- func (r Get) Update(oldobj, newobj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
- type List
- func (r List) Create(obj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
- func (r List) Delete(obj *unstructured.Unstructured, subresources ...string) error
- func (r List) Get(name string, opts metav1.GetOptions, subresources ...string) (u *unstructured.Unstructured, err error)
- func (l *List) List(options metav1.ListOptions) (u *unstructured.UnstructuredList, err error)
- func (r List) String() string
- func (r List) Update(oldobj, newobj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
- type NamespaceGetter
- type NamespaceLister
- type NodeGetter
- type NodeLister
- type ResourceApplier
- type ResourceCreateOrUpdater
- func (r *ResourceCreateOrUpdater) Apply(obj *unstructured.Unstructured, subresources ...string) (resource *unstructured.Unstructured, err error)
- func (r ResourceCreateOrUpdater) Create(obj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
- func (r ResourceCreateOrUpdater) Delete(obj *unstructured.Unstructured, subresources ...string) error
- func (r ResourceCreateOrUpdater) Get(name string, opts metav1.GetOptions, subresources ...string) (u *unstructured.Unstructured, err error)
- func (r ResourceCreateOrUpdater) List(opts metav1.ListOptions) (u *unstructured.UnstructuredList, err error)
- func (r *ResourceCreateOrUpdater) String() string
- func (r ResourceCreateOrUpdater) Update(oldobj, newobj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
- type ResourceCreateOrUpdaterOption
- type ResourceCreator
- type ResourceDeleteOptions
- type ResourceDeleter
- type ResourceGetOptions
- type ResourceGetter
- type ResourceListOptions
- type ResourceLister
- type ResourceUpdater
- type UnstructedList
- func (u UnstructedList) Map(m UnstructuredMiddleware, p ...UnstructuredPredicate) (ul UnstructedList)
- func (u UnstructedList) MapAll(m []UnstructuredMiddleware, p ...UnstructuredPredicate) (ul UnstructedList)
- func (u UnstructedList) MapAllIfAny(m []UnstructuredMiddleware, p ...UnstructuredPredicate) (ul UnstructedList)
- type UnstructuredCreator
- type UnstructuredMiddleware
- func AddKubeServerVersionToLabels(override bool) UnstructuredMiddleware
- func AddNameToLabels(key string, override bool) UnstructuredMiddleware
- func SuffixNameWithVersion() UnstructuredMiddleware
- func SuffixSliceWithVersionAtPath(o []interface{}, path string) UnstructuredMiddleware
- func SuffixStringSliceWithVersionAtPath(s []string, path string) UnstructuredMiddleware
- func SuffixStringWithVersionAtPath(s, path string) UnstructuredMiddleware
- func SuffixWithVersionAtPath(path string) UnstructuredMiddleware
- func UnstructuredMap(m UnstructuredMiddleware, p ...UnstructuredPredicate) UnstructuredMiddleware
- func UnstructuredMapAll(m []UnstructuredMiddleware, p ...UnstructuredPredicate) UnstructuredMiddleware
- func UnstructuredMapAllIfAny(m []UnstructuredMiddleware, p ...UnstructuredPredicate) UnstructuredMiddleware
- func UnstructuredMapIfAny(m UnstructuredMiddleware, p ...UnstructuredPredicate) UnstructuredMiddleware
- func UpdateLabels(l map[string]string, override bool) UnstructuredMiddleware
- func UpdateNamespace(n string) UnstructuredMiddleware
- type UnstructuredPredicate
- type UnstructuredPredicateList
- type WithBytesUnstructuredCreator
Constants ¶
const ( // K8sMasterIPEnvironmentKey is the environment variable key used to // determine the kubernetes master IP address K8sMasterIPEnvironmentKey menv.ENVKey = "OPENEBS_IO_K8S_MASTER" // KubeConfigEnvironmentKey is the environment variable key used to // determine the kubernetes config KubeConfigEnvironmentKey menv.ENVKey = "OPENEBS_IO_KUBE_CONFIG" )
Variables ¶
This section is empty.
Functions ¶
func ConfigMap ¶
func ConfigMap(namespace, name string) *configmap
ConfigMap returns a new instance of configmap
func CreateUnstructuredFromJson ¶
func CreateUnstructuredFromJson(document string) (*unstructured.Unstructured, error)
CreateUnstructuredFromJson creates an unstructured instance from the provided JSON document
func CreateUnstructuredFromYaml ¶
func CreateUnstructuredFromYaml(document string) (*unstructured.Unstructured, error)
CreateUnstructuredFromYaml creates an unstructured instance from the provided YAML document
func CreateUnstructuredFromYamlBytes ¶
func CreateUnstructuredFromYamlBytes(raw []byte) (*unstructured.Unstructured, error)
CreateUnstructuredFromYamlBytes creates an unstructured instance from the provided YAML document in bytes
NOTE:
This is an implementation of WithBytesUnstructuredCreator
func GetOSAndKernelVersion ¶
GetOSAndKernelVersion gets us the OS,Kernel version
func GetServerVersion ¶
GetServerVersion uses the client-go Discovery client to get the kubernetes version struct
func GroupVersionResourceFromGVK ¶
func GroupVersionResourceFromGVK(unstructured *unstructured.Unstructured) (gvr schema.GroupVersionResource)
GroupVersionResourceFromGVK returns the GroupVersionResource of the provided unstructured instance by making use of this instance's GroupVersionKind info
NOTE:
Resource is assumed as plural of Kind
func IsCASTemplate ¶
func IsCASTemplate(given *unstructured.Unstructured) bool
IsCASTemplate flags if the given unstructured instance is a CASTemplate scoped
NOTE:
This is a UnstructuredPredicate implementation
func IsNameUnVersioned ¶
func IsNameUnVersioned(given *unstructured.Unstructured) bool
IsNameUnVersioned flags if the given unstructured instance name has version as its suffix
NOTE:
This is a UnstructuredPredicate implementation
func IsNameVersioned ¶
func IsNameVersioned(given *unstructured.Unstructured) bool
IsNameVersioned flags if the given unstructured instance name does not have version as its suffix
NOTE:
This is a UnstructuredPredicate implementation
func IsNamespaceScoped ¶
func IsNamespaceScoped(given *unstructured.Unstructured) bool
IsNamespaceScoped flags if the given unstructured instance is namespace scoped
NOTE:
This is a UnstructuredPredicate implementation
func IsRunTask ¶
func IsRunTask(given *unstructured.Unstructured) bool
IsRunTask flags if the given unstructured instance is a RunTask scoped
NOTE:
This is a UnstructuredPredicate implementation
func NumberOfNodes ¶
NumberOfNodes returns the number of nodes registered in a Kubernetes cluster
func Resource ¶
func Resource(gvr schema.GroupVersionResource, namespace string) *resource
Resource returns a new resource instance
Types ¶
type ClientsetGetter ¶
type ClientsetGetter interface {
Get() (*kubernetes.Clientset, error)
}
ClientsetGetter abstracts fetching of kubernetes clientset
type ConfigGetter ¶
ConfigGetter abstracts fetching of kubernetes client config
func Config ¶
func Config() ConfigGetter
Config provides appropriate config getter instances that help in fetching kubernetes client config to invoke kubernetes API calls
type ConfigGetters ¶
type ConfigGetters []ConfigGetter
ConfigGetters holds a list of ConfigGetter instances
NOTE:
This is an implementation of ConfigGetter
func (ConfigGetters) Get ¶
func (c ConfigGetters) Get() (config *rest.Config, err error)
Get fetches the kubernetes client config that is used to make kubernetes API calls. It makes use of its list of getter instances to fetch kubernetes config.
func (ConfigGetters) Name ¶
func (c ConfigGetters) Name() string
Name returns the name of this config getter instance
type ConfigMapGetter ¶
type ConfigMapGetter interface {
Get(options metav1.GetOptions) (*corev1.ConfigMap, error)
}
ConfigMapGetter abstracts fetching of ConfigMap instance from kubernetes cluster
type Delete ¶
type Delete struct {
// contains filtered or unexported fields
}
Delete is a resource that is suitable to be executed as a Delete operation
func DeleteResource ¶
func DeleteResource(gvr schema.GroupVersionResource, namespace string) *Delete
DeleteResource returns a new instance of delete resource
func (Delete) Create ¶
func (r Delete) Create(obj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
Create creates a new resource in kubernetes cluster
func (*Delete) Delete ¶
func (d *Delete) Delete(obj *unstructured.Unstructured, subresources ...string) error
Delete deletes a resource from a kubernetes cluster
func (Delete) Get ¶
func (r Delete) Get(name string, opts metav1.GetOptions, subresources ...string) (u *unstructured.Unstructured, err error)
Get returns a specific resource from kubernetes cluster
func (Delete) List ¶
func (r Delete) List(opts metav1.ListOptions) (u *unstructured.UnstructuredList, err error)
List returns a list of specific resource at kubernetes cluster
func (Delete) Update ¶
func (r Delete) Update(oldobj, newobj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
Update updates the resource at kubernetes cluster
type DynamicProvider ¶
type DynamicProvider interface {
Provide() (k8sdynamic.Interface, error)
}
DynamicProvider abstracts providing kubernetes dynamic client interface
type Get ¶
type Get struct {
// contains filtered or unexported fields
}
Get is resource that is suitable to be executed as Get operation
func GetResource ¶
func GetResource(gvr schema.GroupVersionResource, namespace string) *Get
GetResource returns a new instance of get resource
func (Get) Create ¶
func (r Get) Create(obj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
Create creates a new resource in kubernetes cluster
func (Get) Delete ¶
func (r Get) Delete(obj *unstructured.Unstructured, subresources ...string) error
Delete deletes a existing resource in kubernetes cluster
func (*Get) Get ¶
func (g *Get) Get(name string, opts metav1.GetOptions, subresources ...string) (u *unstructured.Unstructured, err error)
Get gets a resource from a kubernetes cluster
func (Get) List ¶
func (r Get) List(opts metav1.ListOptions) (u *unstructured.UnstructuredList, err error)
List returns a list of specific resource at kubernetes cluster
func (Get) Update ¶
func (r Get) Update(oldobj, newobj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
Update updates the resource at kubernetes cluster
type List ¶
type List struct {
// contains filtered or unexported fields
}
List is a resource resource that is suitable to be executed as a List operation
func ListResource ¶
func ListResource(gvr schema.GroupVersionResource, namespace string) *List
ListResource returns a new instance of list resource
func (List) Create ¶
func (r List) Create(obj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
Create creates a new resource in kubernetes cluster
func (List) Delete ¶
func (r List) Delete(obj *unstructured.Unstructured, subresources ...string) error
Delete deletes a existing resource in kubernetes cluster
func (List) Get ¶
func (r List) Get(name string, opts metav1.GetOptions, subresources ...string) (u *unstructured.Unstructured, err error)
Get returns a specific resource from kubernetes cluster
func (*List) List ¶
func (l *List) List(options metav1.ListOptions) (u *unstructured.UnstructuredList, err error)
List lists a resource from a kubernetes cluster
func (List) Update ¶
func (r List) Update(oldobj, newobj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
Update updates the resource at kubernetes cluster
type NamespaceGetter ¶
type NamespaceGetter interface {
Get(name string, options metav1.GetOptions) (*corev1.Namespace, error)
}
Namespacegetter abstracts fetching of Namespace from kubernetes cluster
type NamespaceLister ¶
type NamespaceLister interface {
List(options metav1.ListOptions) (*corev1.NamespaceList, error)
}
NamespaceLister abstracts fetching of a list of namespaces from kubernetes cluster
type NodeGetter ¶
NodeGetter abstracts fetching of Node details from kubernetes cluster
type NodeLister ¶
type NodeLister interface {
List(options metav1.ListOptions) (*corev1.NodeList, error)
}
NodeLister abstracts fetching of Nodes from kubernetes cluster
type ResourceApplier ¶
type ResourceApplier interface {
Apply(obj *unstructured.Unstructured, subresources ...string) (*unstructured.Unstructured, error)
}
ResourceApplier abstracts applying an unstructured instance that may or may not be available in kubernetes cluster
type ResourceCreateOrUpdater ¶
type ResourceCreateOrUpdater struct { // Various executors required to perform Apply // This is how this instance decouples its dependencies Getter ResourceGetter Creator ResourceCreator Updater ResourceUpdater // IsSkipUpdate will not update this resource if set to true. // In other words, enabling this flag can only create the // resource in the cluster if not created previously IsSkipUpdate bool // contains filtered or unexported fields }
ResourceCreateOrUpdater as the name suggests manages to either create or update a given resource. It does so by implementing ResourceApplier interface
func NewResourceCreateOrUpdater ¶
func NewResourceCreateOrUpdater( gvr schema.GroupVersionResource, namespace string, options ...ResourceCreateOrUpdaterOption, ) *ResourceCreateOrUpdater
NewResourceCreateOrUpdater returns a new instance of ResourceCreateOrUpdater
func (*ResourceCreateOrUpdater) Apply ¶
func (r *ResourceCreateOrUpdater) Apply( obj *unstructured.Unstructured, subresources ...string, ) (resource *unstructured.Unstructured, err error)
Apply applies a resource to the kubernetes cluster. In other words, it creates a new resource if it does not exist or updates the existing resource.
func (ResourceCreateOrUpdater) Create ¶
func (r ResourceCreateOrUpdater) Create(obj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
Create creates a new resource in kubernetes cluster
func (ResourceCreateOrUpdater) Delete ¶
func (r ResourceCreateOrUpdater) Delete(obj *unstructured.Unstructured, subresources ...string) error
Delete deletes a existing resource in kubernetes cluster
func (ResourceCreateOrUpdater) Get ¶
func (r ResourceCreateOrUpdater) Get(name string, opts metav1.GetOptions, subresources ...string) (u *unstructured.Unstructured, err error)
Get returns a specific resource from kubernetes cluster
func (ResourceCreateOrUpdater) List ¶
func (r ResourceCreateOrUpdater) List(opts metav1.ListOptions) (u *unstructured.UnstructuredList, err error)
List returns a list of specific resource at kubernetes cluster
func (*ResourceCreateOrUpdater) String ¶
func (r *ResourceCreateOrUpdater) String() string
String implements Stringer interface
func (ResourceCreateOrUpdater) Update ¶
func (r ResourceCreateOrUpdater) Update(oldobj, newobj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
Update updates the resource at kubernetes cluster
type ResourceCreateOrUpdaterOption ¶
type ResourceCreateOrUpdaterOption func(*ResourceCreateOrUpdater)
ResourceCreateOrUpdaterOption is a typed function used to build an instance of ResourceCreateOrUpdater
NOTE:
This follows the pattern known as "functional options". It
is a function that operates on a given structure as a value to build (initialise, configure, sensible defaults, etc) this same structure.
func ResourceCreateOrUpdaterSkipUpdate ¶
func ResourceCreateOrUpdaterSkipUpdate(skip bool) ResourceCreateOrUpdaterOption
ResourceCreateOrUpdaterSkipUpdate sets IsSkipUpdate based on the provided flag
type ResourceCreator ¶
type ResourceCreator interface {
Create(obj *unstructured.Unstructured, subresources ...string) (*unstructured.Unstructured, error)
}
ResourceCreator abstracts creating an unstructured instance in kubernetes cluster
type ResourceDeleteOptions ¶
type ResourceDeleteOptions struct {
Deleter ResourceDeleter
}
ResourceDeleteOptions is a utility instance used during the resource's delete operations
type ResourceDeleter ¶
type ResourceDeleter interface {
Delete(obj *unstructured.Unstructured, subresources ...string) error
}
ResourceDeleter abstracts deletes an unstructured instance that is available in kubernetes cluster
type ResourceGetOptions ¶
type ResourceGetOptions struct {
Getter ResourceGetter
}
ResourceGetOptions is a utility instance used during the resource's get operations
type ResourceGetter ¶
type ResourceGetter interface {
Get(name string, options metav1.GetOptions, subresources ...string) (*unstructured.Unstructured, error)
}
ResourceGetter abstracts fetching an unstructured instance from kubernetes cluster
type ResourceListOptions ¶
type ResourceListOptions struct {
Lister ResourceLister
}
ResourceListOptions is a utility instance used during the resource's list operations
type ResourceLister ¶
type ResourceLister interface {
List(options metav1.ListOptions) (*unstructured.UnstructuredList, error)
}
ResourceLister abstracts fetching an unstructured list of instance from kubernetes cluster
type ResourceUpdater ¶
type ResourceUpdater interface {
Update(oldobj, newobj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
}
ResourceUpdater abstracts updating an unstructured instance found in kubernetes cluster
type UnstructedList ¶
type UnstructedList struct {
Items []*unstructured.Unstructured
}
UnstructedList represents a list of unstructured instances
func (UnstructedList) Map ¶
func (u UnstructedList) Map(m UnstructuredMiddleware, p ...UnstructuredPredicate) (ul UnstructedList)
Map will map each of its instance against the provided middleware if the provided predicate evaluations succeed
func (UnstructedList) MapAll ¶
func (u UnstructedList) MapAll(m []UnstructuredMiddleware, p ...UnstructuredPredicate) (ul UnstructedList)
MapAll will map all the provided middlewares against each of its instance if the provided predicate evaluations succeed
func (UnstructedList) MapAllIfAny ¶
func (u UnstructedList) MapAllIfAny(m []UnstructuredMiddleware, p ...UnstructuredPredicate) (ul UnstructedList)
MapAllIfAny will map all the provided middlewares against each of its instance if at least one of the provided predicate evaluations succeed
type UnstructuredCreator ¶
type UnstructuredCreator func(document string) (*unstructured.Unstructured, error)
UnstructuredCreator abstracts creation of unstructured instance from the provided document
type UnstructuredMiddleware ¶
type UnstructuredMiddleware func(given *unstructured.Unstructured) (updated *unstructured.Unstructured)
UnstructuredMiddleware abstracts updating given unstructured instance
func AddKubeServerVersionToLabels ¶
func AddKubeServerVersionToLabels(override bool) UnstructuredMiddleware
AddKubeServerVersionToLabels adds kubernetes server version to instance's labels
TODO Move this override flag to a Predicate. This will follow idiomatic Maya convention to separate conditional(s) logic from core business logic. This in turn helps in readability & maintainability of the codebase.
e.g. func IsLabelSet(key string) UnstructuredPredicate {...} func IsLabelUnSet(key string) UnstructuredPredicate {...}
func AddNameToLabels ¶
func AddNameToLabels(key string, override bool) UnstructuredMiddleware
AddNameToLabels extracts the instance's name & adds it to the same instance's labels mapped by the provided label key
TODO Move this override flag to a Predicate. This will follow idiomatic Maya convention to separate conditional(s) logic from core business logic. This in turn helps in readability & maintainability of the codebase.
e.g. func IsLabelSet(key string) UnstructuredPredicate {...} func IsLabelUnSet(key string) UnstructuredPredicate {...}
func SuffixNameWithVersion ¶
func SuffixNameWithVersion() UnstructuredMiddleware
SuffixNameWithVersion suffixes the given unstructured instance's name with current version
func SuffixSliceWithVersionAtPath ¶
func SuffixSliceWithVersionAtPath(o []interface{}, path string) UnstructuredMiddleware
SuffixSliceWithVersionAtPath updates the given unstructured instance's path with provided slice after suffixing each slice item with version
func SuffixStringSliceWithVersionAtPath ¶
func SuffixStringSliceWithVersionAtPath(s []string, path string) UnstructuredMiddleware
SuffixStringSliceWithVersionAtPath updates the given unstructured instance's path with provided slice after suffixing each slice item with version
func SuffixStringWithVersionAtPath ¶
func SuffixStringWithVersionAtPath(s, path string) UnstructuredMiddleware
SuffixStringWithVersionAtPath updates the given unstructured instance's path with provided string after suffixing it with version
func SuffixWithVersionAtPath ¶
func SuffixWithVersionAtPath(path string) UnstructuredMiddleware
SuffixWithVersionAtPath suffixes the value(s) extracted from the provided path with version
NOTE: Currently supports path having following values: - string - []string
func UnstructuredMap ¶
func UnstructuredMap(m UnstructuredMiddleware, p ...UnstructuredPredicate) UnstructuredMiddleware
UnstructuredMap maps the given unstructured instance by executing the provided middleware. Map is considered if all the provided predicate evaluations succeed.
func UnstructuredMapAll ¶
func UnstructuredMapAll(m []UnstructuredMiddleware, p ...UnstructuredPredicate) UnstructuredMiddleware
UnstructuredMapAll maps the given unstructured instance by executing all the provided middlewares. Map is considered if the provided predicate evaluations succeed.
func UnstructuredMapAllIfAny ¶
func UnstructuredMapAllIfAny(m []UnstructuredMiddleware, p ...UnstructuredPredicate) UnstructuredMiddleware
UnstructuredMapAllIfAny maps the given unstructured instance by executing all the provided middlewares. Map is considered if atleast one of the provided predicate evaluations succeed.
func UnstructuredMapIfAny ¶
func UnstructuredMapIfAny(m UnstructuredMiddleware, p ...UnstructuredPredicate) UnstructuredMiddleware
UnstructuredMapIfAny maps the given unstructured instance by executing the provided middleware. Map is considered if at least one of the provided predicate evaluations succeed.
func UpdateLabels ¶
func UpdateLabels(l map[string]string, override bool) UnstructuredMiddleware
UpdateLabels updates the unstructured instance's labels
TODO Move this override flag to a Predicate. This will follow idiomatic Maya convention to separate conditional(s) logic from core business logic. This in turn helps in readability & maintainability of the codebase.
e.g. func IsLabelSet(key string) UnstructuredPredicate {...} func IsLabelUnSet(key string) UnstructuredPredicate {...}
func UpdateNamespace ¶
func UpdateNamespace(n string) UnstructuredMiddleware
UpdateNamespace updates the given unstructured instance's namespace with a valid namespace i.e. non-empty namespace
type UnstructuredPredicate ¶
type UnstructuredPredicate func(given *unstructured.Unstructured) bool
UnstructuredPredicate abstracts evaluating a condition against the provided unstructured instance
type UnstructuredPredicateList ¶
type UnstructuredPredicateList []UnstructuredPredicate
UnstructuredPredicateList represents a list of unstructured predicates
func (UnstructuredPredicateList) All ¶
func (l UnstructuredPredicateList) All(given *unstructured.Unstructured) bool
All evaluates if all the predicates succeed
func (UnstructuredPredicateList) Any ¶
func (l UnstructuredPredicateList) Any(given *unstructured.Unstructured) bool
Any evaluates if at least one of the predicates succeed
type WithBytesUnstructuredCreator ¶
type WithBytesUnstructuredCreator func(raw []byte) (*unstructured.Unstructured, error)
WithBytesUnstructuredCreator abstracts creation of unstructured instance from the provided bytes