Documentation ¶
Index ¶
- func AddFinalizer(o client.Object) bool
- func CtrlResultForErr(err error) (ctrl.Result, error)
- func HasFinalizer(o client.Object) bool
- func IsDelete(o client.Object) bool
- func IsUpsert(o client.Object) bool
- func RegisterAndSyncFinalizer(ctx context.Context, c client.Writer, o client.Object) error
- func RemoveAndSyncFinalizer(ctx context.Context, c client.Writer, o client.Object) error
- func RemoveFinalizer(o client.Object) bool
- type BaseController
- func (self *BaseController[T]) NewEnqueueRequestForMapFunc(f func(ctx context.Context, obj client.Object) []reconcile.Request) handler.EventHandler
- func (self *BaseController[T]) Reconcile(ctx context.Context, req ctrl.Request, obj T) (ctrl.Result, error)
- func (self *BaseController[T]) ReconcileStatus(ctx context.Context, obj T, origErr error) error
- type BaseControllerOp
- type IpPolicyResolver
- type SecretResolver
- type StatusError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFinalizer ¶
func CtrlResultForErr ¶
CtrlResultForErr is a helper function to convert an error into a ctrl.Result passing through ngrok error mappings
func HasFinalizer ¶
func RemoveAndSyncFinalizer ¶
func RemoveFinalizer ¶
Types ¶
type BaseController ¶
type BaseController[T client.Object] struct { // Kube is the base client for interacting with the Kubernetes API Kube client.Client // Log is the logger for the controller Log logr.Logger // Recorder is the event recorder for the controller Recorder record.EventRecorder // Namespace is optional for controllers Namespace *string StatusID func(obj T) string Create func(ctx context.Context, obj T) error Update func(ctx context.Context, obj T) error Delete func(ctx context.Context, obj T) error ErrResult func(op BaseControllerOp, obj T, err error) (ctrl.Result, error) }
BaseController is our standard pattern for writing controllers
Note: Non-provided methods are not called during reconcile
func (*BaseController[T]) NewEnqueueRequestForMapFunc ¶
func (self *BaseController[T]) NewEnqueueRequestForMapFunc(f func(ctx context.Context, obj client.Object) []reconcile.Request) handler.EventHandler
NewEnqueueRequestForMapFunc wraps a map function to be used as an event handler. It also takes care to make sure that the controllers logger is passed through to the map function, so that we can use our common pattern of getting the logger from the context.
func (*BaseController[T]) Reconcile ¶
func (self *BaseController[T]) Reconcile(ctx context.Context, req ctrl.Request, obj T) (ctrl.Result, error)
reconcile is the primary function that a manager calls for this controller to reconcile an event for the give client.Object
func (*BaseController[T]) ReconcileStatus ¶
func (self *BaseController[T]) ReconcileStatus(ctx context.Context, obj T, origErr error) error
ReconcileStatus is a helper function to reconcile the status of an object and requeue on update errors Note: obj must be the latest resource version from k8s api
type BaseControllerOp ¶
type BaseControllerOp int
BaseControllerOp is an enum for the different operations that can be performed by a BaseController
const ( // createOp is the operation for creating a resource CreateOp BaseControllerOp = iota // updateOp is the operation for updating a resource (upsert) UpdateOp // deleteOp is the operation for deleting a resource (and finalizers) DeleteOp )
type IpPolicyResolver ¶
func (*IpPolicyResolver) ResolveIPPolicyNamesorIds ¶
func (r *IpPolicyResolver) ResolveIPPolicyNamesorIds(ctx context.Context, namespace string, namesOrIds []string) ([]string, error)
Resolves and IP policy names or IDs to IDs. If the input is not found, it is assumed to be an ID and is returned as is.
func (*IpPolicyResolver) ValidateIPPolicyNames ¶
type SecretResolver ¶
type StatusError ¶
type StatusError struct {
// contains filtered or unexported fields
}
StatusError wraps .Status().*() errors returned from k8s client
func (StatusError) Error ¶
func (e StatusError) Error() string
func (StatusError) Unwrap ¶
func (e StatusError) Unwrap() error