gateway_api/apis/standard/gatewayclasses.rs
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.21.2
4
5#[allow(unused_imports)]
6mod prelude {
7 pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
8 pub use kube::CustomResource;
9 pub use schemars::JsonSchema;
10 pub use serde::{Deserialize, Serialize};
11}
12use self::prelude::*;
13
14/// Spec defines the desired state of GatewayClass.
15#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
16#[kube(
17 group = "gateway.networking.k8s.io",
18 version = "v1",
19 kind = "GatewayClass",
20 plural = "gatewayclasses"
21)]
22#[kube(status = "GatewayClassStatus")]
23#[kube(derive = "Default")]
24#[kube(derive = "PartialEq")]
25pub struct GatewayClassSpec {
26 /// ControllerName is the name of the controller that is managing Gateways of
27 /// this class. The value of this field MUST be a domain prefixed path.
28 ///
29 /// Example: "example.net/gateway-controller".
30 ///
31 /// This field is not mutable and cannot be empty.
32 ///
33 /// Support: Core
34 #[serde(rename = "controllerName")]
35 pub controller_name: String,
36 /// Description helps describe a GatewayClass with more details.
37 #[serde(default, skip_serializing_if = "Option::is_none")]
38 pub description: Option<String>,
39 /// ParametersRef is a reference to a resource that contains the configuration
40 /// parameters corresponding to the GatewayClass. This is optional if the
41 /// controller does not require any additional configuration.
42 ///
43 /// ParametersRef can reference a standard Kubernetes resource, i.e. ConfigMap,
44 /// or an implementation-specific custom resource. The resource can be
45 /// cluster-scoped or namespace-scoped.
46 ///
47 /// If the referent cannot be found, refers to an unsupported kind, or when
48 /// the data within that resource is malformed, the GatewayClass SHOULD be
49 /// rejected with the "Accepted" status condition set to "False" and an
50 /// "InvalidParameters" reason.
51 ///
52 /// A Gateway for this GatewayClass may provide its own `parametersRef`. When both are specified,
53 /// the merging behavior is implementation specific.
54 /// It is generally recommended that GatewayClass provides defaults that can be overridden by a Gateway.
55 ///
56 /// Support: Implementation-specific
57 #[serde(
58 default,
59 skip_serializing_if = "Option::is_none",
60 rename = "parametersRef"
61 )]
62 pub parameters_ref: Option<GatewayClassParametersRef>,
63}
64
65/// ParametersRef is a reference to a resource that contains the configuration
66/// parameters corresponding to the GatewayClass. This is optional if the
67/// controller does not require any additional configuration.
68///
69/// ParametersRef can reference a standard Kubernetes resource, i.e. ConfigMap,
70/// or an implementation-specific custom resource. The resource can be
71/// cluster-scoped or namespace-scoped.
72///
73/// If the referent cannot be found, refers to an unsupported kind, or when
74/// the data within that resource is malformed, the GatewayClass SHOULD be
75/// rejected with the "Accepted" status condition set to "False" and an
76/// "InvalidParameters" reason.
77///
78/// A Gateway for this GatewayClass may provide its own `parametersRef`. When both are specified,
79/// the merging behavior is implementation specific.
80/// It is generally recommended that GatewayClass provides defaults that can be overridden by a Gateway.
81///
82/// Support: Implementation-specific
83#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
84pub struct GatewayClassParametersRef {
85 /// Group is the group of the referent.
86 pub group: String,
87 /// Kind is kind of the referent.
88 pub kind: String,
89 /// Name is the name of the referent.
90 pub name: String,
91 /// Namespace is the namespace of the referent.
92 /// This field is required when referring to a Namespace-scoped resource and
93 /// MUST be unset when referring to a Cluster-scoped resource.
94 #[serde(default, skip_serializing_if = "Option::is_none")]
95 pub namespace: Option<String>,
96}
97
98/// Status defines the current state of GatewayClass.
99///
100/// Implementations MUST populate status on all GatewayClass resources which
101/// specify their controller name.
102#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
103pub struct GatewayClassStatus {
104 /// Conditions is the current status from the controller for
105 /// this GatewayClass.
106 ///
107 /// Controllers should prefer to publish conditions using values
108 /// of GatewayClassConditionType for the type of each Condition.
109 #[serde(default, skip_serializing_if = "Option::is_none")]
110 pub conditions: Option<Vec<Condition>>,
111}