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 find_ami_id logic instead of pass argument --instance-id #167

Merged
merged 1 commit into from
Mar 30, 2022

Conversation

gthao313
Copy link
Member

@gthao313 gthao313 commented Mar 10, 2022

Issue number:
#162

Description of changes:

Author: Tianhao Geng <tianhg@amazon.com>
Date:   Thu Mar 10 01:43:23 2022 +0000

    Add find_ami_id logic instead of pass argument `--instance-id`

    currently integration test needs human manually find bottlerocket ami id
    and pass it to integration test via `--instance-id`, which isn't efficient
    and convenient; therefore, we add a new logic about finding ami id
    via aws-sdk-ssm according to arch, bottlerocket-version, and eks-version
    provided by the users.

Testing done:

cargo run --bin integ integration-test --cluster-name bottlerocket-test --region us-west-2 --bottlerocket-version 1.5.0  --arch x86_64
cargo run --bin integ integration-test --cluster-name bottlerocket-test --region us-west-2 --bottlerocket-version 1.5.0  --arch arm64

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.

integ/src/main.rs Outdated Show resolved Hide resolved
@gthao313
Copy link
Member Author

Above address Sean's comment.

Yeah. I'll different strategies for those variables.
BOTTLEROCKET_VERSION: No default, completely provided by user.
AMI_ARCH : Default to x86_64, and arm64 specified by user.
EKS_VERSION : Default to the version that matches the cluster (might be able to be generated).

@gthao313 gthao313 requested a review from cbgbt March 14, 2022 23:45
eks_version: &str,
) -> ProviderResult<String> {
let parameter_name = format!(
"/aws/service/bottlerocket/aws-k8s-{}/{}/{}/image_id",
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe define this as a pattern variable?

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you give an example about it? thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

Something similar to

const PARAMETER_PATERN = "/aws/service/bottlerocket/aws-k8s-{}/{}/{}/image_id"
let parameter_name = format!(PARAMETER_PATERN, ...)

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we can use format!(PARAMETER_PATERN, ...) since format! needs syntax like format!({}, ...)`. We can change it to

const PARAMETER_PATERN = "/aws/service/bottlerocket/aws-k8s-"
let parameter_name = format!({}{}/{}/{}/image_id, PARAMETER_PATERN, ...)

But I don't think this is readable, so I would keep current format. Thanks. 👍

@gthao313 gthao313 force-pushed the integ-test-node_ami_id branch 2 times, most recently from 0a3e69b to 8536153 Compare March 28, 2022 21:51
integ/src/main.rs Outdated Show resolved Hide resolved
currently integration test needs human manually find bottlerocket ami id
and pass it to integration test via `--instance-id`, which isn't efficient
and convenient; therefore, we add a new logic about finding ami id
via aws-sdk-ssm according to arch, bottlerocket-version, and eks-version
provided by the users.
@gthao313 gthao313 merged commit c325d64 into bottlerocket-os:develop Mar 30, 2022
@gthao313 gthao313 deleted the integ-test-node_ami_id branch March 30, 2022 22:28
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.

None yet

3 participants