Documentation ¶
Index ¶
- Constants
- func AddScheme(addToScheme func(*runtime.Scheme) error)
- func DefaultLess(v1, v2 graph.Vertex) bool
- 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 IsReconciliationPaused(object client.Object) bool
- func NewRequeueError(after time.Duration, reason string) error
- type Action
- type GVKNObjKey
- type GraphClient
- type GraphOption
- type GraphOptions
- type GraphWriter
- type HaveDifferentTypeWithOption
- type ObjectSnapshot
- type ObjectVertex
- type ParallelTransformer
- type ReplaceIfExistingOption
- type RequeueError
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func DefaultLess ¶
func IsObjectDeleting ¶
func IsObjectStatusUpdating ¶
func IsObjectUpdating ¶
func IsReconciliationPaused ¶ added in v0.9.0
Types ¶
type Action ¶
type Action string
func ActionCreatePtr ¶
func ActionCreatePtr() *Action
func ActionDeletePtr ¶
func ActionDeletePtr() *Action
func ActionPatchPtr ¶
func ActionPatchPtr() *Action
func ActionStatusPtr ¶
func ActionStatusPtr() *Action
func ActionUpdatePtr ¶
func ActionUpdatePtr() *Action
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(reader client.Reader) GraphClient
type GraphOption ¶
type GraphOption interface {
ApplyTo(*GraphOptions)
}
func WithClientOption ¶ added in v0.9.0
func WithClientOption(opt any) GraphOption
func WithPropagationPolicy ¶ added in v0.9.0
func WithPropagationPolicy(policy client.PropagationPolicy) GraphOption
type GraphOptions ¶ added in v0.9.0
type GraphOptions struct {
// contains filtered or unexported fields
}
type GraphWriter ¶
type GraphWriter interface { // Root setups the given obj as root vertex of the underlying DAG. Root(dag *graph.DAG, objOld, objNew client.Object, action *Action) // Create saves the object obj in the underlying DAG. Create(dag *graph.DAG, obj client.Object, opts ...GraphOption) // Delete deletes the given obj from the underlying DAG. Delete(dag *graph.DAG, obj client.Object, opts ...GraphOption) // Update updates the given obj in the underlying DAG. Update(dag *graph.DAG, objOld, objNew client.Object, opts ...GraphOption) // Patch patches the given objOld by the new version objNew in the underlying DAG. Patch(dag *graph.DAG, objOld, objNew client.Object, opts ...GraphOption) // Status updates the given obj's status in the underlying DAG. Status(dag *graph.DAG, objOld, objNew client.Object, opts ...GraphOption) // Do does 'action' to 'objOld' and 'objNew' and return the vertex created. // this method creates a vertex directly even if the given object already exists in the underlying DAG. // WARN: this is a rather low-level API, will be refactored out in near future, avoid to use it. Do(dag *graph.DAG, objOld, objNew client.Object, action *Action, parent *ObjectVertex, opts ...GraphOption) *ObjectVertex // IsAction tells whether the action of the vertex of this obj is same as 'action'. IsAction(dag *graph.DAG, obj client.Object, action *Action) bool // DependOn setups dependencies between 'object' and 'dependencies', // which will guarantee the Write Order to the K8s cluster of these objects. // if multiple vertices exist(which can occur when ForceCreatingVertexOption being used), the one with the largest depth will be used. DependOn(dag *graph.DAG, object client.Object, dependencies ...client.Object) // FindAll finds all objects that have same type with obj in the underlying DAG. // obey the GraphOption if provided. FindAll(dag *graph.DAG, obj interface{}, opts ...GraphOption) []client.Object // FindMatchedVertex finds the matched vertex in the underlying DAG. FindMatchedVertex(dag *graph.DAG, object client.Object) graph.Vertex }
type HaveDifferentTypeWithOption ¶
type HaveDifferentTypeWithOption struct{}
HaveDifferentTypeWithOption is used in FindAll method to find all objects have different type with the given one.
func (*HaveDifferentTypeWithOption) ApplyTo ¶ added in v0.9.0
func (o *HaveDifferentTypeWithOption) ApplyTo(opts *GraphOptions)
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 root object.
type ObjectVertex ¶
type ObjectVertex struct { Obj client.Object OriObj client.Object Action *Action ClientOpt any PropagationPolicy client.PropagationPolicy }
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
func FindRootVertex ¶
func FindRootVertex(dag *graph.DAG) (*ObjectVertex, error)
func NewObjectVertex ¶ added in v0.9.0
func NewObjectVertex(oldObj, newObj client.Object, action *Action, opts ...GraphOption) *ObjectVertex
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
type ReplaceIfExistingOption ¶
type ReplaceIfExistingOption struct{}
ReplaceIfExistingOption tells the GraphWriter methods to replace Obj and OriObj with the given ones if already existing. used in Action methods: Create, Update, Patch, Status and Delete
func (*ReplaceIfExistingOption) ApplyTo ¶ added in v0.9.0
func (o *ReplaceIfExistingOption) ApplyTo(opts *GraphOptions)