Add osRelease field

This commit is contained in:
Ettore Di Giacinto
2022-09-09 15:09:20 +00:00
parent b3e7dcbf59
commit 680907ab43
4 changed files with 21 additions and 11 deletions

View File

@@ -81,23 +81,24 @@ func createImageContainer(containerImage string, pushOptions buildv1alpha1.Push)
}
}
func pushImageContainer(containerImage string, pushOptions buildv1alpha1.Push) v1.Container {
func osReleaseContainer(containerImage string) v1.Container {
return v1.Container{
ImagePullPolicy: v1.PullAlways,
Name: "push-image",
Name: "os-release",
Image: containerImage,
Command: []string{"/bin/bash", "-cxe"},
Args: []string{
fmt.Sprintf(
"skopeo /public/image.tar %s",
pushOptions.ImageName,
),
"cp -rfv /etc/os-release /rootfs/etc/os-release",
},
VolumeMounts: []v1.VolumeMount{
{
Name: "public",
MountPath: "/public",
Name: "config",
MountPath: "/etc/os-release",
SubPath: "os-release",
},
{
Name: "rootfs",
MountPath: "/rootfs",
},
},
}
@@ -189,6 +190,11 @@ func (r *OSArtifactReconciler) genDeployment(artifact buildv1alpha1.OSArtifact)
pod.InitContainers = append(pod.InitContainers, unpackContainer(fmt.Sprint(i), r.ToolImage, bundle, artifact.Spec.PullOptions))
}
if artifact.Spec.OSRelease != "" {
pod.InitContainers = append(pod.InitContainers, osReleaseContainer(r.ToolImage))
}
pod.InitContainers = append(pod.InitContainers, buildIsoContainer)
if pushImage {