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

Replace IPVS as the API server LoadBalancer #296

Merged
merged 6 commits into from
Oct 28, 2021
Merged

Conversation

thebsdbox
Copy link
Collaborator

This re-implements the API-Server Loadbalancer with IPVS

  • Removes the old code that did basic TCP round robin
  • Removes the RAFT code that depended on it
  • Implements IPVS service creation
  • Add/Remove Backend to IPVS service
  • Node watcher to control planes, enables adding/removing to service

@thebsdbox thebsdbox added control plane outside-cluster enhancement New feature or request help wanted Extra attention is needed WORK IN PROGRESS labels Oct 22, 2021
Copy link
Contributor

@stevesloka stevesloka left a comment

Choose a reason for hiding this comment

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

Just a quick pass over. =)

log.Infof("Starting IPVS LoadBalancer")
portForwarder := loadbalancer.NewServer(c.VIP, c.LoadBalancerPort)
// TODO
lb, err := loadbalancer.NewIPVSLB("1.2.3.4", 6444)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: TODO still need fixed up?

// TODO
lb, err := loadbalancer.NewIPVSLB("1.2.3.4", 6444)
if err != nil {
log.Error(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Would be nice to have the error explain what's happening (e.g. error creating new IPVSLB or something).

@@ -386,6 +366,97 @@ func (cluster *Cluster) StartLeaderCluster(c *kubevip.Config, sm *Manager, bgpSe
return nil
}

// present
// LabelsWatcher will watch for labels created on nodes
func (sm *Manager) LabelsWatcher(lb *loadbalancer.IPVSLoadBalancer) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

I've been looking at how to best do this. Might be able to throw some things we've done with Contour into the project to centralize this and separate the k8s specific bits out. I can share more as I pick through my GatewayAPI PR.

@@ -365,87 +365,12 @@ func ParseEnvironment(c *Config) error {
}
c.EnableLoadBalancer = b
// Load Balancer configuration
return parseEnvironmentLoadBalancer(c)
// return parseEnvironmentLoadBalancer(c)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be commented out?

err := lb.client.CreateDestination(lb.loadBalancerService, dst)
// TODO: we either parse the IPVS configuration to see if a backend exists
// or if it already exists we just ignore this and continue ons
if err != nil && err != os.ErrExist {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: The err != nil is redundant

// This file handles the watching of node annotations for configuration, it will exit once the annotations are
// present
// LabelsWatcher will watch for labels created on nodes
func (sm *Manager) LabelsWatcher(lb *loadbalancer.IPVSLoadBalancer) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the same code as in clusterLeader.go?

pkg/cluster/clusterLeader.go Show resolved Hide resolved
pkg/cluster/clusterLeader.go Show resolved Hide resolved
@thebsdbox thebsdbox requested a review from yastij October 28, 2021 07:55
Copy link
Collaborator

@yastij yastij left a comment

Choose a reason for hiding this comment

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

/lgtm

@thebsdbox thebsdbox merged commit 066c046 into kube-vip:main Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
control plane outside-cluster enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants