Skip to content

Commit 4a7acb0

Browse files
committed
review fixes
1 parent d754ad5 commit 4a7acb0

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

cmd/clusterctl/client/cluster/crd_migration.go

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,8 @@ func (m *crdMigrator) run(ctx context.Context, newCRD *apiextensionsv1.CustomRes
8484

8585
// Gets the list of version supported by the new CRD
8686
newVersions := sets.Set[string]{}
87-
servedVersions := sets.Set[string]{}
8887
for _, version := range newCRD.Spec.Versions {
8988
newVersions.Insert(version.Name)
90-
if version.Served {
91-
servedVersions.Insert(version.Name)
92-
}
9389
}
9490

9591
// Get the current CRD.
@@ -130,9 +126,8 @@ func (m *crdMigrator) run(ctx context.Context, newCRD *apiextensionsv1.CustomRes
130126
// This way we can make sure that all CR objects are now stored in the current storage version.
131127
// Alternatively, we would have to figure out which objects are stored in which version but this information is not
132128
// exposed by the apiserver.
133-
storedVersionsToDelete := currentStatusStoredVersions.Difference(servedVersions)
134-
storedVersionsToPreserve := currentStatusStoredVersions.Intersection(servedVersions)
135-
log.Info("CR migration required", "kind", newCRD.Spec.Names.Kind, "storedVersionsToDelete", strings.Join(sets.List(storedVersionsToDelete), ","), "storedVersionsToPreserve", strings.Join(sets.List(storedVersionsToPreserve), ","))
129+
storedVersionsToDelete := currentStatusStoredVersions.Delete(currentStorageVersion)
130+
log.Info("CR migration required", "kind", newCRD.Spec.Names.Kind, "storedVersionsToDelete", strings.Join(sets.List(storedVersionsToDelete), ","), "storedVersionToPreserve", currentStorageVersion)
136131

137132
if err := m.migrateResourcesForCRD(ctx, currentCRD, currentStorageVersion); err != nil {
138133
return false, err
@@ -239,12 +234,12 @@ func storageVersionForCRD(crd *apiextensionsv1.CustomResourceDefinition) (string
239234
// During this timespan conversion, validating- or mutationwebhooks may be unavailable and cause a failure.
240235
func newCRDMigrationBackoff() wait.Backoff {
241236
// Return a exponential backoff configuration which returns durations for a total time of ~1m30s.
242-
// Example: 0, .25s, .6s, 1.2, 2.1s, 3.4s, 5.5s, 8s, 12s, 19s, 28s, 43s, 64s, 97s
237+
// Example: 0, .25s, .6s, 1.1s, 1.8s, 2.7s, 4s, 6s, 9s, 12s, 17s, 25s, 35s, 49s, 69s, 97s, 135s
243238
// Jitter is added as a random fraction of the duration multiplied by the jitter factor.
244239
return wait.Backoff{
245-
Duration: 500 * time.Millisecond,
246-
Factor: 1.5,
247-
Steps: 9,
240+
Duration: 250 * time.Millisecond,
241+
Factor: 1.4,
242+
Steps: 17,
248243
Jitter: 0.1,
249244
}
250245
}

0 commit comments

Comments
 (0)