Skip to content

Instantly share code, notes, and snippets.

@agracey
Last active August 1, 2022 15:07
Show Gist options
  • Save agracey/9d053ca7e0adef6fe7e8bb9b7687f4f9 to your computer and use it in GitHub Desktop.
Save agracey/9d053ca7e0adef6fe7e8bb9b7687f4f9 to your computer and use it in GitHub Desktop.
apiVersion: v1
data:
config: |-
#cloud-config should be pulled from registration object via kubectl
elemental:
registration:
url: <Your registration here>
grub.cfg: |-
search --file --set=root /boot/kernel.xz
# Load custom config file
set custom="/boot/grub2/elementalversion"
search --no-floppy --file --set=custom_blk "${custom}"
if [ "${custom_blk}" ] ; then
load_env -f "(${custom_blk})${custom}"
fi
set default=0
set timeout=10
set timeout_style=menu
set linux=linux
set initrd=initrd
if [ "${grub_cpu}" = "x86_64" -o "${grub_cpu}" = "i386" -o "${grub_cpu}" = "arm64" ];then
if [ "${grub_platform}" = "efi" ]; then
if [ "${grub_cpu}" != "arm64" ]; then
set linux=linuxefi
set initrd=initrdefi
fi
fi
fi
if [ "${grub_platform}" = "efi" ]; then
echo "Please press 't' to show the boot menu on this console"
fi
set font=($root)/boot/${grub_cpu}/loader/grub2/fonts/unicode.pf2
if [ -f ${font} ];then
loadfont ${font}
fi
menuentry "Elemental Teal Install ${version}" --class os --unrestricted {
echo Loading kernel...
$linux ($root)/boot/kernel.xz cdroot root=live:CDLABEL=COS_LIVE rd.live.dir=/ rd.live.squashimg=rootfs.squashfs console=tty1 console=ttyS0 rd.cos.disable
echo Loading initrd...
$initrd ($root)/boot/rootfs.xz
}
if [ "${grub_platform}" = "efi" ]; then
hiddenentry "Text mode" --hotkey "t" {
set textmode=true
terminal_output console
}
fi
kind: ConfigMap
metadata:
name: elemental-build-config
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: build-host-iso
spec:
selector:
matchLabels:
app: build-host-iso
replicas: 1
template:
metadata:
labels:
app: build-host-iso
workload.user.cattle.io/workloadselector: apps.deployment-default-build-host-iso
spec:
initContainers:
- name: build-iso
image: registry.opensuse.org/isv/rancher/elemental/teal52/15.3/rancher/elemental-builder-image:latest
volumeMounts:
- name: public
mountPath: /mnt/public/
- name: tmp
mountPath: /tmp/
- name: config
mountPath: /iso/overlay/boot/grub2/grub.cfg
subPath: grub.cfg
- name: config
mountPath: /iso/overlay/livecd-cloud-config.yaml
subPath: config
workingDir: /iso/
command: ["/usr/bin/elemental"]
args:
- build-iso
- -o
- /mnt/public
- --squash-no-compression
- -n
- elemental
- --overlay-iso
- overlay
- oci:registry.opensuse.org/isv/rancher/elemental/teal52/15.3/rancher/elemental-node-image/5.2:29.2
containers:
- name: host
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: public
mountPath: /usr/share/nginx/html
volumes:
- name: public
emptyDir: {}
- name: tmp
emptyDir: {}
- name: config
configMap:
name: elemental-build-config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment