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

How to configure mdadm.conf? #429

Open
thoro opened this issue Jul 18, 2024 · 14 comments
Open

How to configure mdadm.conf? #429

thoro opened this issue Jul 18, 2024 · 14 comments

Comments

@thoro
Copy link

thoro commented Jul 18, 2024

Hello,

I do not want mdadm to auto assemble arrays for me, how can I add:

AUTO -all

to the mdadm.conf file?

@frezbo
Copy link
Member

frezbo commented Jul 18, 2024

this is not possible at the moment, but this can be made configurable via ExtensionServiceConfig

@thoro
Copy link
Author

thoro commented Jul 18, 2024

Do you have an example how this could be integrated into an extension? I maybe would be willing to create a PR for the mdadm extension then.

@frezbo
Copy link
Member

frezbo commented Jul 18, 2024

you can take a look at nut-client extension, the mdadm extension probably needs a flag to point to a config file

@thoro
Copy link
Author

thoro commented Jul 18, 2024

mdadm implicitly reads the config file, because it's called via udevd (rules defined in the extension)

the usual place is /etc/mdadm.conf, can you also set it at this location via the ExtensionServiceConfig?

@frezbo
Copy link
Member

frezbo commented Jul 18, 2024

mdadm implicitly reads the config file, because it's called via udevd (rules defined in the extension)

the usual place is /etc/mdadm.conf, can you also set it at this location via the ExtensionServiceConfig?

we might have to compile mdadm to use a custom path then, extensions only allow /usr/local

@thoro
Copy link
Author

thoro commented Jul 18, 2024

I tried to just apply an ExtensionServiceConfig now, but talosctl ls /usr/local/etc/mdadm.conf reports non-existing.

apiVersion: v1alpha1
kind: ExtensionServiceConfig
name: mdadm
configFiles:
  - content: |-
        AUTO -all
    mountPath: /usr/local/etc/mdadm.conf

When are those configs applied? Do you need to run a container in the extension? Are the names supposed to be the same as the extension?

@frezbo
Copy link
Member

frezbo commented Jul 18, 2024

I tried to just apply an ExtensionServiceConfig now, but talosctl ls /usr/local/etc/mdadm.conf reports non-existing.

apiVersion: v1alpha1
kind: ExtensionServiceConfig
name: mdadm
configFiles:
  - content: |-
        AUTO -all
    mountPath: /usr/local/etc/mdadm.conf

When are those configs applied? Do you need to run a container in the extension? Are the names supposed to be the same as the extension?

yes, it only gets in effect when there is an extension with the same name

@thoro
Copy link
Author

thoro commented Jul 18, 2024

I checked the executable, and looks like the path is sadly not compiled in correctly.

 salt/talos  (k8s: admin@dc-at-prod-02) $ talosctl --talosconfig=.talosconfig  -n dc-at-prod-02-h01 get extensions 2
NODE                NAMESPACE   TYPE              ID   VERSION   NAME    VERSION
dc-at-prod-02-h01   runtime     ExtensionStatus   2    1         mdadm   v4.2
 salt/talos  (k8s: admin@dc-at-prod-02) $ talosctl --talosconfig=.talosconfig  -n dc-at-prod-02-h01 get extensionserviceconfig mdadm
NODE                NAMESPACE   TYPE                     ID      VERSION
dc-at-prod-02-h01   runtime     ExtensionServiceConfig   mdadm   1
 salt/talos  (k8s: admin@dc-at-prod-02) $ talosctl --talosconfig=.talosconfig  -n dc-at-prod-02-h01 get extensionserviceconfig mdadm -o yaml;
node: dc-at-prod-02-h01
metadata:
    namespace: runtime
    type: ExtensionServiceConfigs.runtime.talos.dev
    id: mdadm
    version: 1
    owner: runtime.ExtensionServiceConfigController
    phase: running
    created: 2024-07-18T12:05:45Z
    updated: 2024-07-18T12:05:45Z
spec:
    files:
        - content: AUTO -all
          mountPath: /usr/local/etc/mdadm.conf
 salt/talos  (k8s: admin@dc-at-prod-02) $ talosctl --talosconfig=.talosconfig  -n dc-at-prod-02-h01 ls /usr/local/etc/mdadm.conf
NODE   NAME
1 error occurred:
 rpc error: code = Unknown desc = lstat /usr/local/etc/mdadm.conf: no such file or directory

I have readded the mdadm extension to my cluster, but the ExtensionServiceConfig is still not applied as expected - ideas?

@thoro
Copy link
Author

thoro commented Jul 18, 2024

@frezbo Can you check this one here: #430 ?

@frezbo
Copy link
Member

frezbo commented Jul 18, 2024

ahh ExtensionServiceConfig is currently only for extension services, not plain extensions

Also can we specify the config file here: https://github.com/siderolabs/extensions/blob/main/storage/mdadm/files/udev-md-raid-arrays.rules#L20?

@thoro
Copy link
Author

thoro commented Jul 18, 2024

sadly not, it's hardcoded in the source via define, there's no option to pass config file via cli args

Edit: Sorry, I was wrong .. seems to be a -c option!

@thoro
Copy link
Author

thoro commented Jul 18, 2024

is there a build services to get a test image out of the PR - I can't build it on my M2 mac
Edit: solved it, I added by mistake a space into the pkg.yaml, that removed an important build env var.

@thoro
Copy link
Author

thoro commented Jul 18, 2024

@frezbo I added the the -c option to specify the config file in the udev rules. What I do not understand yet, is how to get a config file into that folder anyways 😃

Edit: I think the config file is rather well stored under /var/lib/mdadm/mdadm.conf but please let me know what's the correct destination, and how to actually edit that file then.

@frezbo
Copy link
Member

frezbo commented Jul 23, 2024

@frezbo I added the the -c option to specify the config file in the udev rules. What I do not understand yet, is how to get a config file into that folder anyways 😃

Edit: I think the config file is rather well stored under /var/lib/mdadm/mdadm.conf but please let me know what's the correct destination, and how to actually edit that file then.

we don't have a good way in talos now to get a config file or have a default one so that the it doesn't break existing config, let's keep a hold on to this until we have a better solution from talos/extensions side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants