mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-05-23 17:43:25 +00:00
fix Implicit memory aliasing in for loop (#335)
Signed-off-by: ldpliu <daliu@redhat.com>
This commit is contained in:
@@ -376,7 +376,6 @@ func applyStorageVersionMigration(
|
||||
}
|
||||
|
||||
func getStorageVersionMigrationStatusCondition(svmcr *migrationv1alpha1.StorageVersionMigration) *migrationv1alpha1.MigrationCondition {
|
||||
var runningCon *migrationv1alpha1.MigrationCondition
|
||||
for _, c := range svmcr.Status.Conditions {
|
||||
switch c.Type {
|
||||
case migrationv1alpha1.MigrationSucceeded:
|
||||
@@ -391,12 +390,12 @@ func getStorageVersionMigrationStatusCondition(svmcr *migrationv1alpha1.StorageV
|
||||
continue
|
||||
case migrationv1alpha1.MigrationRunning:
|
||||
if c.Status == corev1.ConditionTrue {
|
||||
runningCon = &c
|
||||
return &c
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
return runningCon
|
||||
return nil
|
||||
}
|
||||
|
||||
func generateHubClients(hubKubeConfig *rest.Config) (apiextensionsclient.Interface, migrationv1alpha1client.StorageVersionMigrationsGetter, error) {
|
||||
|
||||
@@ -178,20 +178,20 @@ func (r *managedReconcile) cleanUpAppliedManifestWorks(ctx context.Context, klus
|
||||
}
|
||||
|
||||
var errs []error
|
||||
for _, appliedManifestWork := range appliedManifestWorks.Items {
|
||||
for index := range appliedManifestWorks.Items {
|
||||
// ignore AppliedManifestWork for other klusterlet
|
||||
if string(klusterlet.UID) != appliedManifestWork.Spec.AgentID {
|
||||
if string(klusterlet.UID) != appliedManifestWorks.Items[index].Spec.AgentID {
|
||||
continue
|
||||
}
|
||||
|
||||
// remove finalizer if exists
|
||||
if mutated := removeFinalizer(&appliedManifestWork, appliedManifestWorkFinalizer); !mutated {
|
||||
if mutated := removeFinalizer(&appliedManifestWorks.Items[index], appliedManifestWorkFinalizer); !mutated {
|
||||
continue
|
||||
}
|
||||
|
||||
_, err := r.managedClusterClients.appliedManifestWorkClient.Update(ctx, &appliedManifestWork, metav1.UpdateOptions{})
|
||||
_, err := r.managedClusterClients.appliedManifestWorkClient.Update(ctx, &appliedManifestWorks.Items[index], metav1.UpdateOptions{})
|
||||
if err != nil && !errors.IsNotFound(err) {
|
||||
errs = append(errs, fmt.Errorf("unable to remove finalizer from AppliedManifestWork %q: %w", appliedManifestWork.Name, err))
|
||||
errs = append(errs, fmt.Errorf("unable to remove finalizer from AppliedManifestWork %q: %w", appliedManifestWorks.Items[index].Name, err))
|
||||
}
|
||||
}
|
||||
return utilerrors.NewAggregate(errs)
|
||||
|
||||
Reference in New Issue
Block a user