Inject pkg/apis/core/v1 ResourceName helpers through ResourceNameQualifier from cmd/kube-scheduler#101489
Inject pkg/apis/core/v1 ResourceName helpers through ResourceNameQualifier from cmd/kube-scheduler#101489ingvagabund wants to merge 1 commit intokubernetes:masterfrom
Conversation
|
@ingvagabund: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions 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. |
|
@ingvagabund: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The DetailsInstructions 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. |
|
/hold |
722541c to
a55bd7e
Compare
a55bd7e to
1731fd1
Compare
1731fd1 to
84b6bf8
Compare
|
/test pull-kubernetes-integration |
|
can you squash the commits apart from the ones coming from other PRs? |
|
/retest |
I created separate commits to make easier to understand the changes. Though, if it's not needed, I can squash. |
|
|
||
| // ResourceNameQualifier abstracts helpers qualifying | ||
| // of what kind a resource name is. | ||
| type ResourceNameQualifier interface { |
There was a problem hiding this comment.
-1
Why is this not in component-helpers?
There was a problem hiding this comment.
I will leave this for discussion. I don't have a strong opinion about where it should be.
|
I am not sure I like this approach, creating an interface for logic that is static and injecting it around is an overkill. Why can't we move those helper functions as is to component helpers pkg? |
I was not able to address @liggitt 's comment in #95553 (comment): |
…ifier from cmd/kube-scheduler Removes k8s.io/kubernetes/pkg/apis/core/v1/helper from pkg/scheduler code base.
518b963 to
ac1bb3e
Compare
|
/retest |
|
So an external component that imports the scheduler code would need to define its own implementation of But in any case, even if we want to be able to inject this behavior just so we can cut the dependency, I think plumbing it this way throughout the code base is too much for a functionality that is static and not actually supposed to be swappable. I suggest we define a global variable under the scheduler's component-helpers pkg that is set/registered before scheduler startup, just like metrics registration. |
Any external component can still import the k/k resource name helpers. Though yeah, it's still an ugly hack.
With a global variable one has no guarantee the variable will always get set. If the metrics do not get registered, no metrics get collected. If the global variable for the resource name helpers does not get registered, the scheduler will either panic or will not correctly classify scalar resources. Meaning the validation might produce different conclusions. Wiring the code this way is not so much about allowing to swap the implementation as about making the compiler complain and make anyone importing the scheduler framework bits to see what's missing and initialize the resource name helper. |
But that defeats the purpose of this refactoring.
Failing silently is bad, crashing is probably better. But I don't understand how we "will not correctly classify scalar resources." if the global variable is not set?
I get that it is not about swapping implementation, which in my opinion is the problematic part: abstracting something that doesn't really need to be abstracted. I suggested setting up a global variable, I admit it may not necessarily be a better alternative, but the current proposal caused significant changes, the interface is being passed in many places with negative net benefit for the scheduler code base. It would be a lot less of an issue if it is limited to few places (like the framework and have it accessible via the framework handle). Is the goal to cut dependencies for the whole scheduler pkg or mainly the framework plugins? |
That depends on the default behavior. If the global variable is nil, scalar resources might just get ignored. Though, I still prefer crashing.
I'd like to do it for the whole scheduler pkg. So third party repositories can import more than just the plugins. One might take the entire pkg/scheduler and just replace the queue implementation.
I don't have a better solution right now. I will take this path for the moment and update the PR accordingly. |
|
@ingvagabund: PR needs rebase. DetailsInstructions 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. |
kubernetes#60525 introduced Balanced attached node volumes feature gate to include volume count for prioritizing nodes. The reason for introducing this flag was its usefulness in Red Hat OpenShift Online environment which is not being used any more. So, removing the flag as it helps in maintainability of the scheduler code base as mentioned at kubernetes#101489 (comment)
|
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
|
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
|
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
|
@k8s-triage-robot: Closed this PR. DetailsIn response to this:
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. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Removes
k8s.io/kubernetes/pkg/apis/core/v1/helperfrom pkg/scheduler code base.TBD
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Part of #91782 effort
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: