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

operator: fix ManagedOSVersionChannel sync #769

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

fgiudici
Copy link
Member

Review the sync in the ManagedOSVersionChannel reconcile loop.

After the very fist initial sync, all subsequently channel syncs fail: fixed.
Fixes: #766

Older resources may not have annotations yet: initialize the field.
Fixes: #767

@fgiudici fgiudici requested a review from a team as a code owner June 19, 2024 13:27
@@ -367,6 +367,9 @@ func (r *ManagedOSVersionChannelReconciler) createManagedOSVersions(ctx context.
if lastSyncTime, found := version.Annotations[elementalv1.ElementalManagedOSVersionChannelLastSyncAnnotation]; !found || (lastSyncTime != syncTimestamp) {
logger.Info("ManagedOSVersion no longer synced through this channel", "name", version.Name)
patchBase := client.MergeFrom(version.DeepCopy())
if version.ObjectMeta.Annotations == nil {
Copy link
Member Author

Choose a reason for hiding this comment

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

Fixes #767

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch!

@@ -460,6 +463,12 @@ func (r *ManagedOSVersionChannelReconciler) createSyncerPod(ctx context.Context,
return err
}

// If we don't update the LastSyncedTime on Pod creation, we will loop
Copy link
Member Author

Choose a reason for hiding this comment

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

We need this to avoid reachedNextInterval at line 181 of this same file to keep being true which would land to a create/delete infinite loop

@fgiudici fgiudici added the need/backport should be backported on stable branch once merged label Jun 19, 2024
Copy link
Contributor

@anmazzotti anmazzotti left a comment

Choose a reason for hiding this comment

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

Looks good!

fgiudici added 2 commits June 19, 2024 18:06
After the very fist initial sync, all subsequently channel syncs fail.
Fixed.

fixes: rancher#766
Signed-off-by: Francesco Giudici <[email protected]>
Older resources may not have annotations yet: initialize the field.

Fixes: rancher#767

Signed-off-by: Francesco Giudici <[email protected]>
@fgiudici fgiudici enabled auto-merge (squash) June 19, 2024 16:07
@fgiudici fgiudici merged commit 5ccde14 into rancher:main Jun 19, 2024
22 checks passed
fgiudici added a commit to fgiudici/elemental-operator that referenced this pull request Jun 20, 2024
* operator: fix ManagedOSVersionChannel sync
After the very fist initial sync, all subsequently channel syncs fail.
Fixed.
fixes: rancher#766

* operator: don't assume ManagedOSVersion resources have annotations
Older resources may not have annotations yet: initialize the field.
Fixes: rancher#767

---------

Signed-off-by: Francesco Giudici <[email protected]>
(cherry picked from commit 5ccde14)
fgiudici added a commit that referenced this pull request Jun 20, 2024
* operator: fix ManagedOSVersionChannel sync (#769)

* operator: fix ManagedOSVersionChannel sync
After the very fist initial sync, all subsequently channel syncs fail.
Fixed.
fixes: #766

* operator: don't assume ManagedOSVersion resources have annotations
Older resources may not have annotations yet: initialize the field.
Fixes: #767

(cherry picked from commit 5ccde14)


* operator: always update managedosversionchannel last sync time (#772)

...also if we have an error on Pod creation.

Fixes commit 5ccde14

(cherry picked from commit 7227947)

Signed-off-by: Francesco Giudici <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/backport should be backported on stable branch once merged
Projects
None yet
2 participants