I am new to go and Kubernetes. Facing this error in making the custom K8 schduler plugin. I did everything using this link Kube-Scheduler-Plugin, everything is done but when I am running
./hack/update-codegen.sh
This file not creating the DeepCopyObject since when I run the make
command it gives this error
$ 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
I troubleshoot and did not able to find the issue and use the tag as it should be. Can anyone guide the right direction for troubleshooting further. Thank You
// +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
}
/config/v1/type.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"`
}