cluster-api icon indicating copy to clipboard operation
cluster-api copied to clipboard

✨ Add bootCommands to cloud-init file generation

Open davidumea opened this issue 1 year ago • 7 comments

What this PR does / why we need it: Adds the ability to provide bootcmd commands to cloud-init via the KubeadmConfig or KubeadmConfigTemplates custom resources. (Same for KubeadmControlPlane)

One thing that I know that does not work at the time of creating this PR is validating/mutating webhooks for KubeadmConfig and KubeadmConfigTemplates. Some pointers to where to change that would be appreciated.

Which issue(s) this PR fixes Fixes #

davidumea avatar Oct 08 '24 14:10 davidumea

Welcome @davidumea!

It looks like this is your first PR to kubernetes-sigs/cluster-api 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot avatar Oct 08 '24 14:10 k8s-ci-robot

Hi @davidumea. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Oct 08 '24 14:10 k8s-ci-robot

Are there version constraints around bootcmd? Does it already exist in cloud-init for a long time?

What happens if we render it but the cloud-init version in the machine does not support it? Does it make cloud-init fail as a whole or is it just ignored?

Edit: looks like it is already there for a long time (from the start?) at 0.7.7 https://cloudinit.readthedocs.io/en/0.7.7/topics/examples.html

chrischdi avatar Oct 08 '24 14:10 chrischdi

Are there version constraints around bootcmd? Does it already exist in cloud-init for a long time?

Edit: looks like it is already there for a long time (from the start?) at 0.7.7 https://cloudinit.readthedocs.io/en/0.7.7/topics/examples.html

Exactly I don't think that should be an issue as bootcmd has been part of cloud-init for a long time.

What happens if we render it but the cloud-init version in the machine does not support it? Does it make cloud-init fail as a whole or is it just ignored?

During my testing, if the bootcmd module fails e.g. due to invalid commands, cloud-init still continues with the following modules. I haven't been able to test running this with a cloud-init version that doesn't support bootcmd.

davidumea avatar Oct 09 '24 12:10 davidumea

@chrischdi Is there anything I can do to get this reviewed?

davidumea avatar Oct 17 '24 12:10 davidumea

/ok-to-test

cc @enxebre @vincepri @randomvariable

fabriziopandini avatar Oct 18 '24 08:10 fabriziopandini

/test help

chrischdi avatar Nov 25 '24 16:11 chrischdi

@chrischdi: The specified target(s) for /test were not found. The following commands are available to trigger required jobs:

  • /test pull-cluster-api-build-main
  • /test pull-cluster-api-e2e-blocking-main
  • /test pull-cluster-api-e2e-conformance-ci-latest-main
  • /test pull-cluster-api-e2e-conformance-main
  • /test pull-cluster-api-e2e-latestk8s-main
  • /test pull-cluster-api-e2e-main
  • /test pull-cluster-api-e2e-mink8s-main
  • /test pull-cluster-api-e2e-upgrade-1-31-1-32-main
  • /test pull-cluster-api-test-main
  • /test pull-cluster-api-test-mink8s-main
  • /test pull-cluster-api-verify-main

The following commands are available to trigger optional jobs:

  • /test pull-cluster-api-apidiff-main

Use /test all to run the following jobs that were automatically triggered:

  • pull-cluster-api-apidiff-main
  • pull-cluster-api-build-main
  • pull-cluster-api-e2e-blocking-main
  • pull-cluster-api-test-main
  • pull-cluster-api-verify-main

In response to this:

/test help

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Nov 25 '24 16:11 k8s-ci-robot

/test pull-cluster-api-e2e-main

chrischdi avatar Nov 25 '24 17:11 chrischdi

/test pull-cluster-api-e2e-main

chrischdi avatar Nov 26 '24 12:11 chrischdi

/retest

Looks like a flake in creating the docker container and overlapping ports

chrischdi avatar Nov 27 '24 12:11 chrischdi

/retest

Just to make sure its really not a flake

chrischdi avatar Dec 02 '24 13:12 chrischdi

@fabriziopandini Can you take another look? I added some new tests and addressed the comments

davidumea avatar Jan 07 '25 07:01 davidumea

/lgtm

Seems good to me now, thank you

Danil-Grigorev avatar Feb 05 '25 14:02 Danil-Grigorev

LGTM label has been added.

Git tree hash: cfb7529d6229e954dee72fe86ec8bc891b33ffb2

k8s-ci-robot avatar Feb 05 '25 14:02 k8s-ci-robot

/assign justinsb

Pinging @justinsb for approval

davidumea avatar Feb 17 '25 09:02 davidumea

LGTM label has been added.

Git tree hash: d22ebeacfe3f5a77c7855fcad5303341e19d2e92

k8s-ci-robot avatar Feb 19 '25 08:02 k8s-ci-robot

@chrischdi Is there anything I can do for this to progress?

davidumea avatar Feb 27 '25 13:02 davidumea

@chrischdi Is there anything I can do for this to progress?

Thanks for asking, I'm sure this is in the backlog of some maintainers, at least this should also bring it up again in notifications if it got lost ;-)

chrischdi avatar Feb 27 '25 13:02 chrischdi

Just a heads up. Code freeze for 1.10 is on 18th March. So we maybe have 1,5 weeks left if this should make it into v1.10.

sbueringer avatar Mar 05 '25 10:03 sbueringer

Seems like there has been some updates to the linter on main, will rebase and fix

davidumea avatar Mar 12 '25 16:03 davidumea

/test pull-cluster-api-e2e-main

sbueringer avatar Mar 13 '25 07:03 sbueringer

/assign

sbueringer avatar Mar 13 '25 07:03 sbueringer

@davidumea One very last comment. Feel free to squash and ping me afterwards and I'll merge

sbueringer avatar Mar 13 '25 13:03 sbueringer

@davidumea One very last comment. Feel free to squash and ping me afterwards and I'll merge

Sure, I added MinLength/MaxLength for bootcommands, rebased on main again and squashed.

When running make test locally the TestNewClusterClient test failed for me but it also failed when running it on main, so I figured it was unrelated to the changes in this PR.

davidumea avatar Mar 13 '25 13:03 davidumea

Agree, that seems unrelated. (tests are green on my machine)

Thank you very much for working on this. Sorry it took a while

/lgtm /approve

sbueringer avatar Mar 13 '25 13:03 sbueringer

LGTM label has been added.

Git tree hash: ffa74a790345f8a1feafec4dcd0b599bfcc97957

k8s-ci-robot avatar Mar 13 '25 13:03 k8s-ci-robot

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Mar 13 '25 13:03 k8s-ci-robot