Metadata Methods
Namespace
getNamespace()
getNamespace()
Get the namespace the resource is in. This usually works only for namespaceable resources.
setNamespace($namespace)
setNamespace($namespace)
Set the namespace for the resource, if namespaceable. This usually works only for namespaceable resources.
The namespace also accepts a K8sNamespace
class:
whereNamespace($namespace)
whereNamespace($namespace)
Alias for setNamespace($namespace)
It's just a naming convention for better filters on the get methods.
Names
setName($name)
setName($name)
Set the name of the resource.
getName()
getName()
Get the name of a resource.
whereName($name)
whereName($name)
Alias for setName($name). It's just a naming convention for better filters on get.
Labels
setLabels(array $labels)
setLabels(array $labels)
Set the labels of the resource.
getLabels()
getLabels()
Get the labels of a resource.
getLabel($name, $default = null)
getLabel($name, $default = null)
Get the label value by key. Defaults to null.
setOrUpdateLabels(array $labels)
setOrUpdateLabels(array $labels)
Set or update the labels. The method used will be merge.
Annotations
setAnnotations(array $annotations)
setAnnotations(array $annotations)
Set the annotations for the resource.
getAnnotations()
getAnnotations()
Get the annotations of a resource.
getAnnotation($name, $default = null)
getAnnotation($name, $default = null)
Get the annotation value by key. Defaults to null.
setOrUpdateAnnotations(array $annotations)
setOrUpdateAnnotations(array $annotations)
Set or update the annotations. The method will be merging existing annotations with the ones passed via the function argument.
getApiVersion()
getApiVersion()
Get the resource API version.
getKind()
getKind()
Get the resource's Kind. This method is called statically.
setDefaultVersion()
setDefaultVersion()
Set at runtime the default version that will be used for the resource.
setDefaultNamespace()
setDefaultNamespace()
Set at runtime the default namespace that will be used for the resource.
To set the default namespace for all resources, you might want to use K8sResource
instead:
Now all resources will interact with the staging
namespace by default.
Transformers
toArray()
toArray()
Get the resource as an array.
Last updated