adamant-kite-43734
10/15/2024, 10:38 AMsticky-tailor-45974
10/17/2024, 9:44 AMapiVersion: elemental.cattle.io/v1beta1
kind: MachineRegistration
metadata:
...
spec:
...
config:
cloud-config:
stages:
after-install-chroot:
- &extraPackages
name: "Install additional software"
commands:
- |
echo "Some shell script is executed here to include extra packages|binaries"
after-upgrade-chroot:
- <<: *extraPackages
after-reset-chroot:
- <<: *extraPackages
This would include a shell script snippted that would be executed in install, upgrade and reset in a chroot of the to be deployed system before it is marked as read only.sticky-tailor-45974
10/17/2024, 10:36 AMAmazing to see the newsl-micro 6.0
base/bare-metal/kvm images and the new documentation on channels (oh
and the ability to build raw images in the Rancher GUI!!). I personally
find it strange though that theimage swapskvmout forkernel-default, and also doesn’t add any of the packages thatkernel-default-basegets. Surely thebaremetalimage should have the smaller kernel package, andbaseliterally just addkvmontop ofqemu-guest-agent?baremetal
I can’t think why we wouldn’t want access to the same packages as a
baremetal env just because we’re virtualised, keen to know the rationale
behind this. My main interest in this is that I think thebaremetal
image finally supports all the requirements for Longhorn (I haven’t
100% tested this yet), but because I also need the guest agent, it’s not
much use to me.So, the rationale is the following:
baremetal image includes all firmware available for a wide variety of hardware plus some commodity packages already in (podman, network tools, etc.). kvm flavor was just meant to be a minimal image to verify against libvirt, so essentially the base image plus kvm specific packages and uses the base kernel and the firmware scope will be reduced in virtualized environments.
I understand your concern regarding the package set of the images, specially if you are willing for images with extra commodity packages and kvm related ones. We are well aware this can be improved and feedback like yours is valuable to us.sticky-tailor-45974
10/17/2024, 10:42 AM@sticky-tailor-45974 Is this documentation still the best/only way to add LVMs? I’d be curious to know more about this comment as I can’t figure out how I might achieve this by only modifying the SeedImage resourceYes all this should be still valid, but most likely all this can achieved easier now. I'll go through it and try to update it in the following days. The
SeedImage resource includes as cloud-config section that is added to iso-config/ into the resulting ISO filesystem.acoustic-country-10006
10/18/2024, 5:23 PMafter-install-chroot method.
Given the options I now have for adding packages to images I’m less concerned with the package sets in official images but glad that’s helpful feedback.
I’ll see where I can get to with adding LVMs via SeedImages on Monday, thanks again!acoustic-country-10006
10/22/2024, 10:18 AMpost-install stage from my seedImage seems to work great. I’m having some difficulty mounting them however.
Following the guide above, I understand that modifications to /etc/fstab should be done at the initramfs stage, and because I know from examples in the cloud-config & MachineRegistration reference, this stage can be hooked into from the Registration Endpoint. As such, I tried putting my command in there, but something doesn’t seem quite right…
apiVersion: <http://elemental.cattle.io/v1beta1|elemental.cattle.io/v1beta1>
kind: MachineRegistration
metadata:
creationTimestamp: '2024-10-08T13:05:58Z'
generation: 16
managedFields:
- apiVersion: <http://elemental.cattle.io/v1beta1|elemental.cattle.io/v1beta1>
fieldsType: FieldsV1
fieldsV1:
f:status:
.: {}
f:conditions: {}
f:registrationToken: {}
f:registrationURL: {}
f:serviceAccountRef: {}
manager: elemental-operator
operation: Update
subresource: status
time: '2024-10-15T12:43:37Z'
- apiVersion: <http://elemental.cattle.io/v1beta1|elemental.cattle.io/v1beta1>
fieldsType: FieldsV1
fieldsV1:
f:spec:
.: {}
f:config:
.: {}
f:cloud-config:
.: {}
f:stages:
.: {}
f:initramfs: {}
f:users: {}
f:elemental:
.: {}
f:install:
.: {}
f:device: {}
f:reboot: {}
f:snapshotter:
.: {}
f:type: {}
f:reset:
.: {}
f:reboot: {}
f:reset-oem: {}
f:reset-persistent: {}
f:machineName: {}
manager: rancher
operation: Update
time: '2024-10-22T09:56:55Z'
name: elemental
namespace: fleet-default
resourceVersion: '8146715'
uid: 129139f5-96ff-4d4a-92dc-1f37a586f5f7
spec:
config:
cloud-config:
stages:
initramfs:
- commands:
- echo "Mount LVM for longhorn at boot"
name: Mount LVM for longhorn at boot
users:
- name: root
passwd: root
elemental:
install:
device: /dev/vda
reboot: true
snapshotter:
type: loopdevice
reset:
reboot: true
reset-oem: true
reset-persistent: true
machineName: ${System Data/Runtime/Hostname}
status:
conditions:
- lastTransitionTime: '2024-10-15T12:43:37Z'
message: ''
reason: SuccessfullyCreated
status: 'True'
type: Ready
registrationToken: 86wchwtdhfr95trqw8x57p7k9njjmzmqqbwxk6gv7mft2pgpt2hk6j
registrationURL: >-
<https://rancher.10.0.0.11.nip.io/elemental/registration/86wchwtdhfr95trqw8x57p7k9njjmzmqqbwxk6gv7mft2pgpt2hk6j>
serviceAccountRef:
kind: ServiceAccount
name: elemental
namespace: fleet-default
Even if my command is just an echo as in the example above (I was trying to verify my command wasn’t failing or anything), I can no longer log into my elemental machine with the user in my cloud config, which suggests this stage hook isn’t working properly and the rest of my cloud-config isn’t getting executed or something? Since I can’t log in, I can’t check any logs/see if my command has had any effect. If I omit the stages section, I can log in just fine. Any ideas what’s wrong here?acoustic-country-10006
10/23/2024, 9:40 AMsticky-tailor-45974
10/24/2024, 4:32 PMcloud-config syntax, it mixes cloud-init syntax with yip syntax, from v1.6 yip syntax is also possible but not together it is one or either the other, not both.
So
cloud-config:
stages:
initramfs:
- commands:
- echo "Mount LVM for longhorn at boot"
name: Mount LVM for longhorn at boot
users:
- name: root
passwd: root
should be translated into:
cloud-config:
stages:
initramfs:
- name: "Mount LVM for longhorn at boot"
commands:
- echo "Mount LVM"
boot:
- name: "Setting root user password"
users:
root:
passwd: rootsticky-tailor-45974
10/24/2024, 4:38 PMacoustic-country-10006
10/28/2024, 4:12 PMacoustic-country-10006
10/28/2024, 7:58 PMacoustic-country-10006
10/28/2024, 8:01 PMacoustic-country-10006
10/28/2024, 8:48 PM