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

Need help with configuring mount attribute for /var #1678

Open
CharudathGopal opened this issue Feb 13, 2025 · 9 comments
Open

Need help with configuring mount attribute for /var #1678

CharudathGopal opened this issue Feb 13, 2025 · 9 comments
Labels
kind/question Further information is requested

Comments

@CharudathGopal
Copy link

What steps did you take and what happened:

  1. I have Dockerfile using which I am creating an elemental ISO Image (registry.suse.com/suse/sl-micro/6.0/base-os-container:2.1.3-4.2)
  2. As a next step I am using Rancher Elemental UI to create a MachineRegistration, Build ISO, create K8s cluster etc. Here in the MachineRegistration I am using Cloud Configuration section to run certain commands, pass cloud-init, elemental options etc
  3. As a next step I want to configure /var to have index=on,nfs_export=on mount attributes, also want this change to be persisted in /etc/fstab

How can I achieve this ?

What did you expect to happen:

Anything else you would like to add:

Environment:

  • Elemental release version (use cat /etc/os-release):
NAME="SL-Micro"
VERSION="6.0"
VERSION_ID="6.0"
PRETTY_NAME="SUSE Linux Micro 6.0"
ID="sl-micro"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sl-micro:6.0"
HOME_URL="https://www.suse.com/products/micro/"
DOCUMENTATION_URL="https://documentation.suse.com/sl-micro/6.0/"
IMAGE_REPO="registry.suse.com/suse/sl-micro/6.0/base-os-container"
IMAGE_TAG="2.1.3-4.2"
IMAGE="registry.suse.com/suse/sl-micro/6.0/base-os-container:2.1.3-4.2"
TIMESTAMP=20241023161753
GRUB_ENTRY_NAME="SUSE Linux Micro"
  • Rancher version: RKE2
  • Kubernetes version (use kubectl version): 1.31.4
  • Cloud provider or hardware configuration: Running on VMware VMs
@kkaempf kkaempf added the kind/question Further information is requested label Feb 13, 2025
@kkaempf
Copy link
Contributor

kkaempf commented Feb 13, 2025

Please see config.yaml.example in elemental-toolkit on how to pass mount options.

@CharudathGopal
Copy link
Author

CharudathGopal commented Feb 13, 2025

@kkaempf I tried doing that.

  mount:
    extra-volumes:
      - mountpoint: /var
        device: LABEL=COS_OEM
        options: ["defaults", "index=on", "nfs_export=on"]

When I save the changes from the UI, it removes the mount section altogether. Looks like the MachineRegistration wont accept everything in https://github.com/rancher/elemental-toolkit/blob/main/config.yaml.example. Even the docs are little confusing around this.

Also, strict decoding error: unknown field "spec.config.elemental.mount" I see this error, if tried editing the K8s resource directly.

@kkaempf @davidcassany Appreciate any help around this.

@CharudathGopal
Copy link
Author

Image

@kkaempf
Copy link
Contributor

kkaempf commented Feb 14, 2025

Which version of Elemental, esp. elemental-operator are you running ?

@CharudathGopal
Copy link
Author

Yes using elemental-operator followed the steps here: https://elemental.docs.rancher.com/quickstart-ui

@kkaempf
Copy link
Contributor

kkaempf commented Feb 14, 2025

Yes using elemental-operator followed the steps here: https://elemental.docs.rancher.com/quickstart-ui

Sorry, this doesn't answer which version you're running.

@CharudathGopal
Copy link
Author

Sorry, my bad..

Elemental Version: 3.0

elemental-operator:1.6.

@frelon
Copy link
Contributor

frelon commented Feb 17, 2025

Hello!

The mount configuration is not yet implemented on the operator-side.

A workaround would be to use a cloud-config section to write the configuration file to /etc/elemental/config.d/.

@davidcassany
Copy link
Contributor

To add on top of what @frelon said, this should be handled as runtime configuration from the elemental-operator POV. I'd suggest to handle the mount configuration from the machine registration cloud-config, there are several ways but probably this is the most straight forward.

@CharudathGopal regarding the new configuration it is unclear to me if you are aiming to set /var to a different separate volume (e.g. an extra drive), if you are aiming to mount the Elemental persistent volume in /var (change the default /run/elemental/persistent to /var) or if you are just trying to set different mount options for the Elemental persistent volume.

Depending what are you exactly trying to achieve the configuration of the mount operation would be different.

The mount command can be configured from yaml and from and environment variables file. For v2.1.x images it uses an enviroment variables file (/run/elemental/mount-layout.env) defined in /system/oem/01_elemental-rootfs.yaml.

To just change the mount options of the Elemental persistent partition this could be achieved in machine registration by:

spec:
  config:
    cloud-config:
      stages:
        rootfs:
        - name: "Change mount options for persistent partition"
          files:
          - path: "/run/elemental/config.d/mount_options.yaml"
            content: |
              mount:
                persistent:
                  volume:
                    options: ['defaults', 'index=on', 'nfs_export=on']

Note I am using the /run/elemental/config.d path instead of /etc/elemental/config.d, both are functional, with the difference that changes under /run will be visible after switching root, as rootfs stage happens inside the initramfs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Further information is requested
Projects
Status: No status
Development

No branches or pull requests

4 participants