kubernetes-sigs / kube-scheduler-wasm-extension

All the things to make the scheduler extendable with wasm.
Apache License 2.0
110 stars 22 forks source link

Add guest config and update NodeNumber plugin to use it #64

Closed codefromthecrypt closed 1 year ago

codefromthecrypt commented 1 year ago

What type of PR is this?

/kind feature

What this PR does / why we need it:

This adds a configuration key guestConfig to wasm.PluginConfig. The contents of this are readable by the guest using Host.GetConfig().

This is used by the NodeNumber plugin, to indicate reverse scoring. Specifically, the guest was re-written to unmarshal JSON as the upstream plugin does.

Which issue(s) this PR fixes:

Special notes for your reviewer:

This implements the approach mentioned here. Logging can be done in a later change similarly https://github.com/kubernetes-sigs/kube-scheduler-wasm-extension/pull/59#issuecomment-1646511509

Does this PR introduce a user-facing change?

NONE

What are the benchmark results of this change?

goos: darwin
goarch: arm64
pkg: sigs.k8s.io/kube-scheduler-wasm-extension/internal/e2e/scheduler
                          │ before.txt  │              now.txt               │
                          │   sec/op    │   sec/op     vs base               │
Example_NodeNumber/New-12   64.56m ± 2%   73.36m ± 1%  +13.62% (p=0.002 n=6)
Example_NodeNumber/Run-12   51.57µ ± 1%   46.48µ ± 4%   -9.87% (p=0.002 n=6)
geomean                     1.825m        1.847m        +1.19%
k8s-ci-robot commented 1 year ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: codefromthecrypt, sanposhiho

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: - ~~[OWNERS](https://github.com/kubernetes-sigs/kube-scheduler-wasm-extension/blob/main/OWNERS)~~ [codefromthecrypt,sanposhiho] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment