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

[1.14] ipam: Support for static IP allocation in AWS #569

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

antonipp
Copy link
Collaborator

@antonipp antonipp commented Aug 7, 2024

No description provided.

pkg/aws/ec2/ec2.go Outdated Show resolved Hide resolved
pkg/aws/ec2/ec2.go Outdated Show resolved Hide resolved
pkg/aws/ec2/ec2.go Show resolved Hide resolved
pkg/aws/ec2/mock/mock.go Show resolved Hide resolved
@antonipp antonipp force-pushed the ai/static-ip-1-14-dd branch from 0c522d2 to fe7b5e8 Compare August 22, 2024 12:53
@antonipp antonipp force-pushed the ai/static-ip-1-14-dd branch 3 times, most recently from e02c448 to f0dd9b7 Compare September 9, 2024 15:32
pkg/ipam/node.go Outdated
func (n *Node) getStaticIPTags() ipamTypes.Tags {
if n.resource.Spec.IPAM.StaticIPTags != nil {
return n.resource.Spec.IPAM.StaticIPTags
} else {

Choose a reason for hiding this comment

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

🔵 Code Quality Violation

code block could be outside the else (...read more)

Sometimes, the else block of an if is unnecessary and can be avoided, especially when there is a return statement inside the if block will be executed and the function will terminate. Hence, there is no need to explicitly specify the else clause.

By removing the else clause, the code becomes more concise and easier to read. It eliminates redundancy and makes the intention of the code clearer.

To avoid such situations, it is a good coding practice to write code with the fewest possible branches. This makes the code easier to understand and minimizes the chance of introducing bugs.

View in Datadog  Leave us feedback  Documentation

@antonipp antonipp force-pushed the ai/static-ip-1-14-dd branch from f0dd9b7 to ea642c1 Compare September 9, 2024 15:37
@antonipp antonipp changed the title Static IP allocation via CNI config [1.14] ipam: Support for static IP allocation in AWS Sep 9, 2024
association, err := c.ec2Client.AssociateAddress(ctx, associateAddressInput)
c.metricsAPI.ObserveAPICall("AssociateAddress", deriveStatus(err), sinceStart.Seconds())
if err != nil {
// TODO some errors can probably be skipped and next EIP can be tried

Choose a reason for hiding this comment

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

Should we summarize the discussion in code comments ?

@antonipp antonipp marked this pull request as ready for review September 10, 2024 15:21
@antonipp antonipp force-pushed the ai/static-ip-1-14-dd branch from ea642c1 to 619b740 Compare September 11, 2024 09:18
@antonipp antonipp merged commit f08fe12 into v1.14-dd Sep 11, 2024
24 of 32 checks passed
@antonipp antonipp deleted the ai/static-ip-1-14-dd branch September 11, 2024 09:21
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