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

Refactor to remove ClusterManager completely #422

Merged
merged 1 commit into from
Aug 7, 2018

Conversation

rramkumar1
Copy link
Contributor

@rramkumar1 rramkumar1 commented Aug 7, 2018

This PR removes the ClusterManager completely from existence. All resource pools that were managed in the ClusterManager are now directly managed by the LB controller. Furthermore, all wrapper functions (EnsureInstanceGroupsAndPorts) are implemented by the LB controller itself.

Note: Still need to figure out unit test failure.

/assign @bowei

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 7, 2018
@rramkumar1
Copy link
Contributor Author

/assign @bowei

@rramkumar1 rramkumar1 changed the title Refactor to remove ClusterManager completely [WIP] Refactor to remove ClusterManager completely Aug 7, 2018
Copy link
Member

@bowei bowei left a comment

Choose a reason for hiding this comment

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

minor stuff

instancePool: instances.NewNodePool(ctx.Cloud, ctx.ClusterNamer),
l7Pool: loadbalancers.NewLoadBalancerPool(ctx.Cloud, ctx.ClusterNamer),
}
healthChecker := healthchecks.NewHealthChecker(ctx.Cloud, ctx.HealthCheckPath, ctx.DefaultBackendHealthCheckPath, ctx.ClusterNamer, ctx.DefaultBackendSvcPortID.Service)
Copy link
Member

Choose a reason for hiding this comment

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

Looks like this could be:

healthChecker := healthchecks.NewHealthChecker(ctx.Cloud, ctx.HealthCheckPath, ctx.DefaultBackendHealthCheckPath, ctx.ClusterNamer, ctx.DefaultBackendSvcPortID.Service)
instancePool := instances.NewNodePool(ctx.Cloud, ctx.ClusterNamer)
backendPool := backends.NewBackendPool(ctx.Cloud, ctx.Cloud, healthChecker, instancePool, ctx.ClusterNamer, ctx.BackendConfigEnabled, true)
lbc := LoadBalancerController{
  ...
  nodes: NewNodeController(ctx, lbc.instancePool),
  backendPool: backendPool,
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

lbc.Translator = translator.NewTranslator(lbc.CloudClusterManager.ClusterNamer, lbc.ctx)
lbc.Translator = translator.NewTranslator(lbc.ctx)
// TODO(rramkumar): Try to get rid of this "Init".
lbc.instancePool.Init(lbc.Translator)
Copy link
Member

Choose a reason for hiding this comment

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

move to lbc.Init()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -175,7 +183,11 @@ func NewLoadBalancerController(
})
}

lbc.Translator = translator.NewTranslator(lbc.CloudClusterManager.ClusterNamer, lbc.ctx)
lbc.Translator = translator.NewTranslator(lbc.ctx)
Copy link
Member

Choose a reason for hiding this comment

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

Add this to the lbc decl above Translator: ctx.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

// TODO(rramkumar): Try to get rid of this "Init".
lbc.instancePool.Init(lbc.Translator)
lbc.backendPool.Init(lbc.Translator)

lbc.tlsLoader = &tls.TLSCertsFromSecretsLoader{Client: lbc.client}
Copy link
Member

Choose a reason for hiding this comment

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

same , move into lbc decl

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -25,12 +25,10 @@ import (
api_v1 "k8s.io/api/core/v1"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/sets"
//"k8s.io/apimachinery/pkg/util/sets"
Copy link
Member

Choose a reason for hiding this comment

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

delete?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Commented out for now since its used in the test I commented out

@@ -63,9 +60,10 @@ func TestZoneListing(t *testing.T) {
}
}

/*
Copy link
Member

Choose a reason for hiding this comment

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

keep track of this so we don't forget..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, I'm going to fix it in a followup soon.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 7, 2018
@bowei bowei merged commit 7baec0f into kubernetes:master Aug 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants