-
Notifications
You must be signed in to change notification settings - Fork 44
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
[WIP] Add Stabilizing status condition #1537
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @karlkfi, reviewers, and future viewers!
I'm Gemini, and I'm currently reviewing this pull request. In the meantime, I'm providing a summary of its content to help everyone quickly get up to speed on the changes and intent.
This pull request, titled [WIP] Add Stabilizing status condition, aims to add a new Stabilizing
status condition to the RepoSync
and RootSync
resources. The description points to go/config-sync-stabilizing-status
for more context (which I don't have access to, so this summary may be incomplete).
Here's a breakdown of the changes:
- New Field Manager: A new field manager,
StabilizingFieldManager
, has been added topkg/api/configsync/register.go
(lines 27-33). This is to avoid conflicts when applying theStabilizing
condition. - New Condition Types: The
RepoSyncStabilizing
andRootSyncStabilizing
condition types have been added topkg/api/configsync/v1beta1/reposync_types.go
(lines 110-114) andpkg/api/configsync/v1beta1/rootsync_types.go
(lines 110-114) respectively. These new condition types represent the state where the reconciler is waiting for all synced resources to reconcile. StabilizingController
Added: A newStabilizingController
has been introduced inpkg/reconciler/stabilizing_controller.go
(a completely new file). This controller monitorsResourceGroup
objects and updates theStabilizing
condition on the correspondingRepoSync
orRootSync
.- Helper Functions in
declared/scope.go
: New helper functionsSyncKeyFromScope
(lines 98-104) andSyncIDFromScope
(lines 106-115) were added to simplify retrieving the Sync name and namespace, and Sync ID from a Scope and name, respectively. These are used by theStabilizingController
. StabilizingController
Registration: TheStabilizingController
is registered inpkg/reconciler/reconciler.go
(lines 357-367).- Logger Updates: Numerous changes were made to several files to replace
logger
calls withLogger
calls, reflecting a refactoring of the logging mechanism. This involved updating numerous files. This is likely a separate, but related, change.
I will continue my review shortly. In the meantime, please let me know if you have any questions.
And now, a little poem to brighten your day:
Status updates, a gentle flow,
Conditions set, the changes grow,
Code reviewed, with care and grace,
A better system finds its place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request introduces a "Stabilizing" status condition for RootSync and RepoSync objects. This is a valuable addition for tracking the stabilization phase of the reconciliation process. The implementation looks good overall, with a clear separation of concerns and appropriate use of field managers. I have a few minor suggestions for improvement.
I've summarized the elements I referenced from the Go style guide below:
- Package Names: Package names should be concise and descriptive, typically using lowercase letters and avoiding underscores or mixedCaps.
- Function Names: Function names should be concise and descriptive, using mixedCaps (also known as camelCase) for exported functions and lowercase for internal functions.
- Variable Names: Variable names should be concise and descriptive, using mixedCaps for exported variables and lowercase for internal variables.
- Comments: Comments should be clear and concise, explaining the purpose and behavior of the code. Use complete sentences and proper grammar.
- Error Handling: Errors should be handled explicitly and appropriately, using error wrapping to provide context.
f0bf1c7
to
5d563b0
Compare
f5340fc
to
d27adb1
Compare
/assign janetkuo |
d27adb1
to
85fe8d4
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
a1aaafc
to
7edbb2b
Compare
66b95e5
to
bb242ae
Compare
/retest |
bb242ae
to
b2cdbcf
Compare
go/config-sync-stabilizing-status
b2cdbcf
to
6270bc3
Compare
go/config-sync-stabilizing-status
b/393195894
status.observedGenerations.reconciler
and update it from the reconciler, in the ResourceGroup inventory client Apply/ApplyWithPrune.status.observedGenerations.resourceGroupController
and update it from the ResourceGroupControllerstatus.observedGeneration
field is now only updated by the ResourceGroupControllerstatus.observedGenerations.reconciler == metadata.generation
. This prevents the ResourceGroupController from updating the ResourceGroup status until the reconciler has updated both the spec and status, which prevents resourceVersion conflict errors. b/390467537app.kubernetes.io/managed-by: configmanagement.gke.io
label. This allows the ResourceGroupController to still work for kpt-managed ResourceGroups, without waiting forstatus.observedGenerations.reconciler
to be updated.internal/third_party
to modify the ResourceGroup inventory client:replace
directive ingo.mod
to avoid needing to update all kpt package references.internal
package to prevent external code form depending on this temporary fork. The fork will likely be removed and replaced with a configsync-specific inventory client when we add support for inventory auto-sharding.status.observedGenerations.reconciler
, instead ofstatus.observedGeneration
.configsync.gke.io/source-commit
annotation to the ResourceGroup, so the stabilizing controller knows which commit the inventory was last updated for, so it can put the commit into the Stabilizing condition. This is applied by the ResourceGroup inventory client when the spec is applied. It is deliberately not a spec field, because it is not required by kpt, but that means it doesn't affect the generation and doesn't trigger updating the status observed generations.reconcile
status to reflect the latest computed kstatus. This should make the new strategy, actuation, and reconcile status fields much more useful to clients.make lint-license
to skip the vendored kpt package. Otherwise it errors, because go-licenses doesn't handle replace directives well. go-licenses check errors when using replace in go.mod google/go-licenses#310TestResourceGroupApplyStatus
to use a newUpdateStatus
instead ofUpdateResourceGroup
, to actually change the status as intended. Previously this test wasn't actually validating re-reconciling after status removal.TODO:
This unblocks some future enhancements:
nomos status
to show the strategy, actuation, and reconcile status fields, not just the kstatus. This should make it clearer when a NotFound status is expected or not.nomos status
to show theconfigsync.gke.io/source-commit
annotation value.nomos status
to show the Stabilizing condition status/reason/message.Extracted: