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

Handle NotImplemented error in service_controller. #80660

Merged
merged 12 commits into from Aug 3, 2019

Conversation

prameshj
Copy link
Contributor

@prameshj prameshj commented Jul 26, 2019

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

What this PR does / why we need it:
This PR adds support in service_controller to handle NotImplemented errors when creating a LoadBalancer. CloudProviders using alternate controllers to implement LoadBalancer services or choosing to skip creation of LoadBalancer based on service annotations can now return a NotImplemented error. service_controller will ignore the error without generating an event and will also not modify the Service status in any way.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jul 26, 2019
@k8s-ci-robot k8s-ci-robot added area/cloudprovider sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/network Categorizes an issue or PR as relevant to SIG Network. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 26, 2019
@prameshj
Copy link
Contributor Author

/assign @bowei

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Jul 26, 2019
@prameshj
Copy link
Contributor Author

cc @freehan @MrHohn

Copy link
Contributor

@freehan freehan left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 26, 2019
@prameshj
Copy link
Contributor Author

/retest

@@ -339,6 +339,10 @@ func (s *ServiceController) syncLoadBalancerIfNeeded(service *v1.Service, key st
}
newStatus, err = s.ensureLoadBalancer(service)
if err != nil {
if err == cloudprovider.NotImplemented {
Copy link
Member

Choose a reason for hiding this comment

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

The NotImplemented error is an already existing error which cloud providers outside of tree may be using. I do not think we should ignore it here. If we want an error to indicate the functionality is implemented elsewhere lets generate a new error for that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack, will add a new error.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 30, 2019
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. area/kubectl sig/cli Categorizes an issue or PR as relevant to SIG CLI. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 30, 2019
Adding a new error "ImplementedElsewhere" to cloud.go.
This error indicates that implementation for a particular service/loadbalancer spec is handled by a different controller.
The caller can ignore the error and skip modifying service status upon receiving this error.
Added error check to EnsureLoadBalancerDeleted.
Depending on how the cluster is created. Test clusters set a default
level of 4.
Removed handling ImplementedElsewhere error in call to EnsureLoadBalancerDeleted.
@@ -339,6 +339,11 @@ func (s *ServiceController) syncLoadBalancerIfNeeded(service *v1.Service, key st
}
newStatus, err = s.ensureLoadBalancer(service)
if err != nil {
if err == cloudprovider.ImplementedElsewhere {
klog.V(4).Infof("LoadBalancer for service %s implemented by a different controller %s, Ignoring error",
Copy link
Member

Choose a reason for hiding this comment

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

minor: we usually don't break newline inside statement.

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

@@ -703,7 +708,12 @@ func (s *ServiceController) lockedUpdateLoadBalancerHosts(service *v1.Service, h
}
return nil
}

if err == cloudprovider.ImplementedElsewhere {
// ImplementedElsewhere indicates that the UpdateLoadBalancer is a nop and the
Copy link
Member

Choose a reason for hiding this comment

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

Don't you need the comment above as well.

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

@bowei
Copy link
Member

bowei commented Aug 2, 2019

/ok-to-test
/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. labels Aug 2, 2019
@prameshj
Copy link
Contributor Author

prameshj commented Aug 2, 2019

/priority important-soon

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Aug 2, 2019
@prameshj
Copy link
Contributor Author

prameshj commented Aug 2, 2019

/assign @cheftako @bowei for approval.

@bowei
Copy link
Member

bowei commented Aug 2, 2019

/approve

@cheftako
Copy link
Member

cheftako commented Aug 3, 2019

/approve

@cheftako
Copy link
Member

cheftako commented Aug 3, 2019

/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bowei, cheftako, prameshj

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 3, 2019
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@k8s-ci-robot k8s-ci-robot merged commit d9a411d into kubernetes:master Aug 3, 2019
@k8s-ci-robot k8s-ci-robot added this to the v1.16 milestone Aug 3, 2019
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. area/cloudprovider area/kubectl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/network Categorizes an issue or PR as relevant to SIG Network. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants