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

Enable controller to be aware of number of available IP addresses #31

Closed

Conversation

liwenwu-amazon
Copy link
Contributor

This PR addresses issue #18 .

It defines vpc.amazonaws.com/ipv4 as a kubernetes's extended resources to represent the number of available IP addresses on each node.

See #26 for more info

Copy link
Contributor

@mattlandis mattlandis left a comment

Choose a reason for hiding this comment

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

This change should include the update to the Gopkg.lock file (and Gopkg.toml) that updates the vendor director to this state.

Edit: Gopkg.in - Gopkg.toml


#go tool vet
vet:
go tool vet ./pkg/awsutils
go tool vet ./plugins/routed-eni
go tool vet ./pkg/k8sapi
go tool vet ./pkg/networkutils
go tool vet controller
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is working. go vet tool works on files. go vet works on packages.

}
}

func main() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we split the main() into another file?

defer log.Flush()
logger.SetupLogger(logger.GetLogFileLocation(defaultLogFilePath))

nodeName := os.Getenv("MY_NODE_NAME")
Copy link
Contributor

Choose a reason for hiding this comment

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

Something more descriptive for the node name K8s_NODE_NAME, KUBERNETES_NODE_NAME, AMZN_CNI_NODE_NAME. Not sure where this comes from but it should be more descriptive than MY.

log.Infof("Starting eni-ip-controller on %s: %s ...", nodeName, version)

// creates the in-cluster config
config, err := rest.InClusterConfig()
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we support options to allow the config to be provided from different places? For instance a config file?

)

// Interface is the interface for vpcipresource
type Interface interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think Interface for vpcipresource reads more cleanly. Interface is the interface for ... seems to stutter a bit.

Also what does the interface actually provide? How is it used.

Update(client kubernetes.Interface, nodeName string, ipCount int) error
}

// VPCIPResource is the obect for VPC IP resource
Copy link
Contributor

Choose a reason for hiding this comment

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

s/obect/object/

This comment is fairly self descriptive. Is there any more insight you can provide for someone not familiar with what VPCIPResource is. What does it do? Why do we need it?

@@ -0,0 +1,94 @@
// Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add tests.

}
}

func addNode(nodeStore cache.Store, instanceType string, key string) *v1.Node {
Copy link
Contributor

Choose a reason for hiding this comment

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

This method is not called anywhere.

return node
}

func TestAddNode(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you break the test cases into their own tests.


c := NewENIIPController(clientset, fakeVPCIP, "dummyNode")

return &eniIPController{
Copy link
Contributor

Choose a reason for hiding this comment

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

I am confused as to why we are encapsalating the ENIIPController in the eniIPController in this test file.

}

// NewENIIPController creates ENIIPController
func NewENIIPController(client kubernetes.Interface, vpcIP vpcipresource.Interface, nodeName string) *ENIIPController {
Copy link
Contributor

Choose a reason for hiding this comment

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

Take a look at your coverage. There is a lot of code in this file not covered by test.

@SaranBalaji90
Copy link
Contributor

This PR has amazon-ecs-agent code and some irrelevant aws packages imported - can you do something similiar to #43 and send out new review?

return nil
}

if strings.Compare(key, c.nodeName) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems wrong. If it is a running tally of IPs, then we should be doing it for all pods that are already running on the node. But its called IP limit, so that means to me it should be a limit, and should have nothing to do with any pods currently running on the instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This assumes eni-controller pod is deployed before any other workload Pods and all other Pods have specified using resource of vpc.amazonaws.com/ipv4 resources.

@incognick
Copy link

Any progress on this? Definitely need this incorporated so the scheduler is aware of IPs as a resource. I keep running into nodes with not enough available IPs and the scheduler does not try to move the pod to a node with available IPs.

@incognick
Copy link

@liwenwu-amazon ^^

@barambani
Copy link

+1

@umatrangolo
Copy link

Any update about this?

We have serious problems trying to setup a production quality EKS cluster because of this.

@mattlandis
Copy link
Contributor

We are working on a solution to this problem. It will be sent out in another PR (no ETA yet but I would say soonish). Going to close this one.

@mattlandis mattlandis closed this Jan 3, 2019
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.

7 participants