cluster_api_rs/api/capi_extensionconfig.rs
1// WARNING: generated by kopium - manual changes will be overwritten
2// kopium command: kopium --smart-derive-elision -D Default -D PartialEq -A -d -f -
3// kopium version: 0.22.5
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 pub use std::collections::BTreeMap;
12}
13
14use self::prelude::*;
15
16/// spec is the desired state of the ExtensionConfig.
17#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
18#[kube(
19 group = "runtime.cluster.x-k8s.io",
20 version = "v1beta2",
21 kind = "ExtensionConfig",
22 plural = "extensionconfigs"
23)]
24#[kube(status = "ExtensionConfigStatus")]
25#[kube(derive = "Default")]
26#[kube(derive = "PartialEq")]
27pub struct ExtensionConfigSpec {
28 /// clientConfig defines how to communicate with the Extension server.
29 #[serde(rename = "clientConfig")]
30 pub client_config: ExtensionConfigClientConfig,
31 /// namespaceSelector decides whether to call the hook for an object based
32 /// on whether the namespace for that object matches the selector.
33 /// Defaults to the empty LabelSelector, which matches all objects.
34 #[serde(
35 default,
36 skip_serializing_if = "Option::is_none",
37 rename = "namespaceSelector"
38 )]
39 pub namespace_selector: Option<ExtensionConfigNamespaceSelector>,
40 /// settings defines key value pairs to be passed to all calls
41 /// to all supported RuntimeExtensions.
42 /// Note: Settings can be overridden on the ClusterClass.
43 #[serde(default, skip_serializing_if = "Option::is_none")]
44 pub settings: Option<BTreeMap<String, String>>,
45}
46
47/// clientConfig defines how to communicate with the Extension server.
48#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
49pub struct ExtensionConfigClientConfig {
50 /// caBundle is a PEM encoded CA bundle which will be used to validate the Extension server's server certificate.
51 #[serde(default, skip_serializing_if = "Option::is_none", rename = "caBundle")]
52 pub ca_bundle: Option<String>,
53 /// service is a reference to the Kubernetes service for the Extension server.
54 /// Note: Exactly one of `url` or `service` must be specified.
55 ///
56 /// If the Extension server is running within a cluster, then you should use `service`.
57 #[serde(default, skip_serializing_if = "Option::is_none")]
58 pub service: Option<ExtensionConfigClientConfigService>,
59 /// url gives the location of the Extension server, in standard URL form
60 /// (`scheme://host:port/path`).
61 /// Note: Exactly one of `url` or `service` must be specified.
62 ///
63 /// The scheme must be "https".
64 ///
65 /// The `host` should not refer to a service running in the cluster; use
66 /// the `service` field instead.
67 ///
68 /// A path is optional, and if present may be any string permissible in
69 /// a URL. If a path is set it will be used as prefix to the hook-specific path.
70 ///
71 /// Attempting to use a user or basic auth e.g. "user:password@" is not
72 /// allowed. Fragments ("#...") and query parameters ("?...") are not
73 /// allowed either.
74 #[serde(default, skip_serializing_if = "Option::is_none")]
75 pub url: Option<String>,
76}
77
78/// service is a reference to the Kubernetes service for the Extension server.
79/// Note: Exactly one of `url` or `service` must be specified.
80///
81/// If the Extension server is running within a cluster, then you should use `service`.
82#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
83pub struct ExtensionConfigClientConfigService {
84 /// name is the name of the service.
85 pub name: String,
86 /// namespace is the namespace of the service.
87 pub namespace: String,
88 /// path is an optional URL path and if present may be any string permissible in
89 /// a URL. If a path is set it will be used as prefix to the hook-specific path.
90 #[serde(default, skip_serializing_if = "Option::is_none")]
91 pub path: Option<String>,
92 /// port is the port on the service that's hosting the Extension server.
93 /// Defaults to 443.
94 /// Port should be a valid port number (1-65535, inclusive).
95 #[serde(default, skip_serializing_if = "Option::is_none")]
96 pub port: Option<i32>,
97}
98
99/// namespaceSelector decides whether to call the hook for an object based
100/// on whether the namespace for that object matches the selector.
101/// Defaults to the empty LabelSelector, which matches all objects.
102#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
103pub struct ExtensionConfigNamespaceSelector {
104 /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
105 #[serde(
106 default,
107 skip_serializing_if = "Option::is_none",
108 rename = "matchExpressions"
109 )]
110 pub match_expressions: Option<Vec<ExtensionConfigNamespaceSelectorMatchExpressions>>,
111 /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
112 /// map is equivalent to an element of matchExpressions, whose key field is "key", the
113 /// operator is "In", and the values array contains only "value". The requirements are ANDed.
114 #[serde(
115 default,
116 skip_serializing_if = "Option::is_none",
117 rename = "matchLabels"
118 )]
119 pub match_labels: Option<BTreeMap<String, String>>,
120}
121
122/// A label selector requirement is a selector that contains values, a key, and an operator that
123/// relates the key and values.
124#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
125pub struct ExtensionConfigNamespaceSelectorMatchExpressions {
126 /// key is the label key that the selector applies to.
127 pub key: String,
128 /// operator represents a key's relationship to a set of values.
129 /// Valid operators are In, NotIn, Exists and DoesNotExist.
130 pub operator: String,
131 /// values is an array of string values. If the operator is In or NotIn,
132 /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
133 /// the values array must be empty. This array is replaced during a strategic
134 /// merge patch.
135 #[serde(default, skip_serializing_if = "Option::is_none")]
136 pub values: Option<Vec<String>>,
137}
138
139/// status is the current state of the ExtensionConfig
140#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
141pub struct ExtensionConfigStatus {
142 /// conditions represents the observations of a ExtensionConfig's current state.
143 /// Known condition types are Discovered, Paused.
144 #[serde(default, skip_serializing_if = "Option::is_none")]
145 pub conditions: Option<Vec<Condition>>,
146 /// deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.
147 #[serde(default, skip_serializing_if = "Option::is_none")]
148 pub deprecated: Option<ExtensionConfigStatusDeprecated>,
149 /// handlers defines the current ExtensionHandlers supported by an Extension.
150 #[serde(default, skip_serializing_if = "Option::is_none")]
151 pub handlers: Option<Vec<ExtensionConfigStatusHandlers>>,
152}
153
154/// deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.
155#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
156pub struct ExtensionConfigStatusDeprecated {
157 /// v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.
158 ///
159 /// Deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see <https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md> for more details.
160 #[serde(default, skip_serializing_if = "Option::is_none")]
161 pub v1beta1: Option<ExtensionConfigStatusDeprecatedV1beta1>,
162}
163
164/// v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.
165///
166/// Deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see <https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md> for more details.
167#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
168pub struct ExtensionConfigStatusDeprecatedV1beta1 {
169 /// conditions defines current service state of the ExtensionConfig.
170 ///
171 /// Deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see <https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md> for more details.
172 #[serde(default, skip_serializing_if = "Option::is_none")]
173 pub conditions: Option<Vec<Condition>>,
174}
175
176/// ExtensionHandler specifies the details of a handler for a particular runtime hook registered by an Extension server.
177#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
178pub struct ExtensionConfigStatusHandlers {
179 /// failurePolicy defines how failures in calls to the ExtensionHandler should be handled by a client.
180 /// Defaults to Fail if not set.
181 #[serde(
182 default,
183 skip_serializing_if = "Option::is_none",
184 rename = "failurePolicy"
185 )]
186 pub failure_policy: Option<ExtensionConfigStatusHandlersFailurePolicy>,
187 /// name is the unique name of the ExtensionHandler.
188 pub name: String,
189 /// requestHook defines the versioned runtime hook which this ExtensionHandler serves.
190 #[serde(rename = "requestHook")]
191 pub request_hook: ExtensionConfigStatusHandlersRequestHook,
192 /// timeoutSeconds defines the timeout duration for client calls to the ExtensionHandler.
193 /// Defaults to 10 if not set.
194 #[serde(
195 default,
196 skip_serializing_if = "Option::is_none",
197 rename = "timeoutSeconds"
198 )]
199 pub timeout_seconds: Option<i32>,
200}
201
202/// ExtensionHandler specifies the details of a handler for a particular runtime hook registered by an Extension server.
203#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
204pub enum ExtensionConfigStatusHandlersFailurePolicy {
205 Ignore,
206 Fail,
207}
208
209/// requestHook defines the versioned runtime hook which this ExtensionHandler serves.
210#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, JsonSchema)]
211pub struct ExtensionConfigStatusHandlersRequestHook {
212 /// apiVersion is the group and version of the Hook.
213 #[serde(rename = "apiVersion")]
214 pub api_version: String,
215 /// hook is the name of the hook.
216 pub hook: String,
217}