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

Refactor reconcilers and introduce v1beta2 API #435

Merged
merged 26 commits into from
Dec 13, 2022
Merged

Refactor reconcilers and introduce v1beta2 API #435

merged 26 commits into from
Dec 13, 2022

Conversation

stefanprodan
Copy link
Member

@stefanprodan stefanprodan commented Oct 27, 2022

This PR refactors notification-controller to implement the new unified standards of Flux controllers (closes: #376) and documents the API usage in the new format (closes: #378, fixes: #433).

The API version v1beta2 is backwards compatible with v1beta1. The only changes are to the .status sub-resource and .status.conditions, which the controller will upgrade on its own. No user intervention is required besides bumping the version in the custom resource definitions.

API changes:

  • Deprecate Receiver.status.url in favor of .status.webhookPath
  • Replace the Stalled=True condition with Reconciling=True and Reason=ProgressingWithRetry on retryable failures
  • Add lastHandledReconcileAt to .status
  • Add spec.interval to periodically reconcile Providers and Receivers with their Secret references to surface config errors after initialisation.
  • The different status phases are now unit tested to ensure that the controller reflects the observed state correctly
  • Enforce a max length of 2048 for URL type fields such as address and proxy
  • Enforce a max length of 255 for the summary field (required by Slack and others)

Controller changes:

Bug fixes included in this PR:

  • Suspended resources where never finalised
  • Receivers were reconciled on .status updates instead of just .spec & ReconcileAt
  • On refs not found errors, resources weren't explicitly requeue
  • ReconcileAt was not handled at all, even if some types were reacting to it
  • The Stalled condition was added even if the controller could recover on the next try
  • Fix: Receiver webhooks revert apiVersion of ImageRepository to v1alpha1 #328

@pjbgf pjbgf added this to the GA milestone Oct 27, 2022
@stefanprodan stefanprodan force-pushed the api-v1beta2 branch 4 times, most recently from e5a9b99 to cca289d Compare October 29, 2022 10:07
@stefanprodan stefanprodan requested a review from a team October 31, 2022 11:09
@stefanprodan stefanprodan added enhancement New feature or request area/docs Documentation related issues and pull requests area/receiver Webhook receiver related issues and PRs area/alerting Alerting related issues and PRs labels Oct 31, 2022
@stefanprodan stefanprodan marked this pull request as ready for review October 31, 2022 11:09
@hiddeco hiddeco self-requested a review November 2, 2022 13:12
Copy link
Member

@somtochiama somtochiama left a comment

Choose a reason for hiding this comment

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

I have tested that the commit status still works with this update

@stefanprodan stefanprodan force-pushed the api-v1beta2 branch 3 times, most recently from 68180be to 26f84f1 Compare November 3, 2022 09:19
Makefile Show resolved Hide resolved
@pjbgf pjbgf mentioned this pull request Nov 4, 2022
22 tasks
api/v1beta2/condition_types.go Outdated Show resolved Hide resolved
controllers/alert_controller_test.go Show resolved Hide resolved
stefanprodan and others added 15 commits December 9, 2022 12:05
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
- Extensively document the various Receiver types, their validation
  mechanics and their caveats.
- Move various things around a bit to ensure we follow the same flow
  as the rewritten source-controller specs.
- Explicitly document the expected format of the Secret.
- Various other small rewordings and fixes.

Signed-off-by: Hidde Beydals <hello@hidde.co>
Signed-off-by: Hidde Beydals <hello@hidde.co>
Copy link
Member

@relu relu left a comment

Choose a reason for hiding this comment

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

So much stuff here! Refactoring looks really nice ✔️

@hiddeco hiddeco force-pushed the api-v1beta2 branch 2 times, most recently from 502a898 to b07d09d Compare December 9, 2022 13:55
Copy link
Member

@pjbgf pjbgf left a comment

Choose a reason for hiding this comment

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

LGTM!

Great job @stefanprodan @darkowlzz @hiddeco! 👏 👏 👏

Copy link
Contributor

@darkowlzz darkowlzz left a comment

Choose a reason for hiding this comment

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

Left comments about two minor fixes in the docs.
Overall LGTM!

docs/spec/README.md Outdated Show resolved Hide resolved
docs/spec/v1beta2/receivers.md Outdated Show resolved Hide resolved
Plus addressing of a couple of nits.

The following must still be picked up at a later moment:

- More sections need to be moved from "working with" to "writing a ..."
- Documentation flow can likely be improved once the sections have been
  moved.
- Technical description of the behavior of the Provider types could be
  improved, this should be easier to do when everything has the same
  format.

Signed-off-by: Hidde Beydals <hello@hidde.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/alerting Alerting related issues and PRs area/docs Documentation related issues and pull requests area/receiver Webhook receiver related issues and PRs enhancement New feature or request
Projects
Archived in project
7 participants