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

[Federation] Convert the ReplicaSet controller to a sync controller. #46527

Merged
merged 1 commit into from
Jun 23, 2017

Conversation

perotinus
Copy link
Contributor

@perotinus perotinus commented May 26, 2017

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:

NONE

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 26, 2017
@k8s-github-robot k8s-github-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. release-note-none Denotes a PR that doesn't merit a release note. labels May 26, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@perotinus
Copy link
Contributor Author

@k8s-bot test this

@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 30, 2017
@k8s-ci-robot
Copy link
Contributor

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.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. and removed cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 31, 2017
@k8s-ci-robot
Copy link
Contributor

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.

@perotinus
Copy link
Contributor Author

The CLA should already be signed.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels May 31, 2017
@perotinus
Copy link
Contributor Author

@k8s-bot pull-kubernetes-federation-e2e-gce test this

@perotinus
Copy link
Contributor Author

@k8s-bot pull-kubernetes-e2e-gce-etcd3 test this

Copy link
Contributor

@marun marun left a 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
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 coverage still required?

Copy link
Contributor Author

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.

Copy link
Contributor

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},
Copy link
Contributor

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.

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.

k8s2 = "k8s-2"
)

func TestClusterReplicaState(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.

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?

Copy link
Contributor Author

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
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 a TODO from the previous code or was there something lost in translation?

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider rewording for clarity.

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.

@perotinus
Copy link
Contributor Author

@k8s-bot pull-kubernetes-unit test this

@perotinus
Copy link
Contributor Author

@k8s-bot pull-kubernetes-e2e-gce-etcd3 test this

@perotinus
Copy link
Contributor Author

@k8s-bot pull-kubernetes-federation-e2e-gce test this

@perotinus
Copy link
Contributor Author

@k8s-bot pull-kubernetes-e2e-gce-etcd3 test this

@perotinus
Copy link
Contributor Author

@k8s-bot pull-kubernetes-unit test this

1 similar comment
@perotinus
Copy link
Contributor Author

@k8s-bot pull-kubernetes-unit test this

@perotinus
Copy link
Contributor Author

@k8s-bot pull-kubernetes-unit test this

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 3, 2017
@perotinus
Copy link
Contributor Author

perotinus commented Jun 8, 2017

@marun Can you LGTM this? (after the tests pass, assuming they do)

@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 8, 2017
@perotinus
Copy link
Contributor Author

Related issue: #39986

@perotinus
Copy link
Contributor Author

@k8s-bot pull-kubernetes-federation-e2e-gce test this

@perotinus
Copy link
Contributor Author

@csbell csbell modified the milestones: v1.7, next-candidate Jun 12, 2017
@marun
Copy link
Contributor

marun commented Jun 14, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 14, 2017
@marun
Copy link
Contributor

marun commented Jun 21, 2017

/retest

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 22, 2017
@k8s-github-robot k8s-github-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jun 23, 2017
@marun
Copy link
Contributor

marun commented Jun 23, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 23, 2017
@k8s-github-robot
Copy link

[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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 47403, 46646, 46906, 46527, 46792)

@k8s-github-robot k8s-github-robot merged commit d7c569e into kubernetes:master Jun 23, 2017
@perotinus perotinus deleted the rssyncconversiontwo branch June 23, 2017 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants