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

Refac/organization standardization #650

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

Conversation

gciezkowski-acc
Copy link
Contributor

@gciezkowski-acc gciezkowski-acc commented Oct 21, 2024

Description

I implement new approach to the organization controllers.

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation Update
  • 🎨 Style
  • πŸ§‘β€πŸ’» Code Refactor
  • πŸ”₯ Performance Improvements
  • βœ… Test
  • πŸ€– Build
  • πŸ” CI
  • πŸ“¦ Chore (Release)
  • ⏩ Revert

Related Tickets & Documents

Remove if not applicable

Added tests?

  • πŸ‘ yes
  • πŸ™… no, because they aren't needed
  • πŸ™‹ no, because I need help
  • Separate ticket for tests # (issue/pr)

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Added to documentation?

  • πŸ“œ README.md
  • 🀝 Documentation pages updated
  • πŸ™… no documentation needed
  • (if applicable) generated OpenAPI docs for CRD changes

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (no documentation needed)
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@gciezkowski-acc gciezkowski-acc marked this pull request as ready for review October 21, 2024 11:01
@gciezkowski-acc gciezkowski-acc requested a review from a team as a code owner October 21, 2024 11:01
@gciezkowski-acc gciezkowski-acc force-pushed the refac/organization_standardization branch from 918cca6 to 4ca9c82 Compare October 21, 2024 11:18
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Oct 21, 2024
}

// Ignore organizations without OIDC configuration.
if org.Spec.Authentication == nil || org.Spec.Authentication.OIDCConfig == nil {
return ctrl.Result{}, nil
return ctrl.Result{}, lifecycle.Pending, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Is Pending being returned so that the Ready status is not set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, I switched to lifecycle.Success in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I move it to the predicate to filter reconciliation.

@abhijith-darshan
Copy link
Contributor

abhijith-darshan commented Oct 21, 2024

We should merge all 3 controllers into one since they are acting on the same Custom Resource.

With current approach there will be conflict with DexReconciler and the remaining ones.

if no OIDC config is provided then it will be Pending and the remaining will be in Created state.

There will be potentially an infinite loop where the competing controllers will put Ready and Dex will put it back to Pending

You can merge all 3 functionalities into one Organization Reconciler and the logical order can be -

  • Functionality in OrganizationReconciler (Namespace, etc…)
  • Functionality in Rbac
  • Lastly the DexReconciler and it can exit with a success if there is no OIDC config. You can set a condition to reflect this state.

But since the issue states you don’t need to consolidate at this point we need to bring this up in core dev meeting to check with others

@uwe-mayer
Copy link
Contributor

We should merge all 3 controllers into one since they are acting on the same Custom Resource.

With current approach there will be conflict with DexReconciler and the remaining ones.

if no OIDC config is provided then it will be Pending and the remaining will be in Created state.

There will be potentially an infinite loop where the competing controllers will put Ready and Dex will put it back to Pending

You can merge all 3 functionalities into one Organization Reconciler and the logical order can be -

  • Functionality in OrganizationReconciler (Namespace, etc…)
  • Functionality in Rbac
  • Lastly the DexReconciler and it can exit with a success if there is no OIDC config. You can set a condition to reflect this state.

But since the issue states you don’t need to consolidate at this point we need to bring this up in core dev meeting to check with others

Let's go with a TODO and a Predicate on the SetupWithManager func of the Controller to not reconcile Dex controller on Status changes.

@gciezkowski-acc gciezkowski-acc force-pushed the refac/organization_standardization branch from 30fc606 to 430e89d Compare October 24, 2024 09:35
@gciezkowski-acc gciezkowski-acc force-pushed the refac/organization_standardization branch from 6d4f2c2 to 769a93f Compare October 24, 2024 10:29
@gciezkowski-acc gciezkowski-acc force-pushed the refac/organization_standardization branch from f8a3ee8 to 7309a28 Compare October 24, 2024 13:18
@gciezkowski-acc gciezkowski-acc force-pushed the refac/organization_standardization branch from 404a887 to aa81531 Compare October 25, 2024 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-apis documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REFAC] - Standardise Organisation controllers
4 participants