Skip to content

Draft: Various updates to the reconcile loop

Mitchell Nielsen requested to merge reconcile-loop-fixes into master

Summary

Makes various updates to the reconcile loop aiming to:

  • Improve the clarity of the logs
  • Fix hot-loop cycle where requeue delay was not respected
  • Simplify codebase for maintainability and readability

Related to #973 (closed)

Test plan

  1. Apply a CR with the second-newest version from CHART_VERSIONS.
  2. Let the CR fully reconcile.
  3. Update the CR with the newest version from CHART_VERSIONS to trigger an upgrade.
  4. Tail the Controller logs and ensure there is not a period in which the logs rapidly repeat with content similar to the following:

stern -n $NAMESPACE -l control-plane=controller-manager

2023-04-27T14:46:23Z INFO    controllers.GitLab   reconciling GitLab      {"gitlab": "gitlab-system/gitlab"}
2023-04-27T14:46:23Z DEBUG   controllers.GitLab   version information     {"gitlab": "gitlab-system/gitlab", "upgrade": true, "current version": "6.9.4", "desired version": "6.10.2"}
2023-04-27T14:46:23Z INFO    controllers.GitLab   ensuring Webservice Deployments are reconciled  {"gitlab": "gitlab-system/gitlab", "pause": true}
2023-04-27T14:46:23Z DEBUG   controllers.GitLab   CreateOrPatch   {"gitlab": "gitlab-system/gitlab", "type": "*v1.Deployment", "reference": "gitlab-system/gitlab-webservice-default", "outcome": "updated"}
2023-04-27T14:46:23Z INFO    controllers.GitLab   ensuring Sidekiq Deployments are reconciled     {"gitlab": "gitlab-system/gitlab", "pause": true}
2023-04-27T14:46:23Z INFO    controllers.GitLab   ensuring pre migrations have run        {"gitlab": "gitlab-system/gitlab"}
2023-04-27T14:46:23Z INFO    controllers.GitLab   ensuring Webservice Deployments are unpaused    {"gitlab": "gitlab-system/gitlab"}
2023-04-27T14:46:23Z INFO    controllers.GitLab   ensuring Sidekiq Deployments are unpaused       {"gitlab": "gitlab-system/gitlab"}
2023-04-27T14:46:23Z INFO    controllers.GitLab   ensuring Webservice Deployments are running     {"gitlab": "gitlab-system/gitlab"}
2023-04-27T14:46:23Z INFO    controllers.GitLab   Webservice and Sidekiq not yet fully running, will requeue with delay  {"gitlab": "gitlab-system/gitlab"}
Edited by Mitchell Nielsen

Merge request reports