Metadata Methods
Last updated
Was this helpful?
Last updated
Was this helpful?
getNamespace()
Get the namespace the resource is in. This usually works only for namespaceable resources.
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)
Alias for
It's just a naming convention for better filters on the get methods.
setName($name)
Set the name of the resource.
getName()
Get the name of a resource.
whereName($name)
setLabels(array $labels)
Set the labels of the resource.
getLabels()
Get the labels of a resource.
getLabel($name, $default = null)
Get the label value by key. Defaults to null.
setOrUpdateLabels(array $labels)
Set or update the labels. The method used will be merge.
setAnnotations(array $annotations)
Set the annotations for the resource.
getAnnotations()
Get the annotations of a resource.
getAnnotation($name, $default = null)
Get the annotation value by key. Defaults to null.
setOrUpdateAnnotations(array $annotations)
Set or update the annotations. The method will be merging existing annotations with the ones passed via the function argument.
getApiVersion()
Get the resource API version.
getKind()
Get the resource's Kind. This method is called statically.
setDefaultVersion()
Set at runtime the default version that will be used for the resource.
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.
toArray()
Get the resource as an array.
Alias for . It's just a naming convention for better filters on get.