k8s_cluster_api/v1beta1/bootstrap/kubeadm/kubeadmconfig/template/
impls.rs

1use maplit::{btreemap, convert_args};
2
3use super::*;
4
5impl KubeadmConfigTemplate {
6    pub fn aws(name: &str) -> Self {
7        let spec = KubeadmConfigTemplateSpec {
8            template: KubeadmConfigTemplateResource {
9                spec: KubeadmConfigSpec {
10                    join_configuration: Some(JoinConfiguration {
11                        node_registration: Some(NodeRegistrationOptions {
12                            kubelet_extra_args: convert_args!(btreemap!("cloud-provider" => "aws")),
13                            name: Some("{{ ds.meta_data.local_hostname }}".to_string()),
14                            ..Default::default()
15                        }),
16                        ..Default::default()
17                    }),
18                    ..Default::default()
19                },
20            },
21        };
22        Self::new(name, spec)
23    }
24
25    #[must_use]
26    pub fn namespace(self, namespace: &str) -> Self {
27        Self {
28            metadata: kube::core::ObjectMeta {
29                namespace: Some(namespace.to_string()),
30                ..self.metadata
31            },
32            ..self
33        }
34    }
35}