Skip to content

Commit ca3d9dd

Browse files
committed
fixed port
1 parent ca703a4 commit ca3d9dd

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

api/v1/inferencepool_types.go

Lines changed: 7 additions & 3 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,9 +126,12 @@ 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
133137
Port *Port `json:"port,omitempty"`

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,12 @@ spec:
9191
type: string
9292
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").
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.
97100
properties:
98101
number:
99102
description: |-
@@ -109,6 +112,9 @@ spec:
109112
required:
110113
- name
111114
type: object
115+
x-kubernetes-validations:
116+
- message: port is required when kind is 'Service'
117+
rule: self.kind != 'Service' || has(self.port)
112118
selector:
113119
description: |-
114120
Selector determines which Pods are members of this inference pool.

site-src/reference/spec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ _Appears in:_
5151
| `group` _[Group](#group)_ | Group is the group of the referent API object. When unspecified, the default value<br />is "", representing the Core API group. | | MaxLength: 253 <br />MinLength: 0 <br />Pattern: `^$\|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` <br /> |
5252
| `kind` _[Kind](#kind)_ | Kind is the Kubernetes resource kind of the referent.<br />Required if the referent is ambiguous, e.g. service with multiple ports.<br />Defaults to "Service" when not specified.<br />ExternalName services can refer to CNAME DNS records that may live<br />outside of the cluster and as such are difficult to reason about in<br />terms of conformance. They also may not be safe to forward to (see<br />CVE-2021-25740 for more information). Implementations MUST NOT<br />support ExternalName Services. | Service | MaxLength: 63 <br />MinLength: 1 <br />Pattern: `^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$` <br /> |
5353
| `name` _[ObjectName](#objectname)_ | Name is the name of the referent API object. | | MaxLength: 253 <br />MinLength: 1 <br /> |
54-
| `port` _[Port](#port)_ | PortNumber is the port number of the Endpoint Picker extension service. When unspecified,<br />implementations SHOULD infer a default value of 9002 when the kind field is "Service" or<br />unspecified (defaults to "Service"). | | |
54+
| `port` _[Port](#port)_ | Port is the port of the Endpoint Picker extension service.<br />Port is required when the referent is a Kubernetes Service. In this<br />case, the port number is the service port number, not the target port.<br />For other resources, destination port might be derived from the referent<br />resource or this field. | | |
5555
| `failureMode` _[EndpointPickerFailureMode](#endpointpickerfailuremode)_ | FailureMode configures how the parent handles the case when the Endpoint Picker extension<br />is non-responsive. When unspecified, defaults to "FailClose". | FailClose | Enum: [FailOpen FailClose] <br /> |
5656

5757

0 commit comments

Comments
 (0)