Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to use kairos-release #184

Merged
merged 3 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions api/v1alpha2/osartifact_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
26 changes: 26 additions & 0 deletions controllers/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tools-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# 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

Check warning on line 7 in tools-image/Dockerfile

View workflow job for this annotation

GitHub Actions / docker

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

FROM opensuse/leap:$LEAP_VERSION as default

Check warning on line 9 in tools-image/Dockerfile

View workflow job for this annotation

GitHub Actions / docker

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
RUN zypper ref && zypper dup -y
## ISO+ Arm image + Netboot + cloud images Build depedencies
RUN zypper ref && zypper in -y bc qemu-tools jq cdrtools docker git curl gptfdisk kpartx sudo xfsprogs parted binutils \
Expand Down Expand Up @@ -86,7 +86,7 @@
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

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tools-image/luet-amd64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion tools-image/luet-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions tools-image/update-os-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need the os-release fallback here too? What is this script used for? I can't find a consumer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our examples use it in the kairos repo. we should change those to use kairos-agent directly somehow and then we can deprecate this


cat /workspace/os-release
cat /workspace/kairos-release
Loading