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

AWS: Arbitrarily choose first (lexicographically) subnet in AZ #50255

Merged

Conversation

mattlandis
Copy link
Contributor

When there is more than one subnet for an AZ on AWS choose arbitrarily
chose the first one lexicographically for consistency.

What this PR does / why we need it:
If two subnets were to be used appear in the same aws az which one is chosen is currently not consistent. This could lead to difficulty in diagnosing issues.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #45983

Special notes for your reviewer:

Release note:

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 7, 2017
@k8s-ci-robot
Copy link
Contributor

Hi @mattlandis. 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.

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. I understand the commands that are listed here.

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels Aug 7, 2017
@mattlandis
Copy link
Contributor Author

/assign @justinsb

// If we have two subnets for the same AZ we arbitrarily choose the one that is first lexicographically.
// TODO: Should this be an error.
if strings.Compare(*existing.SubnetId, *subnet.SubnetId) > 0 {
glog.Warningf("Found multiple subnets in AZ %q; choosing %q between subnets %q and %q", az, *subnet.SubnetId, *existing.SubnetId, *subnet.SubnetId)
Copy link
Member

Choose a reason for hiding this comment

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

I think we'll end up glog.Warningf twice here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should have had a continue inside the if block. The log statements differ in which one it is choosing. Updated.

@justinsb justinsb changed the title Arbitrarily chose first (lexicographically) subnet in AZ on AWS. AWS: Arbitrarily choose first (lexicographically) subnet in AZ Aug 7, 2017
@justinsb justinsb added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-label-needed labels Aug 7, 2017
@justinsb
Copy link
Member

justinsb commented Aug 7, 2017

I think we don't need both glog.Warningf statements, as otherwise we'll log twice per loop.

Otherwise LGTM.

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 7, 2017
When there is more than one subnet for an AZ on AWS choose arbitrarily
chose the first one lexicographically for consistency.
@mattlandis mattlandis force-pushed the aws-duplicate-subnets branch from da88a57 to 10794e7 Compare August 7, 2017 14:42
@jsafrane
Copy link
Member

jsafrane commented Aug 7, 2017

/unassign

@mattlandis
Copy link
Contributor Author

@justinsb I've updated to add a continue inside the block so only the correct log messages is output.

@eswarbala
Copy link

Looks like this needs /lgtm

@justinsb
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 17, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb, mattlandis

Associated issue: 45983

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 18, 2017
@justinsb
Copy link
Member

/test pull-kubernetes-e2e-gce-etcd3

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 50255, 50885)

@k8s-github-robot k8s-github-robot merged commit c573d81 into kubernetes:master Aug 18, 2017
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws: when we choose subnets arbitrarily, we should still choose consistently
6 participants