OwnerReference class

Represents a reference to an owning Kubernetes resource.

OwnerReferences are used to represent relationships between Kubernetes objects, particularly for garbage collection and cascading deletion. They enable:

  • Automatic cleanup of dependent objects
  • Tracking of resource relationships
  • Implementation of cascading behaviors

Key use cases:

  • ReplicaSets owning their Pods
  • Deployments owning their ReplicaSets
  • StatefulSets owning their PersistentVolumeClaims

Example:

final ownerRef = OwnerReference()
  ..apiVersion = 'apps/v1'
  ..kind = 'Deployment'
  ..name = 'nginx-deployment'
  ..uid = 'a123-456b-789c-0d'
  ..controller = true
  ..blockOwnerDeletion = true;

See the Kubernetes documentation for more details about owner references.

Annotations
  • @JsonSerializable.new()

Constructors

OwnerReference({String? apiVersion, bool? blockOwnerDeletion, bool? controller, String? kind, String? name, String? uid})
Creates a new OwnerReference with default values.
OwnerReference.fromJson(Map<String, dynamic> json)
factory

Properties

apiVersion String?
The API version of the owner resource.
getter/setter pair
blockOwnerDeletion bool?
Controls the garbage collection behavior of the owner resource.
getter/setter pair
controller bool?
Indicates if this reference points to the managing controller.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
kind String?
The kind of the owner resource.
getter/setter pair
name String?
The name of the owner resource.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
uid String?
The unique identifier of the owner resource.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited