@@ -317,7 +317,7 @@ func (r *SeedImageReconciler) reconcileConfigMapObject(ctx context.Context, seed
317317 return fmt .Errorf ("failed marshalling cloud-config: %w" , err )
318318 }
319319
320- outputName := fmt .Sprintf ("elemental- %s-%s.%s" , seedImg . Spec . MachineRegistrationRef .Name , time .Now ().Format (time .RFC3339 ), seedImg .Spec .Type )
320+ outputName := fmt .Sprintf ("%s-%s.%s" , mRegistration .Name , time .Now ().Format (time .RFC3339 ), seedImg .Spec .Type )
321321
322322 if err := r .Get (ctx , types.NamespacedName {
323323 Name : seedImg .Name ,
@@ -448,13 +448,21 @@ func (r *SeedImageReconciler) updateStatusFromPod(ctx context.Context, seedImg *
448448 return errMsg
449449 }
450450
451- // Use the registration name or else default to "elemental" for the image file name
452- imageName := "elemental"
453- if seedImg .Spec .MachineRegistrationRef != nil && len (seedImg .Spec .MachineRegistrationRef .Name ) > 0 {
454- imageName = seedImg .Spec .MachineRegistrationRef .Name
451+ podConfigMap := & corev1.ConfigMap {}
452+ if err := r .Get (ctx , types.NamespacedName {
453+ Name : seedImg .Name ,
454+ Namespace : seedImg .Namespace ,
455+ }, podConfigMap ); err != nil {
456+ return fmt .Errorf ("getting ConfigMap '%s': %w" , seedImg .Name , err )
457+ }
458+ outputName , found := podConfigMap .Data [configMapKeyOutputName ]
459+ if ! found {
460+ return fmt .Errorf ("Could not find '%s' value in ConfigMap '%s'" , configMapKeyOutputName , seedImg .Name )
455461 }
462+
456463 seedImg .Status .DownloadToken = token
457- seedImg .Status .DownloadURL = fmt .Sprintf ("https://%s/elemental/seedimage/%s/%s.%s" , rancherURL , token , imageName , seedImg .Spec .Type )
464+ seedImg .Status .DownloadURL = fmt .Sprintf ("https://%s/elemental/seedimage/%s/%s" , rancherURL , token , outputName )
465+ seedImg .Status .ChecksumURL = fmt .Sprintf ("%s.sha256" , seedImg .Status .DownloadURL )
458466 meta .SetStatusCondition (& seedImg .Status .Conditions , metav1.Condition {
459467 Type : elementalv1 .SeedImageConditionReady ,
460468 Status : metav1 .ConditionTrue ,
@@ -482,6 +490,7 @@ func (r *SeedImageReconciler) updateStatusFromPod(ctx context.Context, seedImg *
482490 return errMsg
483491 }
484492 seedImg .Status .DownloadURL = ""
493+ seedImg .Status .ChecksumURL = ""
485494 meta .SetStatusCondition (& seedImg .Status .Conditions , metav1.Condition {
486495 Type : elementalv1 .SeedImageConditionReady ,
487496 Status : metav1 .ConditionTrue ,
@@ -519,6 +528,7 @@ func (r *SeedImageReconciler) deleteChildResources(ctx context.Context, seedImg
519528 }
520529 }
521530 seedImg .Status .DownloadURL = ""
531+ seedImg .Status .ChecksumURL = ""
522532
523533 foundSvc := & corev1.Service {}
524534 svcName := seedImg .Name
@@ -593,14 +603,13 @@ func fillBuildImagePod(seedImg *elementalv1.SeedImage, buildImg string, pullPoli
593603 ContainerPort : 80 ,
594604 },
595605 },
596- Args : []string {"-d" , "$(ELEMENTAL_OUTPUT_NAME) " , "-t" , fmt .Sprintf ("%d" , deadline * 60 )},
606+ Args : []string {"-d" , "/srv " , "-t" , fmt .Sprintf ("%d" , deadline * 60 )},
597607 VolumeMounts : []corev1.VolumeMount {
598608 {
599609 Name : "iso-storage" ,
600610 MountPath : "/srv" ,
601611 },
602612 },
603- WorkingDir : "/srv" ,
604613 Env : []corev1.EnvVar {
605614 {
606615 Name : "ELEMENTAL_OUTPUT_NAME" ,
@@ -672,6 +681,8 @@ func defaultRawInitContainers(seedImg *elementalv1.SeedImage, buildImg string, p
672681 --system $(ELEMENTAL_BASE_IMAGE)` , platformArg ),
673682
674683 "mv /iso/elemental.raw /iso/$(ELEMENTAL_OUTPUT_NAME)" ,
684+
685+ "cd /iso && sha256sum $(ELEMENTAL_OUTPUT_NAME) > $(ELEMENTAL_OUTPUT_NAME).sha256 && cd ../" ,
675686 }
676687
677688 return []corev1.Container {
@@ -725,6 +736,8 @@ func defaultIsoInitContainers(seedImg *elementalv1.SeedImage, buildImg string, p
725736 )
726737 }
727738
739+ buildCommands = append (buildCommands , "cd /iso && sha256sum $(ELEMENTAL_OUTPUT_NAME) > $(ELEMENTAL_OUTPUT_NAME).sha256 && cd ../" )
740+
728741 containers = append (
729742 containers , corev1.Container {
730743 Name : "build" ,
0 commit comments