Skip to content

Lint fixes/updating .golangci to not use deprecated linter #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ linters:
enable:
- dupl
- errcheck
- exportloopref
- copyloopvar
- ginkgolinter
- goconst
- gocyclo
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases

.PHONY: generate
generate: controller-gen code-generator ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
generate: controller-gen code-generator manifests ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
./hack/update-codegen.sh

Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/inferencepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type InferencePoolSpec struct {
Selector map[LabelKey]LabelValue `json:"selector,omitempty"`

// TargetPortNumber is the port number that the model servers within the pool expect
// to recieve traffic from.
// to receive traffic from.
// This maps to the TargetPort in: https://pkg.go.dev/k8s.io/api/core/v1#ServicePort
//
// +kubebuilder:validation:Minimum=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ spec:
targetPortNumber:
description: |-
TargetPortNumber is the port number that the model servers within the pool expect
to recieve traffic from.
to receive traffic from.
This maps to the TargetPort in: https://pkg.go.dev/k8s.io/api/core/v1#ServicePort
format: int32
maximum: 65535
Expand Down
61 changes: 49 additions & 12 deletions pkg/ext-proc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,48 @@ import (
)

var (
port = flag.Int("port", 9002, "gRPC port")
targetPodHeader = flag.String("targetPodHeader", "target-pod", "the header key for the target pod address to instruct Envoy to send the request to. This must match Envoy configuration.")
serverPoolName = flag.String("serverPoolName", "", "Name of the serverPool this Endpoint Picker is associated with.")
serviceName = flag.String("serviceName", "", "Name of the service that will be used to read the endpointslices from")
namespace = flag.String("namespace", "default", "The Namespace that the server pool should exist in.")
zone = flag.String("zone", "", "The zone that this instance is created in. Will be passed to the corresponding endpointSlice. ")
refreshPodsInterval = flag.Duration("refreshPodsInterval", 10*time.Second, "interval to refresh pods")
refreshMetricsInterval = flag.Duration("refreshMetricsInterval", 50*time.Millisecond, "interval to refresh metrics")
scheme = runtime.NewScheme()
port = flag.Int(
"port",
9002,
"gRPC port")
targetPodHeader = flag.String(
"targetPodHeader",
"target-pod",
"Header key used by Envoy to route to the appropriate pod. This must match Envoy configuration.")
serverPoolName = flag.String(
"serverPoolName",
"",
"Name of the serverPool this Endpoint Picker is associated with.")
serviceName = flag.String(
"serviceName",
"",
"Name of the service that will be used to read the endpointslices from")
namespace = flag.String(
"namespace",
"default",
"The Namespace that the server pool should exist in.")
zone = flag.String(
"zone",
"",
"The zone that this instance is created in. Will be passed to the corresponding endpointSlice. ")
refreshPodsInterval = flag.Duration(
"refreshPodsInterval",
10*time.Second,
"interval to refresh pods")
refreshMetricsInterval = flag.Duration(
"refreshMetricsInterval",
50*time.Millisecond,
"interval to refresh metrics")

scheme = runtime.NewScheme()
)

type healthServer struct{}

func (s *healthServer) Check(ctx context.Context, in *healthPb.HealthCheckRequest) (*healthPb.HealthCheckResponse, error) {
func (s *healthServer) Check(
ctx context.Context,
in *healthPb.HealthCheckRequest,
) (*healthPb.HealthCheckResponse, error) {
klog.Infof("Handling grpc Check request + %s", in.String())
return &healthPb.HealthCheckResponse{Status: healthPb.HealthCheckResponse_SERVING}, nil
}
Expand Down Expand Up @@ -134,7 +162,13 @@ func main() {
if err := pp.Init(*refreshPodsInterval, *refreshMetricsInterval); err != nil {
klog.Fatalf("failed to initialize: %v", err)
}
extProcPb.RegisterExternalProcessorServer(s, handlers.NewServer(pp, scheduling.NewScheduler(pp), *targetPodHeader, datastore))
extProcPb.RegisterExternalProcessorServer(
s,
handlers.NewServer(
pp,
scheduling.NewScheduler(pp),
*targetPodHeader,
datastore))
healthPb.RegisterHealthServer(s, &healthServer{})

klog.Infof("Starting gRPC server on port :%v", *port)
Expand All @@ -155,6 +189,9 @@ func main() {

}()

s.Serve(lis)
err = s.Serve(lis)
if err != nil {
klog.Fatalf("Ext-proc failed with the err: %v", err)
}

}
2 changes: 1 addition & 1 deletion pkg/ext-proc/test/hermetic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestHandleRequestBody(t *testing.T) {
name: "success",
req: GenerateRequest("my-model"),
models: map[string]*v1alpha1.InferenceModel{
"my-model": &v1alpha1.InferenceModel{
"my-model": {
Spec: v1alpha1.InferenceModelSpec{
ModelName: "my-model",
TargetModels: []v1alpha1.TargetModel{
Expand Down