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

✨ Add support for generating bootstrap data in Ignition format to CABPK #4172

Merged
merged 8 commits into from
Dec 8, 2021
Merged

✨ Add support for generating bootstrap data in Ignition format to CABPK #4172

merged 8 commits into from
Dec 8, 2021

Conversation

invidian
Copy link
Member

What this PR does / why we need it:

This PR provides an alternative solution to PR #3437, described in #3430 (comment).

For manual testing, you can use https://github.com/kinvolk/cluster-api/tree/invidian/ignition-support-next based on v1alpha3 together with https://github.com/kinvolk/cluster-api-provider-aws/tree/invidian/flatcar-support-format-and-flatcar-specifics.

Please let me know what you think about it and what is missing to get this PR merged.

I guess the following things are missing:

  • Test for format field, I couldn't figure out where to put it, so I skipped adding new test for now.
  • Documentation?

CC @iaguis @vbatts @dongsupark

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #3430

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 10, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @invidian!

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. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @invidian. 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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 10, 2021
@invidian invidian changed the title ✨ Add support for generating bootstrap data in Ignition format to CABPK ✨ Add support for generating bootstrap data in Ignition format to CABPK Feb 10, 2021
@neolit123
Copy link
Member

neolit123 commented Feb 10, 2021

i don't see a CAEP (proposal) for this.
given the multiple solutions / PRs it may have been to better discuss all options / implementation details in a proposal before proceeding with the PRs.

@vincepri
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 10, 2021
@invidian
Copy link
Member Author

I'd appreciate some help with CI, I have no idea why is it failing 😞

@MarcelMue
Copy link
Contributor

I'd appreciate some help with CI, I have no idea why is it failing disappointed

I believe they are failing here:

func TestFuzzyConversion(t *testing.T) {
g := NewWithT(t)
scheme := runtime.NewScheme()
g.Expect(AddToScheme(scheme)).To(Succeed())
g.Expect(v1alpha4.AddToScheme(scheme)).To(Succeed())
t.Run("for KubeadmConfig", utilconversion.FuzzTestFunc(scheme, &v1alpha4.KubeadmConfig{}, &KubeadmConfig{}))
t.Run("for KubeadmConfigTemplate", utilconversion.FuzzTestFunc(scheme, &v1alpha4.KubeadmConfigTemplate{}, &KubeadmConfigTemplate{}))
}

So basically CRD conversion is broken for kubeadm types.

@invidian
Copy link
Member Author

So basically CRD conversion is broken for kubeadm types.

Thanks. I managed to figure that out. I guess some manual conversion code is missing, but I didn't figure out yet where to add it.

Another weird thing is that running make generate locally removes all generated files for v1alpha3 for some reason 🤔

@invidian
Copy link
Member Author

i don't see a CAEP (proposal) for this.
given the multiple solutions / PRs it may have been to better discuss all options / implementation details in a proposal before proceeding with the PRs.

Hey @neolit123, have you seen #3430 (comment) ? I think I contained the proposal in this comment. Isn't it providing enough context?

@LorbusChris
Copy link

LorbusChris commented Feb 11, 2021

As @bgilbert noted over the old PR (#3437 (comment)), there are newer Ignition versions (2.x) with an incompatible spec (3.x) and a different config transpiler yaml format (FCCT).

I'd like to make sure this is taken into account here.

Edit: I just saw #3430 (comment) which seems to take it into account 👍

@invidian
Copy link
Member Author

@vincepri @neolit123 @JoelSpeed @justinsb tests are now passing. Please have a look 🙏

bootstrap/kubeadm/controllers/kubeadmconfig_controller.go Outdated Show resolved Hide resolved
bootstrap/kubeadm/controllers/kubeadmconfig_controller.go Outdated Show resolved Hide resolved
bootstrap/kubeadm/internal/ignition/clc/clc.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
KubeadmConfigSpec has now more validation rules, so we should trigger
them, as KubeadmConfigSpec is embedded in KubeadmControlPlane object.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
@sbueringer
Copy link
Member

Maybe the linter issues point to the test failure cause

johananl and others added 5 commits December 8, 2021 19:36
Allow provisioning CAPD machines using Ignition as an alternative to
cloud-init.

So far, cloud-init has been hardcoded as the only provisioning format
supported by CAPD.

- Add a package called "provisioning" which contains the interfaces and
  common logic for all supported provisioning formats.
- Move the existing cloud-init code under the new package.
- Add a new provisioning implementation for Ignition.

Co-authored-by: Suraj Deshmukh <suraj@kinvolk.io>

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
This commit adds the feature gate KubeadmBootstrapFormatIgnition that
will control the usage of field Ignition in KubeadmConfig.

If user provides ignition field then the webhook config rejects the
request with a validation error.

Signed-off-by: Suraj Deshmukh <suraj@kinvolk.io>
Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Signed-off-by: Suraj Deshmukh <suraj@kinvolk.io>
Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
This file tests functions in kubeadmconfig_webhook_test.go.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
Ignition doesn't support the replace_fs filesystem parameter and the
partition filesystem parameter supported by cloud-init. Disallow using
these parameters with Ignition.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
@invidian
Copy link
Member Author

invidian commented Dec 8, 2021

Maybe the linter issues point to the test failure cause

For some reason, running golangci-lint run in repo's root directory did not show issues in test directory when I did it locally. Neither did gci find any files not formatted properly. Odd. Fixed now, sorry for the noise, as I was trying to rebase it as soon as possible.

While looking at reported linter issues, I also spotted some complexity which could be reduced, so I've done that. Last batch of changes is available to see here:
https://github.com/kubernetes-sigs/cluster-api/compare/0aea984fb43c79ebd5600f328e0288d9e5980d46..87df81f4e4dd0c0ca78abdaa909da69f1112d4b8

@invidian
Copy link
Member Author

invidian commented Dec 8, 2021

/test pull-cluster-api-e2e-full-main

@sbueringer
Copy link
Member

Thx for providing that link

/lgtm 🎉

But let's please wait for green e2e-full results before merge

@sbueringer
Copy link
Member

That apparently didn't match the regex :)

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 8, 2021
@CecileRobertMichon
Copy link
Contributor

/lgtm

@invidian
Copy link
Member Author

invidian commented Dec 8, 2021

@vincepri @fabriziopandini do you want to approve as well? :)

I'll remove hold once e2e-full-main is green.

@fabriziopandini
Copy link
Member

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

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 k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 8, 2021
@invidian
Copy link
Member Author

invidian commented Dec 8, 2021

/unhold

🎉

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 8, 2021
@sbueringer
Copy link
Member

Congrats 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ignition support in bootstrap provider