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

Booleanize the controller flags #1638

Merged
merged 4 commits into from
Aug 3, 2021

Conversation

rainest
Copy link
Contributor

@rainest rainest commented Aug 3, 2021

What this PR does / why we need it:
Make controller flags booleans. Do what makes sense based on those booleans and the environment, on top of #1585, see #1580 (comment)

Special notes for your reviewer:

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR

Actual changes would introduce annoying merge conflict stuff against other stuff in flight, but this does change flag semantics. We should update changelog accordingly if this goes into #1585, but should do that after in #1585

Travis Raines added 2 commits August 2, 2021 15:06
Change flags for managing controllers from a custom
enabled/auto/disabled type to booleans. By default, all controllers are
enabled. If a controller's disable flag is set, it is disabled. Enabled
controllers that have an auto loader are loaded if they are enabled and
their auto loader indicates they should load.

Remove the KongStateEnabled flag. This was a leftover from an earlier
design where the controller managed Kong state information via a special
Secret. It had no remaining associated code and was only present in
configuration.

Rename controller flags to reflect that they disable controllers when
set.

Remove enablement status type, associated utility functions, and custom
flag handler.
Move deferred body close checks after the error checkers. If an error is
present, no body exists, and the deferred attempt to close it segfaults.
@rainest rainest requested a review from a team as a code owner August 3, 2021 01:01
Copy link
Contributor

@mflendrich mflendrich left a comment

Choose a reason for hiding this comment

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

The spirit of this change LGTM but I'm really unhappy with these negated toggles.

Can we find some middle ground here?

internal/manager/config.go Outdated Show resolved Hide resolved
internal/manager/config.go Outdated Show resolved Hide resolved
internal/manager/controllerdef.go Outdated Show resolved Hide resolved
internal/manager/vars.go Outdated Show resolved Hide resolved
Copy link
Contributor

@shaneutt shaneutt left a comment

Choose a reason for hiding this comment

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

I'm in favor of this change personally, as I'm convinced that the simplification here will make using the controller manager more straightforward in a time when we don't have automated controller loading.

In fact I ended up recently proposing something very similar:

#1582

If we do end up going this way @rainest I would ask that you check out the diff there and perhaps incorporate some of the refactors I did there as well if it seems like a good fit to you.

internal/manager/config.go Outdated Show resolved Hide resolved
Change the controller flags from disablers to enablers and flip the
logic that handles them.

Remove unnecessary pointer usage.
@rainest
Copy link
Contributor Author

rainest commented Aug 3, 2021

@shaneutt were there other additional refactors in #1582? It looks like the differences there were the same as the things Michal had requested, which make sense and have been submitted in 7c34d87. With that we should squash this when merging to rephrase the original commit message.

@shaneutt
Copy link
Contributor

shaneutt commented Aug 3, 2021

@shaneutt were there other additional refactors in #1582? It looks like the differences there were the same as the things Michal had requested, which make sense and have been submitted in 7c34d87. With that we should squash this when merging to rephrase the original commit message.

I had done a refactor of how we manage legacy vs V1 Ingress controller setup that if you feel like it wouldn't be too much of a pain to include I would like to see added, but not a blocker by any means.

internal/manager/controllerdef.go Show resolved Hide resolved
internal/manager/controllerdef.go Show resolved Hide resolved
internal/manager/ingressapi.go Outdated Show resolved Hide resolved
internal/manager/ingressapi.go Outdated Show resolved Hide resolved
internal/manager/ingressapi.go Outdated Show resolved Hide resolved
Co-authored-by: Michał Flendrich <[email protected]>
@rainest rainest merged commit 7448c15 into refactor/cleanup-enablement Aug 3, 2021
@rainest rainest deleted the feat/bool-enable branch August 3, 2021 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants