Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic policy status reconciler #1

Draft
wants to merge 8 commits into
base: rlp-policy-status
Choose a base branch
from

Conversation

sergioifg94
Copy link

POC of an experimental approach to a generic policy reconciler that sets the status using a template method pattern

type ServiceProbeResult struct {
}

func (r *PolicyReconciler[T]) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the generic Reconcile function that delegates the validation, reconciliation, and service probing and contains the common logic to update the status based on the result of these operations

return &p.Status.Conditions
}

type DummyPolicyReconciler struct {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An example of how a reconciler would look like using the generic policy reconciler

Comment on lines +43 to +46
var relatedResource client.Object
r.client.Get(ctx, types.NamespacedName{
Name: "dummy",
}, relatedResource)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't actually do anything, this is just to prove that it is possible within the different stages to use the fields from the inner target ref reconciler

@KevFan KevFan force-pushed the rlp-policy-status branch 6 times, most recently from 5863b25 to ba26ec2 Compare December 14, 2023 13:11
@KevFan KevFan force-pushed the rlp-policy-status branch 2 times, most recently from 64b8232 to 6874ca6 Compare January 9, 2024 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants