|
| 1 | +// WARNING: generated by kopium - manual changes will be overwritten |
| 2 | +// kopium command: kopium --schema=derived --derive=JsonSchema --derive=Default --derive=PartialEq --docs -f - |
| 3 | +// kopium version: 0.22.5 |
| 4 | + |
| 5 | +#[allow(unused_imports)] |
| 6 | +mod prelude { |
| 7 | + pub use kube_derive::CustomResource; |
| 8 | + pub use schemars::JsonSchema; |
| 9 | + pub use serde::{Serialize, Deserialize}; |
| 10 | + pub use std::collections::BTreeMap; |
| 11 | + pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition; |
| 12 | +} |
| 13 | +use self::prelude::*; |
| 14 | + |
| 15 | +/// InferencePoolSpec defines the desired state of InferencePool |
| 16 | +#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)] |
| 17 | +#[kube(group = "inference.networking.x-k8s.io", version = "v1alpha2", kind = "InferencePool", plural = "inferencepools")] |
| 18 | +#[kube(namespaced)] |
| 19 | +#[kube(status = "InferencePoolStatus")] |
| 20 | +#[kube(derive="Default")] |
| 21 | +#[kube(derive="PartialEq")] |
| 22 | +pub struct InferencePoolSpec { |
| 23 | + /// Extension configures an endpoint picker as an extension service. |
| 24 | + #[serde(rename = "extensionRef")] |
| 25 | + pub extension_ref: InferencePoolExtensionRef, |
| 26 | + /// Selector defines a map of labels to watch model server Pods |
| 27 | + /// that should be included in the InferencePool. |
| 28 | + /// In some cases, implementations may translate this field to a Service selector, so this matches the simple |
| 29 | + /// map used for Service selectors instead of the full Kubernetes LabelSelector type. |
| 30 | + /// If specified, it will be applied to match the model server pods in the same namespace as the InferencePool. |
| 31 | + /// Cross namesoace selector is not supported. |
| 32 | + pub selector: BTreeMap<String, String>, |
| 33 | + /// TargetPortNumber defines the port number to access the selected model server Pods. |
| 34 | + /// The number must be in the range 1 to 65535. |
| 35 | + #[serde(rename = "targetPortNumber")] |
| 36 | + pub target_port_number: i32, |
| 37 | +} |
| 38 | + |
| 39 | +/// Extension configures an endpoint picker as an extension service. |
| 40 | +#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)] |
| 41 | +pub struct InferencePoolExtensionRef { |
| 42 | + /// Configures how the gateway handles the case when the extension is not responsive. |
| 43 | + /// Defaults to failClose. |
| 44 | + #[serde(default, skip_serializing_if = "Option::is_none", rename = "failureMode")] |
| 45 | + pub failure_mode: Option<InferencePoolExtensionRefFailureMode>, |
| 46 | + /// Group is the group of the referent. |
| 47 | + /// The default value is "", representing the Core API group. |
| 48 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 49 | + pub group: Option<String>, |
| 50 | + /// Kind is the Kubernetes resource kind of the referent. |
| 51 | + /// |
| 52 | + /// Defaults to "Service" when not specified. |
| 53 | + /// |
| 54 | + /// ExternalName services can refer to CNAME DNS records that may live |
| 55 | + /// outside of the cluster and as such are difficult to reason about in |
| 56 | + /// terms of conformance. They also may not be safe to forward to (see |
| 57 | + /// CVE-2021-25740 for more information). Implementations MUST NOT |
| 58 | + /// support ExternalName Services. |
| 59 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 60 | + pub kind: Option<String>, |
| 61 | + /// Name is the name of the referent. |
| 62 | + pub name: String, |
| 63 | + /// The port number on the service running the extension. When unspecified, |
| 64 | + /// implementations SHOULD infer a default value of 9002 when the Kind is |
| 65 | + /// Service. |
| 66 | + #[serde(default, skip_serializing_if = "Option::is_none", rename = "portNumber")] |
| 67 | + pub port_number: Option<i32>, |
| 68 | +} |
| 69 | + |
| 70 | +/// Extension configures an endpoint picker as an extension service. |
| 71 | +#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)] |
| 72 | +pub enum InferencePoolExtensionRefFailureMode { |
| 73 | + FailOpen, |
| 74 | + FailClose, |
| 75 | +} |
| 76 | + |
| 77 | +/// Status defines the observed state of InferencePool. |
| 78 | +#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)] |
| 79 | +pub struct InferencePoolStatus { |
| 80 | + /// Parents is a list of parent resources (usually Gateways) that are |
| 81 | + /// associated with the InferencePool, and the status of the InferencePool with respect to |
| 82 | + /// each parent. |
| 83 | + /// |
| 84 | + /// A maximum of 32 Gateways will be represented in this list. When the list contains |
| 85 | + /// `kind: Status, name: default`, it indicates that the InferencePool is not |
| 86 | + /// associated with any Gateway and a controller must perform the following: |
| 87 | + /// |
| 88 | + /// - Remove the parent when setting the "Accepted" condition. |
| 89 | + /// - Add the parent when the controller will no longer manage the InferencePool |
| 90 | + /// and no other parents exist. |
| 91 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 92 | + pub parent: Option<Vec<InferencePoolStatusParent>>, |
| 93 | +} |
| 94 | + |
| 95 | +/// PoolStatus defines the observed state of InferencePool from a Gateway. |
| 96 | +#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)] |
| 97 | +pub struct InferencePoolStatusParent { |
| 98 | + /// Conditions track the state of the InferencePool. |
| 99 | + /// |
| 100 | + /// Known condition types are: |
| 101 | + /// |
| 102 | + /// * "Accepted" |
| 103 | + /// * "ResolvedRefs" |
| 104 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 105 | + pub conditions: Option<Vec<Condition>>, |
| 106 | + /// GatewayRef indicates the gateway that observed state of InferencePool. |
| 107 | + #[serde(rename = "parentRef")] |
| 108 | + pub parent_ref: InferencePoolStatusParentParentRef, |
| 109 | +} |
| 110 | + |
| 111 | +/// GatewayRef indicates the gateway that observed state of InferencePool. |
| 112 | +#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)] |
| 113 | +pub struct InferencePoolStatusParentParentRef { |
| 114 | + /// Group is the group of the referent. |
| 115 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 116 | + pub group: Option<String>, |
| 117 | + /// Kind is kind of the referent. For example "Gateway". |
| 118 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 119 | + pub kind: Option<String>, |
| 120 | + /// Name is the name of the referent. |
| 121 | + pub name: String, |
| 122 | + /// Namespace is the namespace of the referent. If not present, |
| 123 | + /// the namespace of the referent is assumed to be the same as |
| 124 | + /// the namespace of the referring object. |
| 125 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 126 | + pub namespace: Option<String>, |
| 127 | +} |
| 128 | + |
0 commit comments