我是Kubernetes的新人.在制作自定义K8 schduler插件时遇到这个错误.我使用这个链接Kube-Scheduler-Plugin做了一切,一切都完成了,但当我运行时
./hack/update-codegen.sh
该文件没有创建DeepCopyBody,因为当我运行make
命令时它会出现此错误
$ make
fatal: No names found, cannot describe anything.
fatal: No names found, cannot describe anything.
fatal: No names found, cannot describe anything.
GOOS=linux CGO_ENABLED=0 go build -ldflags '-w' -o bin/controller cmd/controller/controller.go
GOOS=linux CGO_ENABLED=0 go build -ldflags '-X k8s.io/component-base/version.gitVersion=v0.0.20240430 -w' -o bin/kube-scheduler cmd/scheduler/main.go
# sigs.k8s.io/scheduler-plugins/apis/config
apis/config/register.go:47:3: cannot use &PIDControllerArgs{} (value of type *PIDControllerArgs) as "k8s.io/apimachinery/pkg/runtime".Object value in argument to scheme.AddKnownTypes: *PIDControllerArgs does not implement "k8s.io/apimachinery/pkg/runtime".Object (missing method DeepCopyObject)
make: *** [Makefile:62: build-scheduler] Error 1
我进行了故障排除,但无法找到问题并按应有的方式使用标签.任何人都能进一步 bootstrap 正确的方向进行故障排除吗?谢谢你
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type PIDControllerArgs struct {
metav1.TypeMeta
// EndpointURL is the URL to which score requests will be sent.
EndpointURL *string
// MaxIdleConnections defines the maximum number of idle connections to the server.
MaxIdleConnections *int
// IdleConnectionTimeoutSec defines the timeout for idle connections in seconds.
IdleConnectionTimeoutSec *int
// RequestTimeoutSec defines the timeout for requests in seconds.
RequestTimeoutSec *int
}
/connect/v1/typ.go
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:defaulter-gen=true
type PIDControllerArgs struct {
metav1.TypeMeta `json:",inline"`
// EndpointURL is the URL to which score requests will be sent.
EndpointURL *string `json:"endpointURL,omitempty"`
// MaxIdleConnections defines the maximum number of idle connections to the server.
MaxIdleConnections *int `json:"maxIdleConnections,omitempty"`
// IdleConnectionTimeoutSec defines the timeout for idle connections in seconds.
IdleConnectionTimeoutSec *int `json:"idleConnectionTimeoutSec,omitempty"`
// RequestTimeoutSec defines the timeout for requests in seconds.
RequestTimeoutSec *int `json:"requestTimeoutSec,omitempty"`
}