Skip to content

Commit 8c582e3

Browse files
committed
clean up ports
1 parent 5033512 commit 8c582e3

File tree

2 files changed

+30
-13
lines changed

2 files changed

+30
-13
lines changed

apix/v1/inferencepool_types.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ type Port struct {
9696

9797
// EndpointPickerRef specifies a reference to an Endpoint Picker extension and its
9898
// associated configuration.
99+
// +kubebuilder:validation:XValidation:rule="self.kind != 'Service' || has(self.port)",message="port is required when kind is 'Service'"
99100
type EndpointPickerRef struct {
100101
// Group is the group of the referent API object. When unspecified, the default value
101102
// is "", representing the Core API group.
@@ -125,13 +126,15 @@ type EndpointPickerRef struct {
125126
// +required
126127
Name ObjectName `json:"name,omitempty"`
127128

128-
// PortNumber is the port number of the Endpoint Picker extension service. When unspecified,
129-
// implementations SHOULD infer a default value of 9002 when the kind field is "Service" or
130-
// unspecified (defaults to "Service").
129+
// Port is the port of the Endpoint Picker extension service.
130+
//
131+
// Port is required when the referent is a Kubernetes Service. In this
132+
// case, the port number is the service port number, not the target port.
133+
// For other resources, destination port might be derived from the referent
134+
// resource or this field.
131135
//
132136
// +optional
133-
//nolint:kubeapilinter // ignore kubeapilinter here as we want to use pointer as zero means all ports in convention, we don't make to use 0 to indicate not set.
134-
PortNumber *PortNumber `json:"portNumber,omitempty"`
137+
Port *Port `json:"port,omitempty"`
135138

136139
// FailureMode configures how the parent handles the case when the Endpoint Picker extension
137140
// is non-responsive. When unspecified, defaults to "FailClose".

config/crd/bases/inference.networking.k8s.io_inferencepools.yaml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,32 @@ spec:
8989
maxLength: 253
9090
minLength: 1
9191
type: string
92-
portNumber:
92+
port:
9393
description: |-
94-
PortNumber is the port number of the Endpoint Picker extension service. When unspecified,
95-
implementations SHOULD infer a default value of 9002 when the kind field is "Service" or
96-
unspecified (defaults to "Service").
97-
format: int32
98-
maximum: 65535
99-
minimum: 1
100-
type: integer
94+
Port is the port of the Endpoint Picker extension service.
95+
96+
Port is required when the referent is a Kubernetes Service. In this
97+
case, the port number is the service port number, not the target port.
98+
For other resources, destination port might be derived from the referent
99+
resource or this field.
100+
properties:
101+
number:
102+
description: |-
103+
Number defines the port number to access the selected model server Pods.
104+
The number must be in the range 1 to 65535.
105+
format: int32
106+
maximum: 65535
107+
minimum: 1
108+
type: integer
109+
required:
110+
- number
111+
type: object
101112
required:
102113
- name
103114
type: object
115+
x-kubernetes-validations:
116+
- message: port is required when kind is 'Service'
117+
rule: self.kind != 'Service' || has(self.port)
104118
selector:
105119
description: |-
106120
Selector determines which Pods are members of this inference pool.

0 commit comments

Comments
 (0)