-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fetch VPC ID from runtime using VPC tags provided via controller flags #3656
Fetch VPC ID from runtime using VPC tags provided via controller flags #3656
Conversation
Welcome @jeswinkoshyninan! |
Hi @jeswinkoshyninan. 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 Once the patch is verified, the new status will be reflected by the 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. |
@oliviassss @johngmyers can you please take look into this same ? |
/ok-to-test |
Thank you @shraddhabang , seems like test looks good to us. Can we merge this change? |
@shraddhabang @johngmyers @oliviassss tagging again incase if we lost the track of this PR, seems like the tests looks good and okay to merge ? |
@jeswinkoshyninan thanks for the contribution, this change looks good to me overall, just a few questions:
|
@oliviassss thank you for the comments |
yeah it's not causing any problem, since it's just return the vpc id if specified. But I think we should call out for this behavior:
|
@oliviassss make sense, have pushed the changes, please take a look. |
docs/deploy/configurations.md
Outdated
| aws-max-retries | int | 10 | Maximum retries for AWS APIs | | ||
| aws-region | string | [instance metadata](#instance-metadata) | AWS Region for the kubernetes cluster | | ||
| aws-vpc-id | string | [instance metadata](#instance-metadata) | AWS VPC ID for the Kubernetes cluster | | ||
| aws-vpc-tags | stringMap | | Tags for the Kubernetes cluster VPC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also add a callout here:
Note that if both flags
--aws-vpc-id
and--aws-vpc-tags
are specified, the controller uses the value in--aws-vpc-id
to fetch the VPC info and ignores the other flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another question, does it accept multiple key:value pairs for the tags filter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it is a string Map. It will accept multiple values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the details here as well.
docs/deploy/installation.md
Outdated
@@ -37,7 +37,7 @@ You can set the IMDSv2 as follows: | |||
aws ec2 modify-instance-metadata-options --http-put-response-hop-limit 2 --http-tokens required --region <region> --instance-id <instance-id> | |||
``` | |||
|
|||
Instead of depending on IMDSv2, you can specify the AWS Region and the VPC via the controller flags `--aws-region` and `--aws-vpc-id`. | |||
Instead of depending on IMDSv2, you can specify the AWS Region via the controller flag `--aws-region`, and the AWS VPC via controller flag `--aws-vpc-id` or by specifying vpc tags via the flag `--aws-vpc-tags` and an optional flag `--aws-vpc-tag-key` if you have a different key for the tag other than "Name". Note that if you specify flags `--aws-vpc-id` and `--aws-vpc-tags`, then value given to `--aws-vpc-id` will be taken by controller. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: reword a bit
Note that if both flags
--aws-vpc-id
and--aws-vpc-tags
are specified, the controller uses the value in--aws-vpc-id
to fetch the VPC info and ignores the other flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactor the sentence. thanks
/ok-to-test |
@oliviassss PR desc updated with the manual test details. |
/lgtm |
@oliviassss just for transparency, seems like when enabling debug logs, the logs which we set to message user "vpcid is specified" is not working when I am testing. This will not affect the functionality. But just letting you know that I am checking. |
@oliviassss identified the problem with logger and fixed. I can see the logs what we set.
|
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jeswinkoshyninan, oliviassss 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 |
@jeswinkoshyninan, discussed internally that we will ship this commit in next minor release, which should be v2.9.0, for a feature like this. Thanks for your patience. |
@oliviassss thank you for the updates, please let me know once we confirm the release v2.9.0. |
} | ||
|
||
if cfg.VpcTags != nil { | ||
return inferVPCIDFromTags(ec2Service, cfg.VpcNameTagKey, cfg.VpcTags[cfg.VpcNameTagKey]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeswinkoshyninan I don't really get this part: why does this allow to pass a map with an arbitrary number of items for --aws-vpc-tags
if we only ever pass a single key-value pair (the one with the key specified in aws-vpc-tag-key
) as the tag filter? Shouldn't it rather just convert the map from --aws-vpc-tags
into a list of tag filters, one for each item?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to #3889
Issue
This PR will address the issue raised: #3644
Description
This PR introduces a new runtime argument, aws-vpc-tags which is used to identify VPCs from the list of tags from which we can infer the VPC ID. There is also an optional argument called aws-vpc-name-tag-key incase if the "Name" will not be key-name for the VPC name in tag.
This is useful for cases where access to AWS metadata is blocked and the VPC ID is not known at deploy time, options to infer the VPC ID are limited
Manual Tests Details
Checklist
README.md
, or thedocs
directory)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯