diff --git a/api/v1alpha2/osartifact_types.go b/api/v1alpha2/osartifact_types.go index 5156775..d182010 100644 --- a/api/v1alpha2/osartifact_types.go +++ b/api/v1alpha2/osartifact_types.go @@ -49,8 +49,9 @@ type OSArtifactSpec struct { CloudConfigRef *SecretKeySelector `json:"cloudConfigRef,omitempty"` GRUBConfig string `json:"grubConfig,omitempty"` - Bundles []string `json:"bundles,omitempty"` - OSRelease string `json:"osRelease,omitempty"` + Bundles []string `json:"bundles,omitempty"` + OSRelease string `json:"osRelease,omitempty"` + KairosRelease string `json:"kairosRelease,omitempty"` ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"` Exporters []batchv1.JobSpec `json:"exporters,omitempty"` diff --git a/controllers/job.go b/controllers/job.go index 2f07c4a..a1f024b 100644 --- a/controllers/job.go +++ b/controllers/job.go @@ -107,6 +107,29 @@ func osReleaseContainer(containerImage string) corev1.Container { } } +func kairosReleaseContainer(containerImage string) corev1.Container { + return corev1.Container{ + ImagePullPolicy: corev1.PullAlways, + Name: "kairos-release", + Image: containerImage, + Command: []string{"/bin/bash", "-cxe"}, + Args: []string{ + "cp -rfv /etc/kairos-release /rootfs/etc/kairos-release", + }, + VolumeMounts: []corev1.VolumeMount{ + { + Name: "config", + MountPath: "/etc/kairos-release", + SubPath: "kairos-release", + }, + { + Name: "rootfs", + MountPath: "/rootfs", + }, + }, + } +} + func (r *OSArtifactReconciler) newArtifactPVC(artifact *osbuilder.OSArtifact) *corev1.PersistentVolumeClaim { if artifact.Spec.Volume == nil { artifact.Spec.Volume = &corev1.PersistentVolumeClaimSpec{ @@ -358,6 +381,9 @@ func (r *OSArtifactReconciler) newBuilderPod(pvcName string, artifact *osbuilder if artifact.Spec.OSRelease != "" { podSpec.InitContainers = append(podSpec.InitContainers, osReleaseContainer(r.ToolImage)) } + if artifact.Spec.KairosRelease != "" { + podSpec.InitContainers = append(podSpec.InitContainers, kairosReleaseContainer(r.ToolImage)) + } if artifact.Spec.ISO || artifact.Spec.Netboot { podSpec.Containers = append(podSpec.Containers, buildIsoContainer) diff --git a/tools-image/Dockerfile b/tools-image/Dockerfile index 9f4da05..0636eb9 100644 --- a/tools-image/Dockerfile +++ b/tools-image/Dockerfile @@ -1,7 +1,7 @@ # https://quay.io/repository/kairos/packages?tab=tags&tag=latest ARG LEAP_VERSION=15.5 ARG LUET_VERSION=0.35.5 -ARG ENKI_VERSION=0.1.2 +ARG ENKI_VERSION=0.2.0 FROM quay.io/luet/base:$LUET_VERSION AS luet FROM quay.io/kairos/enki:v${ENKI_VERSION} as enki @@ -86,7 +86,7 @@ RUN mkdir /config COPY ./config.yaml /config/manifest.yaml COPY ./entrypoint.sh /entrypoint.sh COPY ./add-cloud-init.sh /add-cloud-init.sh -COPY ./os-release.tmpl /os-release.tmpl +COPY ./kairos-release.tmpl /kairos-release.tmpl COPY ./ipxe.tmpl /ipxe.tmpl COPY ./update-os-release.sh /update-os-release.sh diff --git a/tools-image/os-release.tmpl b/tools-image/kairos-release.tmpl similarity index 100% rename from tools-image/os-release.tmpl rename to tools-image/kairos-release.tmpl diff --git a/tools-image/luet-amd64.yaml b/tools-image/luet-amd64.yaml index b193ac9..9a3fddb 100644 --- a/tools-image/luet-amd64.yaml +++ b/tools-image/luet-amd64.yaml @@ -13,4 +13,4 @@ repositories: urls: - "quay.io/kairos/packages" # renovate: datasource=docker depName=quay.io/kairos/packages - reference: 202407181636-gitee2bb9c7-repository.yaml + reference: 202410070953-git9232f7ee-repository.yaml diff --git a/tools-image/luet-arm64.yaml b/tools-image/luet-arm64.yaml index b70449f..812e611 100644 --- a/tools-image/luet-arm64.yaml +++ b/tools-image/luet-arm64.yaml @@ -13,4 +13,4 @@ repositories: urls: - "quay.io/kairos/packages-arm64" # renovate: datasource=docker depName=quay.io/kairos/packages-arm64 - reference: 202407181651-gitee2bb9c7-repository.yaml + reference: 202410071128-git9232f7ee-repository.yaml diff --git a/tools-image/update-os-release.sh b/tools-image/update-os-release.sh index 8defc8a..00f064f 100755 --- a/tools-image/update-os-release.sh +++ b/tools-image/update-os-release.sh @@ -17,7 +17,9 @@ set -ex +[ -f "/workspace/kairos-release" ] && sed -i -n '/KAIROS_/!p' /workspace/kairos-release +# Clean up old os-release just in case so we dont have stuff lying around sed -i -n '/KAIROS_/!p' /workspace/os-release -envsubst >>/workspace/os-release < /os-release.tmpl +envsubst >>/workspace/kairos-release < /kairos-release.tmpl -cat /workspace/os-release +cat /workspace/kairos-release