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 fallback region to early-boot-config #2493

Merged
merged 2 commits into from
Oct 19, 2022

Conversation

jpculp
Copy link
Member

@jpculp jpculp commented Oct 14, 2022

Description of changes:

Replace ImdsMissingRegion panic with a fallback value in certain development scenarios without IMDS.

Also addresses some clippy warnings for general housekeeping.

Testing done:

  • Build aws-k8s variant and launch in an environment without IMDS.
  • Build aws-k8s variant and launch in EC2.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

@jpculp
Copy link
Member Author

jpculp commented Oct 17, 2022

Removed 'static from IDENTITY_DOCUMENT_FILE as well.

@jpculp jpculp requested a review from zmrow October 18, 2022 00:37
Copy link
Contributor

@zmrow zmrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🪶

@jpculp jpculp marked this pull request as ready for review October 18, 2022 17:02
@jpculp jpculp merged commit 40f0f1a into bottlerocket-os:develop Oct 19, 2022
@jpculp jpculp deleted the fallback-region branch October 19, 2022 20:00
@@ -15,7 +15,8 @@ use crate::provider::local_file::{local_file_user_data, USER_DATA_FILE};
pub(crate) struct AwsDataProvider;

impl AwsDataProvider {
const IDENTITY_DOCUMENT_FILE: &'static str = "/etc/early-boot-config/identity-document";
const IDENTITY_DOCUMENT_FILE: &str = "/etc/early-boot-config/identity-document";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting local errors now due to this:

  --> api/early-boot-config/src/provider/aws.rs:18:35
   |
18 |     const IDENTITY_DOCUMENT_FILE: &str = "/etc/early-boot-config/identity-document";
   |                                   ^ expected named lifetime parameter

Is this a mismatch of rust toolchain versions where it's an error for me without, but an error for you with?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the only redundant lifetime was on USER_DATA_FILE, but I was asked to remove it from IDENTITY_DOCUMENT_FILE for consistency. Which rust toolchain are you currently using? Do you get the same error for USER_DATA_FILE or just IDENTITY_DOCUMENT_FILE?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did get it for both constants.

$ cargo --version
cargo 1.63.0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw this running cargo make check on a local change that I had rebased on to the latest from develop. Although I got the failure locally, I did push the change up to my PR, and the GH Actions that ran against the change all passed. Those show they were running 1.64.0.

I will try updating to 1.64.0 as well and see if I get better results. Will report back here if that's the case so we can point anyone else that runs in to this here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like rust ≤ 1.63 wants 'static on IDENTITY_DOCUMENT_FILE and the newly added FALLBACK_REGION, with USER_DATA_FILE remaining &str. Since the Bottlerocket SDK uses 1.64 this isn't a super big problem, but I'll post a fix so we can increase our toolchain compatibility.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened a PR (#2507) for the compatibility fix .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants