Skip to content

Refactor gitOps controller #3556

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

weyfonk
Copy link
Contributor

@weyfonk weyfonk commented Apr 15, 2025

This moves functions and methods around, without altering any logic, in the hope of making the gitOps reconciler easier to maintain:

  • Moves RBAC-related methods to a new rbac.go file
  • Moves predicates to the existing predicate.go
  • Moves methods and helper functions related to git job creation to gitjob.go
  • Reorders methods vs helper functions to keep them in two separate groups, methods first, functions next.

Possible next step: refactor gitjob.go to make job creation and management logic easier to maintain.

Refers to #3374

weyfonk added 4 commits April 15, 2025 12:02
This clarifies what functions which live in that file deal with, namely
creation of RBAC resources.
Besides, it allows `gitjob.go` to be created anew for storing logic
around creation of git jobs.
This re-creates `gitjob.go`, this time containing logic related to
creating the git job, leaving `gitjob_controller.go` with mostly
reconciler-related logic.
This reorders `func`s to group `GitJobReconciler` methods together,
placing that group first in files where they appear, with helper
functions called by those methods being placed further in the file.
This places predicates affecting the gitOps controller next to each
other, in the same file, further improving readability of the
controller.
@weyfonk weyfonk requested a review from a team as a code owner April 15, 2025 15:08
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