-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
refactor: controller manager: InitFunc and base controller interface. #95885
refactor: controller manager: InitFunc and base controller interface. #95885
Conversation
/assign @cheftako |
/triage accepted |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
/remove-lifecycle stale |
Looks like format need to be run. |
Rebased this PR as go is upgraded to 1.17 |
@@ -726,3 +726,7 @@ func GetDeletableResources(discoveryClient discovery.ServerResourcesInterface) m | |||
|
|||
return deletableGroupVersionResources | |||
} | |||
|
|||
func (gc *GarbageCollector) Name() string { |
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.
If we want GarbageCollector to implement the controller.Interface then we should add a check when we define GarbageCollector that it implements that interface.
var _ contoller.Interface = GarbageCollector{}
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.
Thanks. Added these assertions below the def. of GarbageCollector.
/lgtm |
/assign @BenTheElder could you take a look at |
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.
/approve
for vendor/modules.txt
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: BenTheElder, cheftako, jiahuif 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 |
@jiahuif: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. |
/retest |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR adds an interface for all controllers, as defined as follows:
Originally, a controller expose debugging handler by returning the handler through
InitFunc
, added in #66623This method limits the extensibility of controllers. If we need to add other features (e.g. health checks) to each controller, we have to yet add another return value. Also, it will benefit us to have a standardized
controller.Interface
type.Which issue(s) this PR fixes:
Special notes for your reviewer:
cloud-controller-manager
explicitly disallowed debuggingHandler.https://github.com/kubernetes/kubernetes/blob/v1.22.1/staging/src/k8s.io/cloud-provider/app/controllermanager.go#L276
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: