cluster_api_rs/api/
capi_extensionconfig.rs

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