Merge pull request #65484 from yue9944882/chore/sync-impl-with-doc

Automatic merge from submit-queue (batch tested with PRs 64741, 65484). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fixes docs mismatched with implementation

**What this PR does / why we need it**:

Some document is far different with the implementation, which is really confusing.

Manually fixed them and appended more information.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2018-07-02 03:55:03 -07:00 committed by GitHub
commit c97b2e0d1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -235,9 +235,8 @@ func (s *ServiceController) init() error {
return nil
}
// Returns an error if processing the service update failed, along with a time.Duration
// indicating whether processing should be retried; zero means no-retry; otherwise
// we should retry in that Duration.
// processServiceUpdate operates loadbalancers for the incoming service accordingly.
// Returns an error if processing the service update failed.
func (s *ServiceController) processServiceUpdate(cachedService *cachedService, service *v1.Service, key string) error {
if cachedService.state != nil {
if cachedService.state.UID != service.UID {
@ -270,8 +269,9 @@ func (s *ServiceController) processServiceUpdate(cachedService *cachedService, s
return nil
}
// Returns whatever error occurred along with a boolean indicator of whether it
// should be retried.
// createLoadBalancerIfNeeded ensures that service's status is synced up with loadbalancer
// i.e. creates loadbalancer for service if requested and deletes loadbalancer if the service
// doesn't want a loadbalancer no more. Returns whatever error occurred.
func (s *ServiceController) createLoadBalancerIfNeeded(key string, service *v1.Service) error {
// Note: It is safe to just call EnsureLoadBalancer. But, on some clouds that requires a delete & create,
// which may involve service interruption. Also, we would like user-friendly events.