harvester icon indicating copy to clipboard operation
harvester copied to clipboard

[ENHANCEMENT] Allow adding `Checksum` when creating a new `Image` from URL

Open votdev opened this issue 2 years ago • 1 comments

Is your enhancement related to a problem? Please describe.

When creating a new Image from URL, it would be great to specify the expected SHA512 checksum to do a validation after download. This feature is already available in the Longhorn UI. And since Harvester uses Longhorn's BackingImage for the images under the hood, the functionality is already given.

grafik

Describe the solution you'd like Add a input field in the UI to specify the SHA512 checksum of the downloaded file. Under the hood, the BackingImage API checksum field is populated with the checksum entered in the UI.

apiVersion: longhorn.io/v1beta2
kind: BackingImage
metadata:
  name: foo
  namespace: longhorn-system
spec:
  checksum: xxxxxx

Describe alternatives you've considered n/a

Additional context n/a

votdev avatar Feb 13 '24 14:02 votdev

The backend seems to supports this already.

apiVersion: harvesterhci.io/v1beta1
kind: VirtualMachineImage
metadata:
  name: image-systemrescue
  namespace: default
spec:
  retry: 0
  checksum: "10a3145a5101c00977091e7c946086edcc5e4acf8dfb57b1e912fdf27c23899cedc12cf14ef503a18a1018f917066149957d7460f3c080e2891af64cac05bc35"
  displayName: systemrescue-11.00-amd64.iso
  sourceType: download
  url: https://fastly-cdn.system-rescue.org/releases/11.00/systemrescue-11.00-amd64.iso

Modify the checksum to make it invalid.

grafik

votdev avatar Feb 13 '24 15:02 votdev

Pre Ready-For-Testing Checklist

  • [ ] Where is the reproduce steps/test steps documented? The reproduce steps/test steps are at: https://github.com/harvester/dashboard/pull/954#issuecomment-1961337375

  • [ ] If labeled: area/ui Has the UI issue filed or ready to be merged? The UI issue/PR is at: https://github.com/harvester/harvester/issues/5141

Automation e2e test issue: harvester/tests#1121