Skip to content

Commit

Permalink
daemon/pinned-image-set: ensure cleanup of crio config file on delete
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Batschelet <[email protected]>
  • Loading branch information
hexfusion committed Apr 26, 2024
1 parent 836dd8d commit fd2c36e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/daemon/pinned_image_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func (p *PinnedImageSetManager) syncMachineConfigPools(ctx context.Context, pool
}
if !exists {
p.cache.Clear()
return errFailedToPullImage
return fmt.Errorf("%w: image removed during sync: %s", errFailedToPullImage, image)
}
}

Expand Down Expand Up @@ -497,6 +497,8 @@ func ensureCrioPinnedImagesConfigFile(path string, imageNames []string) error {
return fmt.Errorf("failed to remove CRI-O config file: %w", err)
}
return crioReload()
} else if len(imageNames) == 0 {
return nil
}

var existingCfgBytes []byte
Expand Down Expand Up @@ -1180,6 +1182,10 @@ func uniqueSortedImageNames(images []mcfgv1alpha1.PinnedImageRef) []string {

for _, image := range images {
if _, ok := seen[image.Name]; !ok {
trimmedName := strings.TrimSpace(image.Name)
if trimmedName == "" {
continue
}
seen[image.Name] = struct{}{}
unique = append(unique, image.Name)
}
Expand Down

0 comments on commit fd2c36e

Please sign in to comment.