@@ -59,8 +59,87 @@ type InferencePoolSpec struct {
59
59
// +kubebuilder:validation:Maximum=65535
60
60
// +kubebuilder:validation:Required
61
61
TargetPortNumber int32 `json:"targetPortNumber"`
62
+
63
+ // EndpointPickerConfig selects and configures the endpoint picking algorithm to apply on the requests sent
64
+ // to this pool.
65
+ EndpointPickerConfig `json:"endpointPickerConfig"`
66
+ }
67
+
68
+ type EndpointPickerConfig struct {
69
+ // Extension configures an endpoint picker as an extension service.
70
+ //
71
+ // +optional
72
+ Extension * ExtensionConfig `json:"extension"`
73
+ }
74
+
75
+ // ExtensionConfig specifies how to configure an extension that implements the endpoint picking
76
+ // algorithm.
77
+ type ExtensionConfig struct {
78
+ // ExtensionRef is a reference to a deployed extension.
79
+ ExtensionRef * ExtensionReference `json:"extensionRef"`
80
+
81
+ // ExtensionConnection configures the connection between the gateway and the extension.
82
+ ExtensionConnection `json:"extensionConnection"`
62
83
}
63
84
85
+ // ExtensionReference is a reference to the extension deployment.
86
+ type ExtensionReference struct {
87
+ // Group is the group of the referent.
88
+ // When unspecified or empty string, core API group is inferred.
89
+ //
90
+ // +optional
91
+ // +kubebuilder:default=""
92
+ Group * string `json:"group,omitempty"`
93
+
94
+ // Kind is the Kubernetes resource kind of the referent. For example
95
+ // "Service".
96
+ //
97
+ // Defaults to "Service" when not specified.
98
+ //
99
+ // ExternalName services can refer to CNAME DNS records that may live
100
+ // outside of the cluster and as such are difficult to reason about in
101
+ // terms of conformance. They also may not be safe to forward to (see
102
+ // CVE-2021-25740 for more information). Implementations SHOULD NOT
103
+ // support ExternalName Services.
104
+ //
105
+ // Support: Core (Services with a type other than ExternalName)
106
+ //
107
+ // Support: Implementation-specific (Services with type ExternalName)
108
+ //
109
+ // +optional
110
+ // +kubebuilder:default=Service
111
+ Kind * string `json:"kind,omitempty"`
112
+
113
+ // Name is the name of the referent.
114
+ Name string `json:"name"`
115
+
116
+ // The port number on the pods running the extension. Defaults to 9002 if not set.
117
+ //
118
+ // +kubebuilder:default=9002
119
+ TargetPortNumber * int32 `json:"targetPortNumber"`
120
+ }
121
+
122
+ // ExtensionConnection encapsulates options that configures the connection to the extension.
123
+ type ExtensionConnection struct {
124
+ // Configures how the gateway handles the case when the extension is not responsive.
125
+ // Defaults to failClose.
126
+ //
127
+ // +kubebuilder:default="FailClose"
128
+ FailureMode ExtensionFailureMode `json:"failureMode"`
129
+ }
130
+
131
+ // ExtensionFailureMode defines the options for how the gateway handles the case when the extension is not
132
+ // responsive.
133
+ // +kubebuilder:validation:Enum=FailOpen;FailClose
134
+ type ExtensionFailureMode string
135
+
136
+ const (
137
+ // The endpoint will be selected via the provider’s LB configured algorithm.
138
+ FailOpen ExtensionFailureMode = "FailOpen"
139
+ // Requests should be dropped.
140
+ FailClose ExtensionFailureMode = "FailClose"
141
+ )
142
+
64
143
// LabelKey was originally copied from: https://github.com/kubernetes-sigs/gateway-api/blob/99a3934c6bc1ce0874f3a4c5f20cafd8977ffcb4/apis/v1/shared_types.go#L694-L731
65
144
// Duplicated as to not take an unexpected dependency on gw's API.
66
145
//
0 commit comments