Skip to content

Commit a944762

Browse files
committed
support k8s 1.30
1 parent 13b9f3c commit a944762

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+630
-1750
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
.idea/
2323
.vscode/
24+
.kiro/
2425

2526
# binary
2627
bin/

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARG PKGNAME
22

33
# Build the manager binary
4-
FROM golang:1.17.2-alpine as builder
4+
FROM golang:1.22.0-alpine as builder
55

66
ARG LDFLAGS
77
ARG PKGNAME

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ ifeq (, $(shell which golangci-lint))
164164
GOLANG_LINT_TMP_DIR=$$(mktemp -d) ;\
165165
cd $$GOLANG_LINT_TMP_DIR ;\
166166
go mod init tmp ;\
167-
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.43.0 ;\
167+
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.8 ;\
168168
rm -rf $$GOLANG_LINT_TMP_DIR ;\
169169
}
170170
GOLANG_LINT=$(shell go env GOPATH)/bin/golangci-lint

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ There are two options:
6767
```
6868
2) Modify configfile of kube-scheduler(`scheduler-config.yaml`) to enable Dynamic scheduler plugin and configure plugin args:
6969
```yaml
70-
apiVersion: kubescheduler.config.k8s.io/v1beta2
70+
apiVersion: kubescheduler.config.k8s.io/v1
7171
kind: KubeSchedulerConfiguration
7272
...
7373
profiles:
@@ -200,11 +200,12 @@ Normal Scheduled 28s crane-scheduler Successfully assigned default/cpu-stre
200200

201201
| Scheduler Image Version | Supported Kubernetes Version |
202202
| ------------------------------ | :--------------------------: |
203+
| 0.1.0 | >=1.30.0 |
203204
| 0.0.23 | >=1.22.0 |
204205
| 0.0.20 | >=1.18.0 |
205206

206-
The default scheudler image version is `0.0.23`, and you can run the following command for quick replacement:
207+
The default scheudler image version is `0.1.0`, and you can run the following command for quick replacement:
207208

208209
```bash
209-
KUBE_EDITOR="sed -i 's/v1beta2/v1beta1/g'" kubectl edit cm scheduler-config -n crane-system && KUBE_EDITOR="sed -i 's/0.0.23/0.0.20/g'" kubectl edit deploy crane-scheduler -n crane-system
210+
KUBE_EDITOR="sed -i 's/v1/v1beta2/g'" kubectl edit cm scheduler-config -n crane-system && KUBE_EDITOR="sed -i 's/0.1.0/0.0.23/g'" kubectl edit deploy crane-scheduler -n crane-system
210211
```

cmd/controller/app/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func Run(cc *config.CompletedConfig, stopCh <-chan struct{}) error {
7979
healthz.InstallHandler(healthMux, healthz.NamedCheck("crane-scheduler-controller", healthz.PingHealthz.Check))
8080
go func() {
8181
if err := http.ListenAndServe(fmt.Sprintf(":%s", cc.HealthPort), healthMux); err != nil {
82-
klog.Fatal("failed to listen & server health server from port %s: %v", cc.HealthPort, err)
82+
klog.Fatalf("failed to listen & server health server from port %s: %v", cc.HealthPort, err)
8383
}
8484
}()
8585

cmd/scheduler/main.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,35 @@
11
package main
22

33
import (
4+
"context"
45
"fmt"
56
"math/rand"
67
"os"
78
"time"
89

10+
"k8s.io/apimachinery/pkg/runtime"
911
"k8s.io/component-base/logs"
1012
"k8s.io/kubernetes/cmd/kube-scheduler/app"
13+
"k8s.io/kubernetes/pkg/scheduler/framework"
1114

1215
_ "github.com/gocrane/crane-scheduler/pkg/plugins/apis/config/scheme"
1316

1417
"github.com/gocrane/crane-scheduler/pkg/plugins/dynamic"
1518
"github.com/gocrane/crane-scheduler/pkg/plugins/noderesourcetopology"
1619
)
1720

21+
// Adapter function to convert our plugin factory to the expected type
22+
func pluginFactoryAdapter(factoryFn func(runtime.Object, framework.Handle) (framework.Plugin, error)) func(context.Context, runtime.Object, framework.Handle) (framework.Plugin, error) {
23+
return func(ctx context.Context, args runtime.Object, handle framework.Handle) (framework.Plugin, error) {
24+
return factoryFn(args, handle)
25+
}
26+
}
27+
1828
func main() {
1929
rand.Seed(time.Now().UTC().UnixNano())
2030
cmd := app.NewSchedulerCommand(
21-
app.WithPlugin(dynamic.Name, dynamic.NewDynamicScheduler),
22-
app.WithPlugin(noderesourcetopology.Name, noderesourcetopology.New),
31+
app.WithPlugin(dynamic.Name, pluginFactoryAdapter(dynamic.NewDynamicScheduler)),
32+
app.WithPlugin(noderesourcetopology.Name, pluginFactoryAdapter(noderesourcetopology.New)),
2333
)
2434

2535
logs.InitLogs()

deploy/controller/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ spec:
3030
- /controller
3131
- --policy-config-path=/data/policy.yaml
3232
- --prometheus-address=PROMETHEUS_ADDRESS
33-
image: docker.io/gocrane/crane-scheduler-controller:0.0.23
33+
image: docker.io/gocrane/crane-scheduler-controller:0.1.0
3434
imagePullPolicy: IfNotPresent
3535
volumeMounts:
3636
- mountPath: /data

deploy/manifests/dynamic/scheduler-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: kubescheduler.config.k8s.io/v1beta2
1+
apiVersion: kubescheduler.config.k8s.io/v1
22
kind: KubeSchedulerConfiguration
33
leaderElection:
44
leaderElect: true

deploy/manifests/noderesourcetopology/scheduler-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: kubescheduler.config.k8s.io/v1beta2
1+
apiVersion: kubescheduler.config.k8s.io/v1
22
kind: KubeSchedulerConfiguration
33
leaderElection:
44
leaderElect: true

deploy/scheduler/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ spec:
2727
defaultMode: 420
2828
containers:
2929
- name: crane-scheduler
30-
image: docker.io/gocrane/crane-scheduler:0.0.23
30+
image: docker.io/gocrane/crane-scheduler:0.1.0
3131
command:
3232
- /scheduler
3333
- --leader-elect=true
@@ -68,7 +68,7 @@ metadata:
6868
namespace: crane-system
6969
data:
7070
scheduler-config.yaml: |
71-
apiVersion: kubescheduler.config.k8s.io/v1beta2
71+
apiVersion: kubescheduler.config.k8s.io/v1
7272
kind: KubeSchedulerConfiguration
7373
leaderElection:
7474
leaderElect: true

0 commit comments

Comments
 (0)