Documentation ¶
Index ¶
- func CreateOnlyMutator(_, _ client.Object) (bool, error)
- func FetchTargetRefObject(ctx context.Context, k8sClient client.Reader, ...) (client.Object, error)
- type BaseReconciler
- func (b *BaseReconciler) APIClientReader() client.Reader
- func (b *BaseReconciler) AddFinalizer(ctx context.Context, obj client.Object, finalizer string) error
- func (b *BaseReconciler) Client() client.Client
- func (b *BaseReconciler) CreateResource(ctx context.Context, obj client.Object) error
- func (b *BaseReconciler) DeleteResource(ctx context.Context, obj client.Object, options ...client.DeleteOption) error
- func (b *BaseReconciler) EnsureOwnerReference(owner, obj client.Object) (bool, error)
- func (b *BaseReconciler) EventRecorder() record.EventRecorder
- func (b *BaseReconciler) GetResource(ctx context.Context, objKey types.NamespacedName, obj client.Object) error
- func (b *BaseReconciler) Logger() logr.Logger
- func (b *BaseReconciler) Reconcile(context.Context, ctrl.Request) (ctrl.Result, error)
- func (b *BaseReconciler) ReconcileResource(ctx context.Context, obj, desired client.Object, mutateFn MutateFn) error
- func (b *BaseReconciler) RemoveFinalizer(ctx context.Context, obj client.Object, finalizer string) error
- func (b *BaseReconciler) Scheme() *runtime.Scheme
- func (b *BaseReconciler) SetOwnerReference(owner, obj client.Object) error
- func (b *BaseReconciler) UpdateResource(ctx context.Context, obj client.Object) error
- func (b *BaseReconciler) UpdateResourceStatus(ctx context.Context, obj client.Object) error
- type GatewayDiffs
- type MutateFn
- type TargetRefReconciler
- func (r *TargetRefReconciler) DeleteTargetBackReference(ctx context.Context, targetNetworkObject client.Object, annotationName string) error
- func (r *TargetRefReconciler) FetchAcceptedGatewayHTTPRoutes(ctx context.Context, gateway *gatewayapiv1.Gateway) (routes []gatewayapiv1.HTTPRoute)
- func (r *TargetRefReconciler) GetAllGatewayPolicyRefs(ctx context.Context, policyRefsConfig kuadrant.Referrer) ([]client.ObjectKey, error)
- func (r *TargetRefReconciler) ReconcileGatewayPolicyReferences(ctx context.Context, policy client.Object, gwDiffObj *GatewayDiffs) error
- func (r *TargetRefReconciler) ReconcileTargetBackReference(ctx context.Context, p kuadrant.Policy, targetNetworkObject client.Object, ...) error
- func (r *TargetRefReconciler) TargetedGatewayKeys(_ context.Context, targetNetworkObject client.Object) []client.ObjectKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchTargetRefObject ¶
func FetchTargetRefObject(ctx context.Context, k8sClient client.Reader, targetRef gatewayapiv1alpha2.PolicyTargetReference, defaultNs string) (client.Object, error)
FetchTargetRefObject fetches the target reference object and checks the status is valid
Types ¶
type BaseReconciler ¶
type BaseReconciler struct {
// contains filtered or unexported fields
}
func NewBaseReconciler ¶
func (*BaseReconciler) APIClientReader ¶
func (b *BaseReconciler) APIClientReader() client.Reader
APIClientReader return a client that directly reads objects from the Kubernetes APIServer
func (*BaseReconciler) AddFinalizer ¶
func (*BaseReconciler) Client ¶
func (b *BaseReconciler) Client() client.Client
Client returns a split client that reads objects from the cache and writes to the Kubernetes APIServer
func (*BaseReconciler) CreateResource ¶
func (*BaseReconciler) DeleteResource ¶
func (b *BaseReconciler) DeleteResource(ctx context.Context, obj client.Object, options ...client.DeleteOption) error
func (*BaseReconciler) EnsureOwnerReference ¶
func (b *BaseReconciler) EnsureOwnerReference(owner, obj client.Object) (bool, error)
EnsureOwnerReference sets owner as a Controller OwnerReference on owned returns boolean to notify when the object has been updated
func (*BaseReconciler) EventRecorder ¶
func (b *BaseReconciler) EventRecorder() record.EventRecorder
func (*BaseReconciler) GetResource ¶
func (b *BaseReconciler) GetResource(ctx context.Context, objKey types.NamespacedName, obj client.Object) error
func (*BaseReconciler) Logger ¶
func (b *BaseReconciler) Logger() logr.Logger
func (*BaseReconciler) ReconcileResource ¶
func (b *BaseReconciler) ReconcileResource(ctx context.Context, obj, desired client.Object, mutateFn MutateFn) error
ReconcileResource attempts to mutate the existing state in order to match the desired state. The object's desired state must be reconciled with the existing state inside the passed in callback MutateFn.
obj: Object of the same type as the 'desired' object.
Used to read the resource from the kubernetes cluster. Could be zero-valued initialized object.
desired: Object representing the desired state
It returns an error.
func (*BaseReconciler) RemoveFinalizer ¶
func (*BaseReconciler) Scheme ¶
func (b *BaseReconciler) Scheme() *runtime.Scheme
func (*BaseReconciler) SetOwnerReference ¶
func (b *BaseReconciler) SetOwnerReference(owner, obj client.Object) error
SetOwnerReference sets owner as a Controller OwnerReference on owned
func (*BaseReconciler) UpdateResource ¶
func (*BaseReconciler) UpdateResourceStatus ¶
type GatewayDiffs ¶
type GatewayDiffs struct { GatewaysMissingPolicyRef []kuadrant.GatewayWrapper GatewaysWithValidPolicyRef []kuadrant.GatewayWrapper GatewaysWithInvalidPolicyRef []kuadrant.GatewayWrapper }
func ComputeGatewayDiffs ¶
func ComputeGatewayDiffs(ctx context.Context, k8sClient client.Reader, policy, targetNetworkObject client.Object) (*GatewayDiffs, error)
ComputeGatewayDiffs computes all the differences to reconcile regarding the gateways whose behaviors should/should not be extended by the policy. These include gateways directly referenced by the policy and gateways indirectly referenced through the policy's target network objects. * list of gateways to which the policy applies for the first time * list of gateways to which the policy no longer applies * list of gateways to which the policy still applies TODO(@guicassolato): unit test
type TargetRefReconciler ¶
func (*TargetRefReconciler) DeleteTargetBackReference ¶
func (*TargetRefReconciler) FetchAcceptedGatewayHTTPRoutes ¶
func (r *TargetRefReconciler) FetchAcceptedGatewayHTTPRoutes(ctx context.Context, gateway *gatewayapiv1.Gateway) (routes []gatewayapiv1.HTTPRoute)
FetchAcceptedGatewayHTTPRoutes returns the list of HTTPRoutes that have been accepted as children of a gateway.
func (*TargetRefReconciler) GetAllGatewayPolicyRefs ¶
func (r *TargetRefReconciler) GetAllGatewayPolicyRefs(ctx context.Context, policyRefsConfig kuadrant.Referrer) ([]client.ObjectKey, error)
GetAllGatewayPolicyRefs returns the policy refs of a given policy kind from all gateways managed by kuadrant. The gateway objects are handled in order of creation to mitigate the risk of non-idenpotent reconciliations based on this list of policy refs; nevertheless, the actual order of returned policy refs depends on the order the policy refs appear in the annotations of the gateways. Only gateways with status programmed are considered.
func (*TargetRefReconciler) ReconcileGatewayPolicyReferences ¶
func (r *TargetRefReconciler) ReconcileGatewayPolicyReferences(ctx context.Context, policy client.Object, gwDiffObj *GatewayDiffs) error
ReconcileGatewayPolicyReferences updates the annotations in the Gateway resources that list to all the policies that directly or indirectly target the gateway, based upon a pre-computed gateway diff object
func (*TargetRefReconciler) ReconcileTargetBackReference ¶
func (r *TargetRefReconciler) ReconcileTargetBackReference(ctx context.Context, p kuadrant.Policy, targetNetworkObject client.Object, annotationName string) error
ReconcileTargetBackReference reconciles policy key in annotations of the target object
func (*TargetRefReconciler) TargetedGatewayKeys ¶
func (r *TargetRefReconciler) TargetedGatewayKeys(_ context.Context, targetNetworkObject client.Object) []client.ObjectKey
TargetedGatewayKeys returns the list of gateways that are being referenced from the target.