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

Delete Useless options in controller #569

Merged
merged 1 commit into from
Apr 8, 2023

Conversation

nayihz
Copy link
Contributor

@nayihz nayihz commented Mar 31, 2023

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #567

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Delete kubeConfig/incluster/masterUrl options in controller. 
Implentment --worker option.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 31, 2023
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Mar 31, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @czybjtu. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 31, 2023
@zwpaper
Copy link
Member

zwpaper commented Apr 1, 2023

hi @czybjtu, thanks for the PR, but maybe we should implement those options instead of deleting them

WDYT @Huang-Wei ?

}
schedInformerFactory.Start(stopCh)
coreInformerFactory.Start(stopCh)
if !s.EnableLeaderElection {
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems to be totally disabling leader election?

Copy link
Contributor Author

@nayihz nayihz Apr 3, 2023

Choose a reason for hiding this comment

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

No. No need to implement this manually, the ctrl runtime can handle this instead. We have enabled leader election when create ctrl.NewManager

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: s.MetricsAddr,
Port: 9443,
HealthProbeBindAddress: s.ProbeAddr,
LeaderElection: s.EnableLeaderElection,
LeaderElectionID: "sched-plugins-controllers",
LeaderElectionNamespace: "kube-system",

@Huang-Wei
Copy link
Contributor

hi @czybjtu, thanks for the PR, but maybe we should implement those options instead of deleting them

Yes, we need to bring the functionality back, which is part of the migration; otherwise, it's a breaking change as params like workers, leader elections are not supported.

@czybjtu are you going to remove and add the param/function back, via 2 PRs? If so, I'm leaning towards merging into one PR, so reviewers only need to review function changes while keep parameters unchanged (or with minimum changes).

@nayihz
Copy link
Contributor Author

nayihz commented Apr 3, 2023

AFAIK, after we migrate controllers to controller-runtime, there is no need to implement kubeConfig/incluster/masterUrl manually. The controller-runtime can handle this instead.
The --wokers option was never be implemented before, So I delete this option in this pr. Maybe it's better to implement it. I'll take a look later.

@zwpaper
Copy link
Member

zwpaper commented Apr 4, 2023

hi @czybjtu, sorry for the late reply again, I was kinda busy recently.

my concern is that:

  1. ctrl-runtime automatically added a kubeconfig command line flag to the controller, it may be worth a comment in the Option struct.
  2. the kubeconfig cmd flag was changed from kubeConfig, we should add this breaking change in the release note @Huang-Wei
  3. it seems that ctrl-runtime did not handle the masterAddr flag, and it also seems can be replaced by the kubeconfig flag, we may also drop it and notice it in the release note?
  4. the inCluster flag seems to be reasonable to drop, as it can be detected by whether kubeconfig is specified.

ps, I only glanced at the PR, will try to find some free cycles to check it deeply.
thanks so much for raising this PR.

@Huang-Wei
Copy link
Contributor

/ok-to-test

I'm not concerned with the features that didn't exist before, we can keep the behavior as-is as long as we can confirm some parameters didn't work (like masters).

For kubeconfig -> kubeConfig and changes alike, I'm less concerned as well. Let's just stick to ctrl-runtime's naming conversion and write a release note about that.

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 5, 2023
@nayihz
Copy link
Contributor Author

nayihz commented Apr 6, 2023

/test pull-scheduler-plugins-integration-test-master

@@ -173,5 +175,6 @@ func (r *ElasticQuotaReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
Watches(&source.Kind{Type: &v1.Pod{}}, &handler.EnqueueRequestForObject{}).
For(&schedv1alpha1.ElasticQuota{}).
WithOptions(controller.Options{MaxConcurrentReconciles: r.Workers}).
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for adding this.

@Huang-Wei
Copy link
Contributor

/approve

Leaving /lgtm to @zwpaper .

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: czybjtu, Huang-Wei

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 Apr 6, 2023
@zwpaper
Copy link
Member

zwpaper commented Apr 8, 2023

/lgtm

thanks for the contribution @czybjtu!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 8, 2023
@k8s-ci-robot k8s-ci-robot merged commit e70dedf into kubernetes-sigs:master Apr 8, 2023
@nayihz nayihz deleted the feat_del_options branch April 10, 2023 01:06
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. 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. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

Delete useless options in controller
4 participants