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

service: Refactor to the slice structure #603

Merged
merged 4 commits into from
May 31, 2018
Merged

service: Refactor to the slice structure #603

merged 4 commits into from
May 31, 2018

Conversation

gaocegege
Copy link
Member

@gaocegege gaocegege commented May 22, 2018

\assign @ScorpioCPH

This PR is to refactor the code related to service as #548 does.

  • To make the controller more robust we don't want to assume that if there are N services and N replicas that everything is ok.
  • Instead what this PR is doing is for each replica index, checking all services corresponding to that replica (based on labels) and deciding whether services need to be created, deleted, or no action is needed.

Signed-off-by: Ce Gao [email protected]


This change is Reviewable

@TravisBuddy

This comment has been minimized.

@TravisBuddy

This comment has been minimized.

Signed-off-by: Ce Gao <[email protected]>
@gaocegege
Copy link
Member Author

/assign @ScorpioCPH

@coveralls
Copy link

coveralls commented May 22, 2018

Coverage Status

Coverage decreased (-0.3%) to 55.369% when pulling 8cf2271 on gaocegege:port into 77375ba on kubeflow:master.

@gaocegege
Copy link
Member Author

/retest

1 similar comment
@gaocegege
Copy link
Member Author

/retest

@gaocegege
Copy link
Member Author

/assign @jlewi

It seems that @ScorpioCPH is busy these days. We need more contributors 😄

@gaocegege
Copy link
Member Author

Set it to p1 since it blocks #532

@jlewi
Copy link
Contributor

jlewi commented May 29, 2018

Can you update the PR description to please describe what this change is doing and why you are doing ? This will make it much easier to review the PR.

@gaocegege
Copy link
Member Author

Sorry, my mistake. Updated 😄

return err
}
replicas := int(*spec.Replicas)
// Get all pods for the type rt.
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment looks incorrect; I assume you mean service.

Copy link
Contributor

@jlewi jlewi left a comment

Choose a reason for hiding this comment

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

Thanks. Sorry to harp on the PR description but a good PR description makes the PR review much easier my making it apparent what things to focus on.

So in this case the key things I think are worth mentioning in the PR description are

  • To make the controller more robust we don't want to assume that if there are N services and N replicas that everything is ok.

  • Instead what this PR is doing is for each replica index, checking all services corresponding to that replica (based on labels) and deciding whether services need to be created, deleted, or no action is needed.

}

for _, service := range activeServices {
// getServiceSlices returns a slice, which element is the slice of service.
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment isn't all that clear. It looks like the return value is a list of list so it would be good to explain what each dimension corresponds to e.g.
result[i] - Is an array of pointers to services corresponding to Services for replica i

@gaocegege
Copy link
Member Author

@jlewi

OK, I will take more care of the description.

@gaocegege
Copy link
Member Author

I fixed the errors in the comments, PTAL

@gaocegege
Copy link
Member Author

/retest

@jlewi
Copy link
Contributor

jlewi commented May 31, 2018

/lgtm
/approve

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jlewi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit ad6745b into kubeflow:master May 31, 2018
@gaocegege gaocegege deleted the port branch May 31, 2018 05:12
yph152 pushed a commit to yph152/tf-operator that referenced this pull request Jun 18, 2018
* service: Refactor to the slice structure

Signed-off-by: Ce Gao <[email protected]>

* controller.go: Remove useless code

Signed-off-by: Ce Gao <[email protected]>

* controller: Fix test

Signed-off-by: Ce Gao <[email protected]>

* service: Fix comments

Signed-off-by: Ce Gao <[email protected]>
jetmuffin pushed a commit to jetmuffin/tf-operator that referenced this pull request Jul 9, 2018
* service: Refactor to the slice structure

Signed-off-by: Ce Gao <[email protected]>

* controller.go: Remove useless code

Signed-off-by: Ce Gao <[email protected]>

* controller: Fix test

Signed-off-by: Ce Gao <[email protected]>

* service: Fix comments

Signed-off-by: Ce Gao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants