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

Restrict subnets only to subnets from regular availability zones in ELB auto-discovery procedure #499

Merged
merged 1 commit into from
Dec 17, 2022

Conversation

lobziik
Copy link
Member

@lobziik lobziik commented Sep 8, 2022

What type of PR is this?

/kind feature

What this PR does / why we need it:
Outpost, wavelength, and local zone don't support NLB or CLB at the moment.
This pr adds check for availability zone type and includes only subnets from availability-zone typed zones for the auto-discovery.

Which issue(s) this PR fixes:

Fixes #442

Special notes for your reviewer:
I'm not sure about PR type, guess that feature is the most suitable one.

Does this PR introduce a user-facing change?:

Added check  for availability zone type within subnets auto-discovery procedure for a load-balancers
Auto-discovery will include only subnets from `availability-zone` typed zones.

IMPORTANT: This change requires an IAM permissions update. IAM policy for control-plane nodes
should be extended with `ec2:DescribeAvailabilityZones` permission.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 8, 2022
@k8s-ci-robot
Copy link
Contributor

@lobziik: This issue is currently awaiting triage.

If cloud-provider-aws contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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
Copy link
Contributor

Welcome @lobziik!

It looks like this is your first PR to kubernetes/cloud-provider-aws 🎉. 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/cloud-provider-aws 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 k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 8, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @lobziik. Thanks for your PR.

I'm waiting for a kubernetes 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 the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 8, 2022
@lobziik lobziik changed the title Restrict subnets to subnets from regular availability zones Restrict subnets to subnets from regular availability zones in auto-discovery procedure Sep 8, 2022
@lobziik lobziik changed the title Restrict subnets to subnets from regular availability zones in auto-discovery procedure Restrict subnets only to subnets from regular availability zones in ELB auto-discovery procedure Sep 8, 2022
@JoelSpeed
Copy link
Contributor

/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. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 9, 2022
@JoelSpeed
Copy link
Contributor

/lgtm

Will need an AWS approver to review as well, but the code looks clean and makes sense to me

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 12, 2022
@lobziik
Copy link
Member Author

lobziik commented Sep 12, 2022

e2e is failing, i need some time to reproduce and investigate it.
/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 12, 2022
@lobziik
Copy link
Member Author

lobziik commented Sep 12, 2022

Apparently this requires additional iam permissions for describing availability zones. I need to figure out where it does set within this e2es and give an another thought about this api call error handling.

Will appreciate some advices here, for now i'm not entirely sure how to proceed.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 18, 2022
@lobziik
Copy link
Member Author

lobziik commented Oct 18, 2022

Updated PR, added a check for the response type. Insufficient permissions does not threat as an error anymore, warning will be raised instead: https://github.com/kubernetes/cloud-provider-aws/pull/499/files#diff-97a31d0f193ea0b4e2c538595daf93405351054377458053a5010f6fdb97f4dcR3539 for provide backward compatability and do not break existing clusters after ccm upgrade.

Added missed permission into documentation also.

@lobziik
Copy link
Member Author

lobziik commented Oct 18, 2022

/hold cancel
/cc @kishorj

@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 Oct 18, 2022
@lobziik lobziik removed the request for review from jaypipes October 18, 2022 14:36
@lobziik lobziik requested review from mtulio and removed request for nckturner and kishorj October 18, 2022 14:36
@lobziik
Copy link
Member Author

lobziik commented Oct 18, 2022

/cc @kishorj @JoelSpeed

Sry, I misclicked and break review requests.

@k8s-ci-robot k8s-ci-robot requested review from JoelSpeed and kishorj and removed request for mtulio October 18, 2022 14:37
Copy link
Contributor

@JoelSpeed JoelSpeed left a comment

Choose a reason for hiding this comment

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

Changes look ok, couple of nits about errors but otherwise LGTM, lmk what you think about using the error wrapping, this file already imports the standard library errors package so there's no new dependency on this

pkg/providers/v1/aws.go Outdated Show resolved Hide resolved
pkg/providers/v1/aws.go Outdated Show resolved Hide resolved
@JoelSpeed
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 1, 2022
@olemarkus
Copy link
Member

/lgtm

@olemarkus
Copy link
Member

/pull-kops-e2e-cni-amazonvpc


azs, err := c.ec2.DescribeAvailabilityZones(azRequest)
if err != nil {
if awsErr, ok := err.(awserr.RequestFailure); ok && awsErr.Code() == "UnauthorizedOperation" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Tbh, if we ignore the error we will keep the existing behavior unless the IAM permissions get updated. I favor throwing the error here instead.

We will have to update the IAM permissions. As for EKS, we can start process to update the managed policies. For kops, we can request the permission to be included.

Copy link
Contributor

@kishorj kishorj Nov 9, 2022

Choose a reason for hiding this comment

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

Once the policies get updated, we can backport the changes to older releases as well.

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 updated pr, now permissions error will be propagated back.

IAM permissions in kops were extended in kubernetes/kops#14650.

@kishorj can you please take a look? :)

@lobziik
Copy link
Member Author

lobziik commented Nov 24, 2022

I attempted to update permission list for kops. @olemarkus can you please help with that, when you will have time? :) kubernetes/kops#14650 - think it will be a prerequisite for having pull-cloud-provider-aws-e2e passed. Then I can update this PR.

johngmyers pushed a commit to johngmyers/kops that referenced this pull request Nov 24, 2022
To workaround the issue with subnets auto-discovery [1]
AWS ccm needs to have permission to retrieve information about
availability zones (specifically to detect outpost, wavelength, and local zones [2]).

[1] kubernetes/cloud-provider-aws#442
[2] kubernetes/cloud-provider-aws#499
johngmyers pushed a commit to johngmyers/kops that referenced this pull request Nov 24, 2022
To workaround the issue with subnets auto-discovery [1]
AWS ccm needs to have permission to retrieve information about
availability zones (specifically to detect outpost, wavelength, and local zones [2]).

[1] kubernetes/cloud-provider-aws#442
[2] kubernetes/cloud-provider-aws#499
Outpost, wavelength, and local zone don't support NLB or CLB for the moment.
This commit adds check for availability zone type and includes only
subnets from `availability-zone` typed zones for the auto-discovery.
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 9, 2022
@olemarkus
Copy link
Member

/retest

@JoelSpeed
Copy link
Contributor

Thanks for the fixups @lobziik

/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 12, 2022
@kishorj
Copy link
Contributor

kishorj commented Dec 16, 2022

Thanks
/lgtm

Need updates to the AmazonEKSClusterPolicy for EKS clusters. Hold merge until we initiate the process to update the managed policy.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: olemarkus

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 17, 2022
@k8s-ci-robot k8s-ci-robot merged commit 1afaa94 into kubernetes:master Dec 17, 2022
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. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

Introduce well-known tag for exclude subnets within a auto-discovery procedure for ELB backed services
6 participants