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

WIP: chore: changes for building CAPA amis #1583

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

richardcase
Copy link
Member

Change description

Related issues

  • Fixes #

Additional context

Signed-off-by: Richard Case <[email protected]>
@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 10, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign jsturtevant for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 10, 2024
@holmanb
Copy link

holmanb commented Oct 10, 2024

@richardcase per your comment:

We're running into an error when the boothook script runs in the local stage as the network and AWS creds are not setup yet and so the AWS cli calls fail. However, with this CAPA branch there is still a reboot and so when the machine comes up the second time the boothook script runs (as the network and creds are setup) and we get k8s coming up.

I think we can resolve this by not attempting to get data during the network stage. To accomplish this, we can apply the following change, which will override the local datasource to do nothing and return false when DataSourceEc2KubernetesLocal._get_data() is called, so that during network stage cloud-init will try to get data using the DataSourceEc2Kubernetes class. This should force the boothook to run during the network stage, at which point the AWS creds should presumably be setup (although I'm now sure what is responsible for that).

diff --git a/cloudinit/sources/DataSourceEc2Kubernetes.py b/cloudinit/sources/DataSourceEc2Kubernetes.py
index 50f51faf0..115bba3b6 100644
--- a/cloudinit/sources/DataSourceEc2Kubernetes.py
+++ b/cloudinit/sources/DataSourceEc2Kubernetes.py
@@ -89,7 +89,8 @@ class DataSourceEc2Kubernetes(DataSourceEc2.DataSourceEc2):
 
 
 class DataSourceEc2KubernetesLocal(DataSourceEc2Kubernetes):
-    perform_dhcp_setup = True  # Use dhcp before querying metadata
+    def _get_data(self):
+        return False
 
 
 # Used to match classes to dependencies

@Nalum
Copy link

Nalum commented Oct 10, 2024

@holmanb does DataSourceEc2KubernetesLocal need to extend DataSourceEc2Kubernetes? We were discussing this and thought we might be able to do DataSourceEc2KubernetesLocal(DataSourceEc2.DataSourceEc2), but overriding _get_data works too.

@holmanb
Copy link

holmanb commented Oct 10, 2024

@holmanb does DataSourceEc2KubernetesLocal need to extend DataSourceEc2Kubernetes?

Not necessarily. There are a few different ways to accomplish the same thing.

We were discussing this and thought we might be able to do DataSourceEc2KubernetesLocal(DataSourceEc2.DataSourceEc2), but overriding _get_data works too.

It really doesn't matter which you inherit from for this local datasource. Either way you still need to override _get_data to do nothing and return false. If you just inherit from DataSourceEc2.DataSourceEc2, then I would expect that getting the user-data (the MIME containing the boothook and include-url) will succeed in the local stage and it won't try again in network stage, so it wouldn't behave any differently than the current Ec2 datasource does.

Signed-off-by: Richard Case <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants