Documentation ¶
Index ¶
- Constants
- func DeleteResource[osResourcePT *osResourceT, osResourceT any](ctx context.Context, log logr.Logger, obj DeleteResourceActuator[osResourcePT], ...) (osResourcePT, ctrl.Result, error)
- func MaxRequeue(evts []WaitingOnEvent) time.Duration
- type BaseResourceActuator
- type CreateResourceActuator
- type DeleteResourceActuator
- type Dependency
- func (d *Dependency[objectTP, _, depTP, _, _, _]) AddDeletionGuard(mgr ctrl.Manager, finalizer string, fieldOwner client.FieldOwner) error
- func (d *Dependency[objectTP, _, _, objectT, _, _]) AddIndexer(ctx context.Context, mgr ctrl.Manager) error
- func (d *Dependency[objectTP, _, depTP, _, _, depT]) GetDependencies(ctx context.Context, k8sClient client.Client, obj objectTP) iter.Seq2[string, Result[depT]]
- func (d *Dependency[_, objectListTP, depTP, objectT, objectListT, _]) GetObjects(ctx context.Context, k8sClient client.Client, dep depTP) ([]objectT, error)
- func (d *Dependency[objectTP, _, depTP, _, _, depT]) WatchEventHandler(log logr.Logger, k8sClient client.Client) (handler.EventHandler, error)
- type Result
- type WaitingOnEvent
- func GetOrCreateOSResource[osResourcePT *osResourceT, osResourceT any](ctx context.Context, log logr.Logger, k8sClient client.Client, ...) ([]WaitingOnEvent, osResourcePT, error)
- func WaitingOnORCDeleted(kind, name string) WaitingOnEvent
- func WaitingOnORCExist(kind, name string) WaitingOnEvent
- func WaitingOnORCReady(kind, name string) WaitingOnEvent
- func WaitingOnOpenStackExternal(pollingPeriod time.Duration) WaitingOnEvent
- func WaitingOnOpenStackReady(kind, name string, pollingPeriod time.Duration) WaitingOnEvent
Constants ¶
const ( WaitingOnCreation waitingOnType = iota WaitingOnReady WaitingOnDeletion )
Variables ¶
This section is empty.
Functions ¶
func DeleteResource ¶
func MaxRequeue ¶
func MaxRequeue(evts []WaitingOnEvent) time.Duration
Types ¶
type BaseResourceActuator ¶
type BaseResourceActuator[osResourcePT any] interface { client.Object GetManagementPolicy() orcv1alpha1.ManagementPolicy GetManagedOptions() *orcv1alpha1.ManagedOptions GetResourceID(osResource osResourcePT) string GetOSResourceByStatusID(ctx context.Context) (bool, osResourcePT, error) GetOSResourceBySpec(ctx context.Context) (osResourcePT, error) }
type CreateResourceActuator ¶
type CreateResourceActuator[osResourcePT any] interface { BaseResourceActuator[osResourcePT] GetOSResourceByImportID(ctx context.Context) (bool, osResourcePT, error) GetOSResourceByImportFilter(ctx context.Context) (bool, osResourcePT, error) CreateResource(ctx context.Context) ([]WaitingOnEvent, osResourcePT, error) }
type DeleteResourceActuator ¶
type DeleteResourceActuator[osResourcePT any] interface { BaseResourceActuator[osResourcePT] DeleteResource(ctx context.Context, osResource osResourcePT) ([]WaitingOnEvent, error) }
type Dependency ¶
type Dependency[ objectTP objectType[objectT], objectListTP objectListType[objectListT, objectT], depTP dependencyType[depT], objectT any, objectListT any, depT any, ] struct { // contains filtered or unexported fields }
func NewDependency ¶
func NewDependency[ objectListTP objectListType[objectListT, objectT], depTP dependencyType[depT], objectTP objectType[objectT], objectT any, objectListT any, depT any, ](indexName string, getDependencyRefs func(objectTP) []string) Dependency[objectTP, objectListTP, depTP, objectT, objectListT, depT]
NewDependency returns a new Dependency, which can perform tasks necessary to manage a dependency between 2 object types. The 2 object types are:
- Object: this is the 'source' object.
- Dependency: this is the object that a 'source' object may depend on.
For example, a Port may depend on a Subnet, because it references one or more Subnets in its Addresses. In this case 'Object' is the Port, and 'Dependency' is the subnet.
NewDependency has several type parameters, but only the first 2 are required as all the rest can be inferred. The 2 required parameters are:
- pointer to the List type of Object
- pointer to the Dependency type
NewDependency takes the following arguments:
- indexName: a name representing the path to the Dependency reference in Object.
- getDependencyRefs: a function that takes a pointer to Object and returns a slice of strings containing the names of Dependencies
Taking the Port -> Subnet example, the type parameters are:
- *PortList: pointer to the list type of Port
- *Subnet: pointer to the Dependency type
and the arguments are:
- indexName: "spec.resource.addresses[].subnetRef" - a symbolic path to the subnet reference in a Port
- getDependencyRefs: func(object *Port) []string{ ... returns a slice containing all subnetRefs in this Port's addresses ... }
func (*Dependency[objectTP, _, depTP, _, _, _]) AddDeletionGuard ¶
func (d *Dependency[objectTP, _, depTP, _, _, _]) AddDeletionGuard(mgr ctrl.Manager, finalizer string, fieldOwner client.FieldOwner) error
AddDeletionGuard adds a deletion guard controller to the given manager appropriate for this dependency
func (*Dependency[objectTP, _, _, objectT, _, _]) AddIndexer ¶
func (d *Dependency[objectTP, _, _, objectT, _, _]) AddIndexer(ctx context.Context, mgr ctrl.Manager) error
AddIndexer adds the required field indexer for this dependency to a manager
func (*Dependency[objectTP, _, depTP, _, _, depT]) GetDependencies ¶
func (d *Dependency[objectTP, _, depTP, _, _, depT]) GetDependencies(ctx context.Context, k8sClient client.Client, obj objectTP) iter.Seq2[string, Result[depT]]
GetDependencies returns an iterator over Dependencies for a given Object. For each dependency it returns:
- the dependency's name
- a Result of fetching the dependency
func (*Dependency[_, objectListTP, depTP, objectT, objectListT, _]) GetObjects ¶
func (d *Dependency[_, objectListTP, depTP, objectT, objectListT, _]) GetObjects(ctx context.Context, k8sClient client.Client, dep depTP) ([]objectT, error)
GetObjects returns a slice of all Objects which depend on the given Dependency
func (*Dependency[objectTP, _, depTP, _, _, depT]) WatchEventHandler ¶
func (d *Dependency[objectTP, _, depTP, _, _, depT]) WatchEventHandler(log logr.Logger, k8sClient client.Client) (handler.EventHandler, error)
WatchEventHandler returns an EventHandler which maps a Dependency to all Objects which depend on it
type WaitingOnEvent ¶
func GetOrCreateOSResource ¶
func GetOrCreateOSResource[osResourcePT *osResourceT, osResourceT any](ctx context.Context, log logr.Logger, k8sClient client.Client, actuator CreateResourceActuator[osResourcePT]) ([]WaitingOnEvent, osResourcePT, error)
func WaitingOnORCDeleted ¶
func WaitingOnORCDeleted(kind, name string) WaitingOnEvent
func WaitingOnORCExist ¶
func WaitingOnORCExist(kind, name string) WaitingOnEvent
func WaitingOnORCReady ¶
func WaitingOnORCReady(kind, name string) WaitingOnEvent
func WaitingOnOpenStackExternal ¶
func WaitingOnOpenStackExternal(pollingPeriod time.Duration) WaitingOnEvent
func WaitingOnOpenStackReady ¶
func WaitingOnOpenStackReady(kind, name string, pollingPeriod time.Duration) WaitingOnEvent