You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: crd.rs
    path of file: ./repos/PERSIA/k8s/src
    
    the code of the file until where you have to start completion: use k8s_openapi::api::core::v1::{
    Container, EnvVar, Pod, PodSpec, ResourceRequirements, Service, ServicePort, ServiceSpec,
    Volume, VolumeMount,
};
use kube::api::ObjectMeta;
use kube::CustomResource;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;

pub const DEFAULT_CUDA_IMAGE: &str = "persiaml/persia-cuda-runtime:latest";
pub const DEFAULT_CPU_IMAGE: &str = "persiaml/persia-cpu-runtime:latest";

pub fn get_embedding_ps_pod_name(job_name: &str, replica_index: usize) -> String {
    format!("{}-embedding-ps-{}", job_name, replica_index)
}

pub fn get_embedding_worker_pod_name(job_name: &str, replica_index: usize) -> String {
    format!("{}-embedding-worker-{}", job_name, replica_index)
}

pub fn get_nn_worker_pod_name(job_name: &str, replica_index: usize) -> String {
    format!("{}-nn-worker-{}", job_name, replica_index)
}

pub fn get_dataloader_pod_name(job_name: &str, replica_index: usize) -> String {
    format!("{}-dataloader-{}", job_name, replica_index)
}

pub fn get_metrics_gateway_pod_name(job_name: &str) -> String {
    format!("{}-metrics-gateway", job_name)
}

pub fn get_metrics_gateway_service_name(job_name: &str) -> String {
    format!("{}-metrics-gateway-service", job_name)
}

pub fn get_label_selector(job_name: &str) -> String {
    format!("persia_job={}", job_name)
}

#[derive(CustomResource, Serialize, Deserialize, Debug, PartialEq, Clone, JsonSchema)]
#[kube(
    group = "persia.com",
    version = "v1",
    kind = "PersiaJob",
    plural = "persiajobs",
    derive = "PartialEq",
    name
    
    fn gen_pod_template(&self, job_name: &str, namespace: &str) -> Pod {
        let log_level = self.logLevel.clone().unwrap_or(String::from("info"));
        let restart_policy = self.restartPolicy.clone().unwrap_or(String::from("Never"));
        let image_pull_policy = self
            .imagePullPolicy
            .clone()
            .unwrap_or(String::from("Always"));

        let mut labels: BTreeMap<String, String> = BTreeMap::new();
        labels.insert("persia_job".to_owned(), job_name.to_owned());

        let mut env = vec![
            EnvVar {
                name: String::from("PERSIA_EMBEDDING_CONFIG"),
                value: Some(self.persiaEnv.PERSIA_EMBEDDING_CONFIG.clone()),
                ..EnvVar::default()
            },
            EnvVar {
                name: String::from("PERSIA_GLOBAL_CONFIG"),
                value: Some(self.persiaEnv.PERSIA_GLOBAL_CONFIG.clone()),
                ..EnvVar::default()
            },
            EnvVar {
                name: String::from("LOG_LEVEL"),
                value: Some(log_level),
                ..EnvVar::default()
            },
            EnvVar {
                name: String::from("RUST_BACKTRACE"),
                value: Some(String::from("full")),
                ..EnvVar::default()
            },
            EnvVar {
                name: String::from("PERSIA_METRICS_GATEWAY_ADDR"),
                value: Some(format!(
                    "{}:9091",
                    get_metrics_gateway_service_name(job_name)
                )),
                ..EnvVar::default()
            },
        ];

        if let Some(e) = &self.env {
            e.iter().for_each(|env_var| {
                env.push(env_var.clone());
            });
        }

        let pod_spec = PodSpec {
            containers: vec![Container {
                command: Some(vec!["persia-launcher".to_string()]),
                env: Some(env),
                image_pull_policy: Some(image_pull_policy),
                ..Container::default()
            }],
            volumes: self.volumes.clone(),
            restart_policy: Some(restart_policy),
            ..PodSpec::default()
        };

        Pod {
            metadata: ObjectMeta {
                namespace: Some(namespace.to_owned()),
                labels: Some(labels.clone()),
                ..ObjectMeta::default()
            },
            spec: Some(pod_spec),
            ..Pod::default()
        }
    }