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

Update Insufficient IP address logic in ipamd #1773

Merged
merged 3 commits into from
Jan 27, 2022

Conversation

cgchinmay
Copy link
Contributor

What type of PR is this?
bug

Which issue does this PR fix:
#1739

What does this PR do / Why do we need it:
Check for Insufficient CIDR blocks as well as Insufficient Free IP in subnet

If an issue # is not available please add repro steps and logs from IPAMD/CNI showing the issue:

Testing done on this change:

Manually checked ipamd logs

{"level":"error","ts":"2021-12-02T03:34:46.067Z","caller":"ipamd/ipamd.go:934","msg":"Failed to allocate a private IP/Prefix addresses on ENI eni-01f879673fc5fd14d: InsufficientFreeAddressesInSubnet: The specified subnet does not have enough free addresses to satisfy the request.\n\tstatus code: 400, request id: aeac321e-be9f-4a13-9b2f-e6ef5985689a"}
{"level":"warn","ts":"2021-12-02T03:34:46.067Z","caller":"ipamd/ipamd.go:908","msg":"failed to allocate all available IP addresses on ENI eni-01f879673fc5fd14d, err: InsufficientFreeAddressesInSubnet: The specified subnet does not have enough free addresses to satisfy the request.\n\tstatus code: 400, request id: aeac321e-be9f-4a13-9b2f-e6ef5985689a"}
{"level":"info","ts":"2021-12-02T03:34:46.067Z","caller":"ipamd/ipamd.go:938","msg":"Trying to allocate 1 IP addresses on ENI eni-01f879673fc5fd14d"}
{"level":"debug","ts":"2021-12-02T03:34:46.067Z","caller":"ipamd/ipamd.go:938","msg":"PD enabled - false"}
{"level":"error","ts":"2021-12-02T03:34:46.420Z","caller":"ipamd/ipamd.go:938","msg":"Failed to allocate a private IP/Prefix addresses on ENI eni-01f879673fc5fd14d: InsufficientFreeAddressesInSubnet: The specified subnet does not have enough free addresses to satisfy the request.\n\tstatus code: 400, request id: 778715f3-f410-437e-9a2b-2315ad433044"}
{"level":"error","ts":"2021-12-02T03:34:46.420Z","caller":"ipamd/ipamd.go:660","msg":"failed to allocate one IP addresses on ENI eni-01f879673fc5fd14d, err: InsufficientFreeAddressesInSubnet: The specified subnet does not have enough free addresses to satisfy the request.\n\tstatus code: 400, request id: 778715f3-f410-437e-9a2b-2315ad433044: InsufficientFreeAddressesInSubnet: The specified subnet does not have enough free addresses to satisfy the request.\n\tstatus code: 400, request id: 778715f3-f410-437e-9a2b-2315ad433044"}
{"level":"debug","ts":"2021-12-02T03:34:46.420Z","caller":"ipamd/ipamd.go:795","msg":"Insufficient IP Addresses due to: InsufficientFreeAddressesInSubnet\n"}
{"level":"error","ts":"2021-12-02T03:34:46.420Z","caller":"ipamd/ipamd.go:660","msg":"Unable to attach IPs/Prefixes for the ENI, subnet doesn't seem to have enough IPs/Prefixes. Consider using new subnet or carve a reserved range using create-subnet-cidr-reservation"}
{"level":"debug","ts":"2021-12-02T03:34:51.421Z","caller":"ipamd/ipamd.go:659","msg":"IP pool is too low: available (8) < ENI target (1) * addrsPerENI (9)"}
...
...
...
{"level":"debug","ts":"2021-12-02T03:36:21.461Z","caller":"ipamd/ipamd.go:660","msg":"Starting to increase pool size"}
{"level":"debug","ts":"2021-12-02T03:36:21.461Z","caller":"ipamd/ipamd.go:660","msg":"Recently we had InsufficientCidr error hence will wait for 2m0s before retrying"}

Automation added to e2e:

Will this break upgrades or downgrades. Has updating a running cluster been tested?:
No

Does this change require updates to the CNI daemonset config files to work?:

No

Does this PR introduce any user-facing change?:

Yes, updated ipamd logs, increase back off (2 min) for ENI allocation if the subnet doesnt have any free IPs

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jayanthvn
Copy link
Contributor

Looking into it. Can you update the branch?

pkg/ipamd/ipamd.go Outdated Show resolved Hide resolved
Copy link
Contributor

@jayanthvn jayanthvn left a comment

Choose a reason for hiding this comment

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

Rest looks good, just minor nit.

- check for Insufficient CIDR blocks as well as Insufficient Free IP in subnet

modified function name as per reviewer comments

Minor change to function name
@cgchinmay cgchinmay force-pushed the ipamd_errcode_insufficient_ip branch from 1bbab78 to c0a4d40 Compare January 18, 2022 18:57
Copy link
Contributor

@jayanthvn jayanthvn left a comment

Choose a reason for hiding this comment

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

lgtm

@cgchinmay cgchinmay merged commit b36b857 into aws:master Jan 27, 2022
@cgchinmay cgchinmay mentioned this pull request Jan 28, 2022
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.

2 participants