-
Notifications
You must be signed in to change notification settings - Fork 38.8k
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
[Federation] Convert the ReplicaSet controller to a sync controller. #46527
[Federation] Convert the ReplicaSet controller to a sync controller. #46527
Conversation
a3210d1
to
bab423e
Compare
@k8s-bot test this |
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://github.com/kubernetes/kubernetes/wiki/CLA-FAQ to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://github.com/kubernetes/kubernetes/wiki/CLA-FAQ to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
The CLA should already be signed. |
@k8s-bot pull-kubernetes-federation-e2e-gce test this |
@k8s-bot pull-kubernetes-e2e-gce-etcd3 test this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, neglected to publish this previously...
Would be good to see #45563 merge before reviewing in-depth. My quibbles about testing aside, though, I think this is ok so long as the integration and e2e tests pass.
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and | |||
limitations under the License. | |||
*/ | |||
|
|||
package replicaset | |||
package sync |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this coverage still required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite sure. I think it is testing a bit more than the current integration tests–namely, that the scheduling causes the replicas to be distributed to clusters such that the numbers add up–but it's certainly a test that would be better removed in the future and replaced with unit tests for scheduling and integration tests for propagation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd hope the numbers adding up could be validated separately from propagation, but sure.
cluster1UnschedulableReplicas *int64 | ||
cluster2UnschedulableReplicas *int64 | ||
}{ | ||
{rs1Replicas: 2, rs2Replicas: 2, rs1ReadyReplicas: 2, rs2ReadyReplicas: 2, podsGetter: uncalledPodsGetter, cluster1Replicas: &two, cluster2Replicas: &two}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding test names to document your intent. Also, consider defining only the values that vary to make it clear what is being tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
k8s2 = "k8s-2" | ||
) | ||
|
||
func TestClusterReplicaState(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test seems to be doing a lot of work. Is there a way to break the code under test down so it can be tested in isolation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I thought about it for a little while, but I'm concerned that I couldn't think of a way to do so without making this more convoluted. I'll think about this a bit more, perhaps in the context of the deployments PR that follows this one up.
|
||
func (a *ReplicaSetAdapter) schedule(frs *extensionsv1.ReplicaSet, clusterNames []string, | ||
current map[string]int64, estimatedCapacity map[string]int64) map[string]int64 { | ||
// TODO: integrate real scheduler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a TODO from the previous code or was there something lost in translation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this is a TODO from the previous code.
replicas := int64(*frs.Spec.Replicas) | ||
scheduleResult, overflow := plnr.Plan(replicas, clusterNames, current, estimatedCapacity, | ||
frs.Namespace+"/"+frs.Name) | ||
// make sure the return contains clusters need to zero the replicas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider rewording for clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
bab423e
to
b7504c7
Compare
@k8s-bot pull-kubernetes-unit test this |
@k8s-bot pull-kubernetes-e2e-gce-etcd3 test this |
b7504c7
to
ef7a9fe
Compare
@k8s-bot pull-kubernetes-federation-e2e-gce test this |
@k8s-bot pull-kubernetes-e2e-gce-etcd3 test this |
@k8s-bot pull-kubernetes-unit test this |
1 similar comment
@k8s-bot pull-kubernetes-unit test this |
@k8s-bot pull-kubernetes-unit test this |
32aa318
to
060c692
Compare
@marun Can you LGTM this? (after the tests pass, assuming they do) |
Related issue: #39986 |
@k8s-bot pull-kubernetes-federation-e2e-gce test this |
/lgtm |
/retest |
060c692
to
16943f6
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: csbell, marun, perotinus Associated issue: 45563 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Automatic merge from submit-queue (batch tested with PRs 47403, 46646, 46906, 46527, 46792) |
See #45563 for previous discussion: that PR was split into two, with this one containing the actual conversion work and that one containing the implementation of the scheduling methods in the sync controller.
Release note: