Documentation ¶
Index ¶
- Constants
- func AddScheme(addToScheme func(*runtime.Scheme) error)
- func DefaultLess(v1, v2 graph.Vertex) bool
- func FindAll[T interface{}](dag *graph.DAG) []graph.Vertex
- func GetScheme() *runtime.Scheme
- func IsObjectDeleting(object client.Object) bool
- func IsObjectStatusUpdating(object client.Object) bool
- func IsObjectUpdating(object client.Object) bool
- func IsOwnerOf(owner, obj client.Object) bool
- func NewRequeueError(after time.Duration, reason string) error
- type Action
- type GVKNObjKey
- type GraphClient
- type GraphWriter
- type ObjectSnapshot
- type ObjectVertex
- type ParallelTransformer
- type RequeueError
Constants ¶
const ( CREATE = Action("CREATE") UPDATE = Action("UPDATE") DELETE = Action("DELETE") STATUS = Action("STATUS") )
Variables ¶
This section is empty.
Functions ¶
func DefaultLess ¶
func IsObjectDeleting ¶
func IsObjectStatusUpdating ¶
func IsObjectUpdating ¶
Types ¶
type GVKNObjKey ¶
type GVKNObjKey struct { schema.GroupVersionKind client.ObjectKey }
func GetGVKName ¶
func GetGVKName(object client.Object) (*GVKNObjKey, error)
type GraphClient ¶
type GraphClient interface { client.Reader GraphWriter }
func NewGraphClient ¶
func NewGraphClient(cli client.Client) GraphClient
type GraphWriter ¶
type GraphWriter interface { // Root setups the given obj as root vertex of the underlying DAG. // this func should be called once before any others. Root(dag *graph.DAG, objOld, objNew client.Object) // Create saves the object obj in the underlying DAG. Create(dag *graph.DAG, obj client.Object) // Delete deletes the given obj from the underlying DAG. Delete(dag *graph.DAG, obj client.Object) // Update updates the given obj in the underlying DAG. Update(dag *graph.DAG, objOld, objNew client.Object) // Status updates the given obj's status in the underlying DAG. Status(dag *graph.DAG, objOld, objNew client.Object) // DependOn setups dependencies between 'object' and 'dependency', // which will guarantee the Write Order to the K8s cluster of these objects. DependOn(dag *graph.DAG, object client.Object, dependency ...client.Object) }
type ObjectSnapshot ¶
type ObjectSnapshot map[GVKNObjKey]client.Object
func ReadCacheSnapshot ¶
func ReadCacheSnapshot(transCtx graph.TransformContext, root client.Object, ml client.MatchingLabels, kinds ...client.ObjectList) (ObjectSnapshot, error)
ReadCacheSnapshot reads all objects owned by our cluster
type ObjectVertex ¶
type ObjectVertex struct { Obj client.Object OriObj client.Object Immutable bool IsOrphan bool Action *Action }
ObjectVertex describes expected object spec and how to reach it obj always represents the expected part: new object in Create/Update action and old object in Delete action oriObj is set in Update action all transformers doing their object manipulation works on obj.spec the root vertex(i.e. the cluster vertex) will be treated specially: as all its meta, spec and status can be updated in one reconciliation loop Update is ignored when immutable=true orphan object will be force deleted when action is DELETE
func FindRootVertex ¶
func FindRootVertex(dag *graph.DAG) (*ObjectVertex, error)
func (*ObjectVertex) String ¶
func (v *ObjectVertex) String() string
type ParallelTransformer ¶
type ParallelTransformer struct {
Transformers []graph.Transformer
}
ParallelTransformer executes a group of transformers in parallel. TODO: make DAG thread-safe if ParallelTransformer called.
func (*ParallelTransformer) Transform ¶
func (t *ParallelTransformer) Transform(ctx graph.TransformContext, dag *graph.DAG) error