mirror of
https://github.com/kairos-io/osbuilder.git
synced 2025-08-21 09:13:31 +00:00
Add osRelease field
This commit is contained in:
parent
b3e7dcbf59
commit
680907ab43
@ -37,6 +37,7 @@ type OSArtifactSpec struct {
|
|||||||
|
|
||||||
Bundles []string `json:"bundles,omitempty"`
|
Bundles []string `json:"bundles,omitempty"`
|
||||||
PullOptions Pull `json:"pull,omitempty"`
|
PullOptions Pull `json:"pull,omitempty"`
|
||||||
|
OSRelease string `json:"osRelease,omitempty"`
|
||||||
PushOptions Push `json:"push,omitempty"`
|
PushOptions Push `json:"push,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +51,8 @@ spec:
|
|||||||
type: string
|
type: string
|
||||||
iso:
|
iso:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
osRelease:
|
||||||
|
type: string
|
||||||
pull:
|
pull:
|
||||||
properties:
|
properties:
|
||||||
containerRegistryCredentials:
|
containerRegistryCredentials:
|
||||||
|
@ -34,5 +34,6 @@ func (r *OSArtifactReconciler) genConfigMap(artifact buildv1alpha1.OSArtifact) *
|
|||||||
Data: map[string]string{
|
Data: map[string]string{
|
||||||
"config": artifact.Spec.CloudConfig,
|
"config": artifact.Spec.CloudConfig,
|
||||||
"grub.cfg": artifact.Spec.GRUBConfig,
|
"grub.cfg": artifact.Spec.GRUBConfig,
|
||||||
|
"os-release": artifact.Spec.OSRelease,
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
@ -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{
|
return v1.Container{
|
||||||
ImagePullPolicy: v1.PullAlways,
|
ImagePullPolicy: v1.PullAlways,
|
||||||
Name: "push-image",
|
Name: "os-release",
|
||||||
Image: containerImage,
|
Image: containerImage,
|
||||||
Command: []string{"/bin/bash", "-cxe"},
|
Command: []string{"/bin/bash", "-cxe"},
|
||||||
Args: []string{
|
Args: []string{
|
||||||
fmt.Sprintf(
|
"cp -rfv /etc/os-release /rootfs/etc/os-release",
|
||||||
"skopeo /public/image.tar %s",
|
|
||||||
pushOptions.ImageName,
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
VolumeMounts: []v1.VolumeMount{
|
VolumeMounts: []v1.VolumeMount{
|
||||||
|
|
||||||
{
|
{
|
||||||
Name: "public",
|
Name: "config",
|
||||||
MountPath: "/public",
|
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))
|
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)
|
pod.InitContainers = append(pod.InitContainers, buildIsoContainer)
|
||||||
|
|
||||||
if pushImage {
|
if pushImage {
|
||||||
|
Loading…
Reference in New Issue
Block a user