Skip to content

chore(scheduler): use framework.Features in scheduler plugins #130414

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

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

googs1025
Copy link
Member

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

  • use framework.Features in scheduler plugins

Which issue(s) this PR fixes:

Fixes #130406

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.:

None

@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. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 25, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/storage Categorizes an issue or PR as relevant to SIG Storage. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 25, 2025
@@ -37,6 +36,7 @@ type scorer func(args *config.NodeResourcesFitArgs) *resourceAllocationScorer
// resourceAllocationScorer contains information to calculate resource allocation score.
type resourceAllocationScorer struct {
Name string
fts feature.Features
Copy link
Member

Choose a reason for hiding this comment

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

Let's create fields for specific features, i.e. enableInPlacePodVerticalScaling and enablePodLevelResources. See other plugins for reference

Copy link
Member Author

Choose a reason for hiding this comment

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

done. and also change other part

@googs1025 googs1025 force-pushed the chore/scheduler_features branch 2 times, most recently from 52c1ce2 to 94cf0ca Compare February 26, 2025 02:09
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 26, 2025

// The plugin name should be listed in the CSINode object annotation.
// This indicates that the plugin has been migrated to a CSI driver in the node.
csiNodeAnn := csiNode.GetAnnotations()
Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -1033,7 +1037,7 @@ func (a byPVCSize) Less(i, j int) bool {
}

// isCSIMigrationOnForPlugin checks if CSI migration is enabled for a given plugin.
func isCSIMigrationOnForPlugin(pluginName string) bool {
func isCSIMigrationOnForPlugin(enableCSIMigrationPortworx bool, pluginName string) bool {
Copy link
Member

Choose a reason for hiding this comment

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

Would it better that we adjust the order of args

Suggested change
func isCSIMigrationOnForPlugin(enableCSIMigrationPortworx bool, pluginName string) bool {
func isCSIMigrationOnForPlugin(pluginName string, enableCSIMigrationPortworx bool) bool {

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@googs1025 googs1025 force-pushed the chore/scheduler_features branch from 94cf0ca to 9f769f4 Compare February 26, 2025 07:34
@googs1025
Copy link
Member Author

/test pull-kubernetes-integration

)

// isCSIMigrationOn returns a boolean value indicating whether
// the CSI migration has been enabled for a particular storage plugin.
func isCSIMigrationOn(csiNode *storagev1.CSINode, pluginName string) bool {
func isCSIMigrationOn(pluginName string, enableCSIMigrationPortworx bool, csiNode *storagev1.CSINode) bool {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func isCSIMigrationOn(pluginName string, enableCSIMigrationPortworx bool, csiNode *storagev1.CSINode) bool {
func isCSIMigrationOn(pluginName string, csiNode *storagev1.CSINode, enableCSIMigrationPortworx bool) bool {

if !utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationPortworx) {
return false
}
return enableCSIMigrationPortworx
Copy link
Member

Choose a reason for hiding this comment

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

Is it a correct change? Previously, if feature gate was enabled, annotations were checked. Was that check unnecessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I ignored this problem... I also rolled back the delete changes #130414 (comment)

@googs1025 googs1025 force-pushed the chore/scheduler_features branch from 9f769f4 to a0e500e Compare February 26, 2025 10:04
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 26, 2025
)

// isCSIMigrationOn returns a boolean value indicating whether
// the CSI migration has been enabled for a particular storage plugin.
func isCSIMigrationOn(csiNode *storagev1.CSINode, pluginName string) bool {
func isCSIMigrationOn(pluginName string, csiNode *storagev1.CSINode, enableCSIMigrationPortworx bool) bool {
Copy link
Member

Choose a reason for hiding this comment

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

nit: We could even do:

Suggested change
func isCSIMigrationOn(pluginName string, csiNode *storagev1.CSINode, enableCSIMigrationPortworx bool) bool {
func isCSIMigrationOn(csiNode *storagev1.CSINode, pluginName string, enableCSIMigrationPortworx bool) bool {

Not to change the order

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@googs1025 googs1025 force-pushed the chore/scheduler_features branch from a0e500e to 239aad8 Compare February 26, 2025 11:16
@googs1025
Copy link
Member Author

/test pull-kubernetes-e2e-gce

@macsko
Copy link
Member

macsko commented Feb 26, 2025

/lgtm
I'll approve after second lgtm

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

LGTM label has been added.

Git tree hash: a837aa521c5e3de47bcecff552daeb3d10e1a4fc

@googs1025 googs1025 requested a review from haosdent February 26, 2025 11:39
@haosdent
Copy link
Member

/lgtm

@macsko
Copy link
Member

macsko commented Feb 26, 2025

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: googs1025, macsko

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 Feb 26, 2025
@googs1025
Copy link
Member Author

/test pull-kubernetes-e2e-gce

@k8s-ci-robot k8s-ci-robot merged commit 50ba483 into kubernetes:master Feb 26, 2025
15 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.33 milestone Feb 26, 2025
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. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/storage Categorizes an issue or PR as relevant to SIG Storage. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use framework.Features in scheduler plugins to obtain feature gates
4 participants