Skip to main content

k8s_openapi/v1_37/api/certificates/v1beta1/
pod_certificate_request_spec.rs

1// Generated from definition io.k8s.api.certificates.v1beta1.PodCertificateRequestSpec
2
3/// PodCertificateRequestSpec describes the certificate request.  All fields are immutable after creation.
4#[derive(Clone, Debug, Default, PartialEq)]
5pub struct PodCertificateRequestSpec {
6    /// maxExpirationSeconds is the maximum lifetime permitted for the certificate.
7    ///
8    /// If omitted, kube-apiserver will set it to 86400(24 hours). kube-apiserver will reject values shorter than 3600 (1 hour).  The maximum allowable value is 7862400 (91 days).
9    ///
10    /// The signer implementation is then free to issue a certificate with any lifetime *shorter* than MaxExpirationSeconds, but no shorter than 3600 seconds (1 hour).  This constraint is enforced by kube-apiserver. `kubernetes.io` signers will never issue certificates with a lifetime longer than 24 hours.
11    pub max_expiration_seconds: Option<i32>,
12
13    /// nodeName is the name of the node the pod is assigned to.
14    pub node_name: std::string::String,
15
16    /// nodeUID is the UID of the node the pod is assigned to.
17    pub node_uid: std::string::String,
18
19    /// The PKIX-serialized public key the signer will issue the certificate to.
20    ///
21    /// The key must be one of RSA3072, RSA4096, ECDSAP256, ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in the future.
22    ///
23    /// Signer implementations do not need to support all key types supported by kube-apiserver and kubelet.  If a signer does not support the key type used for a given PodCertificateRequest, it must deny the request by setting a status.conditions entry with a type of "Denied" and a reason of "UnsupportedKeyType". It may also suggest a key type that it does support in the message field.
24    ///
25    /// Deprecated: This field is replaced by StubPKCS10Request. If StubPKCS10Request is set, this field must be empty.  Signer implementations should extract the public key from the StubPKCS10Request field.
26    pub pkix_public_key: Option<crate::ByteString>,
27
28    /// podName is the name of the pod into which the certificate will be mounted.
29    pub pod_name: std::string::String,
30
31    /// podUID is the UID of the pod into which the certificate will be mounted.
32    pub pod_uid: std::string::String,
33
34    /// A proof that the requesting kubelet holds the private key corresponding to pkixPublicKey.
35    ///
36    /// It is contructed by signing the ASCII bytes of the pod's UID using `pkixPublicKey`.
37    ///
38    /// kube-apiserver validates the proof of possession during creation of the PodCertificateRequest.
39    ///
40    /// If the key is an RSA key, then the signature is over the ASCII bytes of the pod UID, using RSASSA-PSS from RFC 8017 (as implemented by the golang function crypto/rsa.SignPSS with nil options).
41    ///
42    /// If the key is an ECDSA key, then the signature is as described by \[SEC 1, Version 2.0\](https://www.secg.org/sec1-v2.pdf) (as implemented by the golang library function crypto/ecdsa.SignASN1)
43    ///
44    /// If the key is an ED25519 key, the the signature is as described by the \[ED25519 Specification\](https://ed25519.cr.yp.to/) (as implemented by the golang library crypto/ed25519.Sign).
45    ///
46    /// Deprecated: This field is replaced by StubPKCS10Request. If StubPKCS10Request is set, this field must be empty.
47    pub proof_of_possession: Option<crate::ByteString>,
48
49    /// serviceAccountName is the name of the service account the pod is running as.
50    pub service_account_name: std::string::String,
51
52    /// serviceAccountUID is the UID of the service account the pod is running as.
53    pub service_account_uid: std::string::String,
54
55    /// signerName indicates the requested signer.
56    ///
57    /// All signer names beginning with `kubernetes.io` are reserved for use by the Kubernetes project.  There is currently one well-known signer documented by the Kubernetes project, `kubernetes.io/kube-apiserver-client-pod`, which will issue client certificates understood by kube-apiserver.  It is currently unimplemented.
58    pub signer_name: std::string::String,
59
60    /// A PKCS#10 certificate signing request (DER-serialized) generated by Kubelet using the subject private key.
61    ///
62    /// Most signer implementations will ignore the contents of the CSR except to extract the subject public key. The API server automatically verifies the CSR signature during admission, so the signer does not need to repeat the verification.  CSRs generated by kubelet are completely empty.
63    ///
64    /// The subject public key must be one of RSA3072, RSA4096, ECDSAP256, ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in the future.
65    ///
66    /// Signer implementations do not need to support all key types supported by kube-apiserver and kubelet.  If a signer does not support the key type used for a given PodCertificateRequest, it must deny the request by setting a status.conditions entry with a type of "Denied" and a reason of "UnsupportedKeyType". It may also suggest a key type that it does support in the message field.
67    pub stub_pkc_s10_request: crate::ByteString,
68
69    /// unverifiedUserAnnotations allow pod authors to pass additional information to the signer implementation.  Kubernetes does not restrict or validate this metadata in any way.
70    ///
71    /// Entries are subject to the same validation as object metadata annotations, with the addition that all keys must be domain-prefixed. No restrictions are placed on values, except an overall size limitation on the entire field.
72    ///
73    /// Signers should document the keys and values they support.  Signers should deny requests that contain keys they do not recognize.
74    pub unverified_user_annotations: Option<std::collections::BTreeMap<std::string::String, std::string::String>>,
75}
76
77impl crate::DeepMerge for PodCertificateRequestSpec {
78    fn merge_from(&mut self, other: Self) {
79        crate::DeepMerge::merge_from(&mut self.max_expiration_seconds, other.max_expiration_seconds);
80        crate::DeepMerge::merge_from(&mut self.node_name, other.node_name);
81        crate::DeepMerge::merge_from(&mut self.node_uid, other.node_uid);
82        crate::DeepMerge::merge_from(&mut self.pkix_public_key, other.pkix_public_key);
83        crate::DeepMerge::merge_from(&mut self.pod_name, other.pod_name);
84        crate::DeepMerge::merge_from(&mut self.pod_uid, other.pod_uid);
85        crate::DeepMerge::merge_from(&mut self.proof_of_possession, other.proof_of_possession);
86        crate::DeepMerge::merge_from(&mut self.service_account_name, other.service_account_name);
87        crate::DeepMerge::merge_from(&mut self.service_account_uid, other.service_account_uid);
88        crate::DeepMerge::merge_from(&mut self.signer_name, other.signer_name);
89        crate::DeepMerge::merge_from(&mut self.stub_pkc_s10_request, other.stub_pkc_s10_request);
90        crate::merge_strategies::map::granular(&mut self.unverified_user_annotations, other.unverified_user_annotations, |current_item, other_item| {
91            crate::DeepMerge::merge_from(current_item, other_item);
92        });
93    }
94}
95
96impl<'de> crate::serde::Deserialize<'de> for PodCertificateRequestSpec {
97    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
98        #[allow(non_camel_case_types)]
99        enum Field {
100            Key_max_expiration_seconds,
101            Key_node_name,
102            Key_node_uid,
103            Key_pkix_public_key,
104            Key_pod_name,
105            Key_pod_uid,
106            Key_proof_of_possession,
107            Key_service_account_name,
108            Key_service_account_uid,
109            Key_signer_name,
110            Key_stub_pkc_s10_request,
111            Key_unverified_user_annotations,
112            Other,
113        }
114
115        impl<'de> crate::serde::Deserialize<'de> for Field {
116            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
117                struct Visitor;
118
119                impl crate::serde::de::Visitor<'_> for Visitor {
120                    type Value = Field;
121
122                    fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
123                        f.write_str("field identifier")
124                    }
125
126                    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
127                        Ok(match v {
128                            "maxExpirationSeconds" => Field::Key_max_expiration_seconds,
129                            "nodeName" => Field::Key_node_name,
130                            "nodeUID" => Field::Key_node_uid,
131                            "pkixPublicKey" => Field::Key_pkix_public_key,
132                            "podName" => Field::Key_pod_name,
133                            "podUID" => Field::Key_pod_uid,
134                            "proofOfPossession" => Field::Key_proof_of_possession,
135                            "serviceAccountName" => Field::Key_service_account_name,
136                            "serviceAccountUID" => Field::Key_service_account_uid,
137                            "signerName" => Field::Key_signer_name,
138                            "stubPKCS10Request" => Field::Key_stub_pkc_s10_request,
139                            "unverifiedUserAnnotations" => Field::Key_unverified_user_annotations,
140                            _ => Field::Other,
141                        })
142                    }
143                }
144
145                deserializer.deserialize_identifier(Visitor)
146            }
147        }
148
149        struct Visitor;
150
151        impl<'de> crate::serde::de::Visitor<'de> for Visitor {
152            type Value = PodCertificateRequestSpec;
153
154            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
155                f.write_str("PodCertificateRequestSpec")
156            }
157
158            fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
159                let mut value_max_expiration_seconds: Option<i32> = None;
160                let mut value_node_name: Option<std::string::String> = None;
161                let mut value_node_uid: Option<std::string::String> = None;
162                let mut value_pkix_public_key: Option<crate::ByteString> = None;
163                let mut value_pod_name: Option<std::string::String> = None;
164                let mut value_pod_uid: Option<std::string::String> = None;
165                let mut value_proof_of_possession: Option<crate::ByteString> = None;
166                let mut value_service_account_name: Option<std::string::String> = None;
167                let mut value_service_account_uid: Option<std::string::String> = None;
168                let mut value_signer_name: Option<std::string::String> = None;
169                let mut value_stub_pkc_s10_request: Option<crate::ByteString> = None;
170                let mut value_unverified_user_annotations: Option<std::collections::BTreeMap<std::string::String, std::string::String>> = None;
171
172                while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
173                    match key {
174                        Field::Key_max_expiration_seconds => value_max_expiration_seconds = crate::serde::de::MapAccess::next_value(&mut map)?,
175                        Field::Key_node_name => value_node_name = crate::serde::de::MapAccess::next_value(&mut map)?,
176                        Field::Key_node_uid => value_node_uid = crate::serde::de::MapAccess::next_value(&mut map)?,
177                        Field::Key_pkix_public_key => value_pkix_public_key = crate::serde::de::MapAccess::next_value(&mut map)?,
178                        Field::Key_pod_name => value_pod_name = crate::serde::de::MapAccess::next_value(&mut map)?,
179                        Field::Key_pod_uid => value_pod_uid = crate::serde::de::MapAccess::next_value(&mut map)?,
180                        Field::Key_proof_of_possession => value_proof_of_possession = crate::serde::de::MapAccess::next_value(&mut map)?,
181                        Field::Key_service_account_name => value_service_account_name = crate::serde::de::MapAccess::next_value(&mut map)?,
182                        Field::Key_service_account_uid => value_service_account_uid = crate::serde::de::MapAccess::next_value(&mut map)?,
183                        Field::Key_signer_name => value_signer_name = crate::serde::de::MapAccess::next_value(&mut map)?,
184                        Field::Key_stub_pkc_s10_request => value_stub_pkc_s10_request = crate::serde::de::MapAccess::next_value(&mut map)?,
185                        Field::Key_unverified_user_annotations => value_unverified_user_annotations = crate::serde::de::MapAccess::next_value(&mut map)?,
186                        Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; },
187                    }
188                }
189
190                Ok(PodCertificateRequestSpec {
191                    max_expiration_seconds: value_max_expiration_seconds,
192                    node_name: value_node_name.unwrap_or_default(),
193                    node_uid: value_node_uid.unwrap_or_default(),
194                    pkix_public_key: value_pkix_public_key,
195                    pod_name: value_pod_name.unwrap_or_default(),
196                    pod_uid: value_pod_uid.unwrap_or_default(),
197                    proof_of_possession: value_proof_of_possession,
198                    service_account_name: value_service_account_name.unwrap_or_default(),
199                    service_account_uid: value_service_account_uid.unwrap_or_default(),
200                    signer_name: value_signer_name.unwrap_or_default(),
201                    stub_pkc_s10_request: value_stub_pkc_s10_request.unwrap_or_default(),
202                    unverified_user_annotations: value_unverified_user_annotations,
203                })
204            }
205        }
206
207        deserializer.deserialize_struct(
208            "PodCertificateRequestSpec",
209            &[
210                "maxExpirationSeconds",
211                "nodeName",
212                "nodeUID",
213                "pkixPublicKey",
214                "podName",
215                "podUID",
216                "proofOfPossession",
217                "serviceAccountName",
218                "serviceAccountUID",
219                "signerName",
220                "stubPKCS10Request",
221                "unverifiedUserAnnotations",
222            ],
223            Visitor,
224        )
225    }
226}
227
228impl crate::serde::Serialize for PodCertificateRequestSpec {
229    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
230        let mut state = serializer.serialize_struct(
231            "PodCertificateRequestSpec",
232            8 +
233            self.max_expiration_seconds.as_ref().map_or(0, |_| 1) +
234            self.pkix_public_key.as_ref().map_or(0, |_| 1) +
235            self.proof_of_possession.as_ref().map_or(0, |_| 1) +
236            self.unverified_user_annotations.as_ref().map_or(0, |_| 1),
237        )?;
238        if let Some(value) = &self.max_expiration_seconds {
239            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maxExpirationSeconds", value)?;
240        }
241        crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeName", &self.node_name)?;
242        crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeUID", &self.node_uid)?;
243        if let Some(value) = &self.pkix_public_key {
244            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "pkixPublicKey", value)?;
245        }
246        crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podName", &self.pod_name)?;
247        crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podUID", &self.pod_uid)?;
248        if let Some(value) = &self.proof_of_possession {
249            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "proofOfPossession", value)?;
250        }
251        crate::serde::ser::SerializeStruct::serialize_field(&mut state, "serviceAccountName", &self.service_account_name)?;
252        crate::serde::ser::SerializeStruct::serialize_field(&mut state, "serviceAccountUID", &self.service_account_uid)?;
253        crate::serde::ser::SerializeStruct::serialize_field(&mut state, "signerName", &self.signer_name)?;
254        crate::serde::ser::SerializeStruct::serialize_field(&mut state, "stubPKCS10Request", &self.stub_pkc_s10_request)?;
255        if let Some(value) = &self.unverified_user_annotations {
256            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "unverifiedUserAnnotations", value)?;
257        }
258        crate::serde::ser::SerializeStruct::end(state)
259    }
260}
261
262#[cfg(feature = "schemars")]
263impl crate::schemars::JsonSchema for PodCertificateRequestSpec {
264    fn schema_name() -> std::borrow::Cow<'static, str> {
265        "io.k8s.api.certificates.v1beta1.PodCertificateRequestSpec".into()
266    }
267
268    fn json_schema(__gen: &mut crate::schemars::SchemaGenerator) -> crate::schemars::Schema {
269        crate::schemars::json_schema!({
270            "description": "PodCertificateRequestSpec describes the certificate request.  All fields are immutable after creation.",
271            "type": "object",
272            "properties": {
273                "maxExpirationSeconds": {
274                    "description": "maxExpirationSeconds is the maximum lifetime permitted for the certificate.\n\nIf omitted, kube-apiserver will set it to 86400(24 hours). kube-apiserver will reject values shorter than 3600 (1 hour).  The maximum allowable value is 7862400 (91 days).\n\nThe signer implementation is then free to issue a certificate with any lifetime *shorter* than MaxExpirationSeconds, but no shorter than 3600 seconds (1 hour).  This constraint is enforced by kube-apiserver. `kubernetes.io` signers will never issue certificates with a lifetime longer than 24 hours.",
275                    "type": "integer",
276                    "format": "int32",
277                },
278                "nodeName": {
279                    "description": "nodeName is the name of the node the pod is assigned to.",
280                    "type": "string",
281                },
282                "nodeUID": {
283                    "description": "nodeUID is the UID of the node the pod is assigned to.",
284                    "type": "string",
285                },
286                "pkixPublicKey": {
287                    "description": "The PKIX-serialized public key the signer will issue the certificate to.\n\nThe key must be one of RSA3072, RSA4096, ECDSAP256, ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in the future.\n\nSigner implementations do not need to support all key types supported by kube-apiserver and kubelet.  If a signer does not support the key type used for a given PodCertificateRequest, it must deny the request by setting a status.conditions entry with a type of \"Denied\" and a reason of \"UnsupportedKeyType\". It may also suggest a key type that it does support in the message field.\n\nDeprecated: This field is replaced by StubPKCS10Request. If StubPKCS10Request is set, this field must be empty.  Signer implementations should extract the public key from the StubPKCS10Request field.",
288                    "type": "string",
289                    "format": "byte",
290                },
291                "podName": {
292                    "description": "podName is the name of the pod into which the certificate will be mounted.",
293                    "type": "string",
294                },
295                "podUID": {
296                    "description": "podUID is the UID of the pod into which the certificate will be mounted.",
297                    "type": "string",
298                },
299                "proofOfPossession": {
300                    "description": "A proof that the requesting kubelet holds the private key corresponding to pkixPublicKey.\n\nIt is contructed by signing the ASCII bytes of the pod's UID using `pkixPublicKey`.\n\nkube-apiserver validates the proof of possession during creation of the PodCertificateRequest.\n\nIf the key is an RSA key, then the signature is over the ASCII bytes of the pod UID, using RSASSA-PSS from RFC 8017 (as implemented by the golang function crypto/rsa.SignPSS with nil options).\n\nIf the key is an ECDSA key, then the signature is as described by [SEC 1, Version 2.0](https://www.secg.org/sec1-v2.pdf) (as implemented by the golang library function crypto/ecdsa.SignASN1)\n\nIf the key is an ED25519 key, the the signature is as described by the [ED25519 Specification](https://ed25519.cr.yp.to/) (as implemented by the golang library crypto/ed25519.Sign).\n\nDeprecated: This field is replaced by StubPKCS10Request. If StubPKCS10Request is set, this field must be empty.",
301                    "type": "string",
302                    "format": "byte",
303                },
304                "serviceAccountName": {
305                    "description": "serviceAccountName is the name of the service account the pod is running as.",
306                    "type": "string",
307                },
308                "serviceAccountUID": {
309                    "description": "serviceAccountUID is the UID of the service account the pod is running as.",
310                    "type": "string",
311                },
312                "signerName": {
313                    "description": "signerName indicates the requested signer.\n\nAll signer names beginning with `kubernetes.io` are reserved for use by the Kubernetes project.  There is currently one well-known signer documented by the Kubernetes project, `kubernetes.io/kube-apiserver-client-pod`, which will issue client certificates understood by kube-apiserver.  It is currently unimplemented.",
314                    "type": "string",
315                },
316                "stubPKCS10Request": {
317                    "description": "A PKCS#10 certificate signing request (DER-serialized) generated by Kubelet using the subject private key.\n\nMost signer implementations will ignore the contents of the CSR except to extract the subject public key. The API server automatically verifies the CSR signature during admission, so the signer does not need to repeat the verification.  CSRs generated by kubelet are completely empty.\n\nThe subject public key must be one of RSA3072, RSA4096, ECDSAP256, ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in the future.\n\nSigner implementations do not need to support all key types supported by kube-apiserver and kubelet.  If a signer does not support the key type used for a given PodCertificateRequest, it must deny the request by setting a status.conditions entry with a type of \"Denied\" and a reason of \"UnsupportedKeyType\". It may also suggest a key type that it does support in the message field.",
318                    "type": "string",
319                    "format": "byte",
320                },
321                "unverifiedUserAnnotations": {
322                    "description": "unverifiedUserAnnotations allow pod authors to pass additional information to the signer implementation.  Kubernetes does not restrict or validate this metadata in any way.\n\nEntries are subject to the same validation as object metadata annotations, with the addition that all keys must be domain-prefixed. No restrictions are placed on values, except an overall size limitation on the entire field.\n\nSigners should document the keys and values they support.  Signers should deny requests that contain keys they do not recognize.",
323                    "type": "object",
324                    "additionalProperties": {
325                        "type": "string",
326                    },
327                },
328            },
329            "required": [
330                "nodeName",
331                "nodeUID",
332                "podName",
333                "podUID",
334                "serviceAccountName",
335                "serviceAccountUID",
336                "signerName",
337                "stubPKCS10Request",
338            ],
339        })
340    }
341}