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

Support running shell script on Node boot #1729

Open
renchap opened this issue Oct 30, 2023 · 5 comments
Open

Support running shell script on Node boot #1729

renchap opened this issue Oct 30, 2023 · 5 comments
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@renchap
Copy link

renchap commented Oct 30, 2023

In some environments, you might need to run some shell commands on node boot.

For example, with Hetzner, you need to enable Receive Packet Steering on your Cloud servers if you are managing a lot of packets on some pods, otherwise you will have the IRQs for the network card on one core, saturating it and slowing everything down.

I could not find a way to have a MachineDeployment run a command after booting on a node.

I tried various forms around this, but the resulting OperatingSystemConfig never include those:

      providerSpec:
        value:
          cloudProvider: hetzner
          cloudProviderSpec:
            image: ubuntu-22.04
          operatingSystem: ubuntu
          operatingSystemSpec:
            distUpgradeOnBoot: true
            provisioningConfig:
              modules:
                runcmd:
                - "echo \"test\" > /tmp/test_bootstrap"

This object is accepted and written on the k8s server, but the runcmd script is never written anywhere I can see. I am not sure if this is a bug, or a missing feature.

I understood that an alternative would be to have a custom OperatingSystemProfile, but it means keeping it up-to-date with newer versions, which is burdensome.

@embik
Copy link
Member

embik commented Oct 30, 2023

Hey @renchap 👋🏻

This object is accepted and written on the k8s server, but the runcmd script is never written anywhere I can see. I am not sure if this is a bug, or a missing feature.

This missing piece of feedback is unfortunately caused by the technical implementation of CAPI v1alpha1, which machine-controller built upon. Fields are not strongly typed, so requests trying to edit arbitrary fields like providerSpec.operatingSystemSpec.provisioningConfig (which does not exist and isn't used anywhere) are not rejected, but do not serve any purpose. Since there is no feature intended here, I would not consider this a bug.

I understood that an alternative would be to have a custom OperatingSystemProfile, but it means keeping it up-to-date with newer versions, which is burdensome.

At the moment OSPs are our only supported way of customising node bootstrapping. I understand that keeping things up to date requires more maintenance, but fundamentally we cannot know what kind of customisations are added and if they interfere with things our default bootstrapping does. Customisation requires more maintenance. At the same time, we appreciate the feedback that maintaining custom OSPs is "too much". We have been tracking a discussion to harmonise the process over at kubermatic/kubermatic#12310.

Would a way to pre-process your custom OSP, e.g. via some templating engine (or similar so something like kustomize) help you?

@renchap
Copy link
Author

renchap commented Oct 30, 2023

Yes, this would make sense. Having an easy way to create our custom OSP, inserting snippets where we need them, would be useful here.

@kubermatic-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.
After a furter 30 days, they will turn rotten.
Mark the issue as fresh with /remove-lifecycle stale.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@kubermatic-bot kubermatic-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 29, 2024
@renchap
Copy link
Author

renchap commented Jan 29, 2024

/remove-lifecycle stale

@kubermatic-bot kubermatic-bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 29, 2024
@kubermatic-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.
After a furter 30 days, they will turn rotten.
Mark the issue as fresh with /remove-lifecycle stale.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@kubermatic-bot kubermatic-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

3 participants