Skip to content

Commit 447801c

Browse files
authoredDec 20, 2024··
Lint fixes/updating .golangci to not use deprecated linter (#125)
* Lint fixes updating .golangci to not use deprecated linter * running make manifests and adding it generate command * spacing fix
1 parent 60bab3a commit 447801c

File tree

6 files changed

+54
-17
lines changed

6 files changed

+54
-17
lines changed
 

‎.golangci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ linters:
2121
enable:
2222
- dupl
2323
- errcheck
24-
- exportloopref
24+
- copyloopvar
2525
- ginkgolinter
2626
- goconst
2727
- gocyclo

‎Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
4848
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
4949

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

‎api/v1alpha1/inferencepool_types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type InferencePoolSpec struct {
3636
Selector map[LabelKey]LabelValue `json:"selector,omitempty"`
3737

3838
// TargetPortNumber is the port number that the model servers within the pool expect
39-
// to recieve traffic from.
39+
// to receive traffic from.
4040
// This maps to the TargetPort in: https://pkg.go.dev/k8s.io/api/core/v1#ServicePort
4141
//
4242
// +kubebuilder:validation:Minimum=0

‎config/crd/bases/inference.networking.x-k8s.io_inferencepools.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ spec:
6868
targetPortNumber:
6969
description: |-
7070
TargetPortNumber is the port number that the model servers within the pool expect
71-
to recieve traffic from.
71+
to receive traffic from.
7272
This maps to the TargetPort in: https://pkg.go.dev/k8s.io/api/core/v1#ServicePort
7373
format: int32
7474
maximum: 65535

‎pkg/ext-proc/main.go

+49-12
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,48 @@ import (
2929
)
3030

3131
var (
32-
port = flag.Int("port", 9002, "gRPC port")
33-
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.")
34-
serverPoolName = flag.String("serverPoolName", "", "Name of the serverPool this Endpoint Picker is associated with.")
35-
serviceName = flag.String("serviceName", "", "Name of the service that will be used to read the endpointslices from")
36-
namespace = flag.String("namespace", "default", "The Namespace that the server pool should exist in.")
37-
zone = flag.String("zone", "", "The zone that this instance is created in. Will be passed to the corresponding endpointSlice. ")
38-
refreshPodsInterval = flag.Duration("refreshPodsInterval", 10*time.Second, "interval to refresh pods")
39-
refreshMetricsInterval = flag.Duration("refreshMetricsInterval", 50*time.Millisecond, "interval to refresh metrics")
40-
scheme = runtime.NewScheme()
32+
port = flag.Int(
33+
"port",
34+
9002,
35+
"gRPC port")
36+
targetPodHeader = flag.String(
37+
"targetPodHeader",
38+
"target-pod",
39+
"Header key used by Envoy to route to the appropriate pod. This must match Envoy configuration.")
40+
serverPoolName = flag.String(
41+
"serverPoolName",
42+
"",
43+
"Name of the serverPool this Endpoint Picker is associated with.")
44+
serviceName = flag.String(
45+
"serviceName",
46+
"",
47+
"Name of the service that will be used to read the endpointslices from")
48+
namespace = flag.String(
49+
"namespace",
50+
"default",
51+
"The Namespace that the server pool should exist in.")
52+
zone = flag.String(
53+
"zone",
54+
"",
55+
"The zone that this instance is created in. Will be passed to the corresponding endpointSlice. ")
56+
refreshPodsInterval = flag.Duration(
57+
"refreshPodsInterval",
58+
10*time.Second,
59+
"interval to refresh pods")
60+
refreshMetricsInterval = flag.Duration(
61+
"refreshMetricsInterval",
62+
50*time.Millisecond,
63+
"interval to refresh metrics")
64+
65+
scheme = runtime.NewScheme()
4166
)
4267

4368
type healthServer struct{}
4469

45-
func (s *healthServer) Check(ctx context.Context, in *healthPb.HealthCheckRequest) (*healthPb.HealthCheckResponse, error) {
70+
func (s *healthServer) Check(
71+
ctx context.Context,
72+
in *healthPb.HealthCheckRequest,
73+
) (*healthPb.HealthCheckResponse, error) {
4674
klog.Infof("Handling grpc Check request + %s", in.String())
4775
return &healthPb.HealthCheckResponse{Status: healthPb.HealthCheckResponse_SERVING}, nil
4876
}
@@ -134,7 +162,13 @@ func main() {
134162
if err := pp.Init(*refreshPodsInterval, *refreshMetricsInterval); err != nil {
135163
klog.Fatalf("failed to initialize: %v", err)
136164
}
137-
extProcPb.RegisterExternalProcessorServer(s, handlers.NewServer(pp, scheduling.NewScheduler(pp), *targetPodHeader, datastore))
165+
extProcPb.RegisterExternalProcessorServer(
166+
s,
167+
handlers.NewServer(
168+
pp,
169+
scheduling.NewScheduler(pp),
170+
*targetPodHeader,
171+
datastore))
138172
healthPb.RegisterHealthServer(s, &healthServer{})
139173

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

156190
}()
157191

158-
s.Serve(lis)
192+
err = s.Serve(lis)
193+
if err != nil {
194+
klog.Fatalf("Ext-proc failed with the err: %v", err)
195+
}
159196

160197
}

‎pkg/ext-proc/test/hermetic_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func TestHandleRequestBody(t *testing.T) {
3838
name: "success",
3939
req: GenerateRequest("my-model"),
4040
models: map[string]*v1alpha1.InferenceModel{
41-
"my-model": &v1alpha1.InferenceModel{
41+
"my-model": {
4242
Spec: v1alpha1.InferenceModelSpec{
4343
ModelName: "my-model",
4444
TargetModels: []v1alpha1.TargetModel{

0 commit comments

Comments
 (0)
Please sign in to comment.