replicatedhq / troubleshoot

Preflight Checks and Support Bundles Framework for Kubernetes Applications
https://troubleshoot.sh
Apache License 2.0
539 stars 92 forks source link

Allow kernelConfig analyser to check kernel capability is either built in or loaded #1563

Closed banjoh closed 1 week ago

banjoh commented 1 month ago

Describe the rationale for the suggested feature.

When we define an analyser to check for the availability of a kernel config, it would look something like this

- kernelConfigs:
    selectedConfigs:
      - CONFIG_CGROUP_FREEZER=y
      - CONFIG_NETFILTER_XTABLES=m
    outcomes:
      - pass:
          message: "required kernel configs are available"
      - fail:
          message: "missing kernel config(s): {{ .ConfigsNotFound }}"

Values in the selectedConfigs list are checked using an AND operation i.e they all need to exist or not. In some environments, a kernel configuration may have been loaded as a module (m) or built into the kernel (y) depending of the kernel version. We are not able to have a spec like below to allow a preflight to capture both cases.

    selectedConfigs:
      - CONFIG_CGROUP_FREEZER=y
      - CONFIG_CGROUP_FREEZER=m

This will limit users to just detecting a configuration is either loaded as a module or in-built into the kernel.

Describe the feature

Have the analyser accept a config with multiple values i.e CONFIG_X=my. This would mean that we would be able to define a spec like below which would check whether a kernel configuration exists irrelevant of whether it was loaded as a module or in-built into the kernel. The ability of checking one of the other (m or y) is still preserved with this approach.

- kernelConfigs:
    selectedConfigs:
      - CONFIG_CGROUP_FREEZER=my
      - CONFIG_NETFILTER_XTABLES=my
    outcomes:
      - pass:
          message: "required kernel configs are available"
      - fail:
          message: "missing kernel config(s): {{ .ConfigsNotFound }}"
xavpaice commented 3 weeks ago

Internal tracking: https://app.shortcut.com/replicated/story/106927/allow-kernelconfig-analyser-to-check-kernel-capability-is-either-built-in-or-loaded-for-ec-host-preflights