Skip to content

Commit

Permalink
osrdyne: add labels and annotation to kubernetes driver
Browse files Browse the repository at this point in the history
Signed-off-by: ElysaSrc <101974839+ElysaSrc@users.noreply.github.com>
  • Loading branch information
ElysaSrc committed Oct 1, 2024
1 parent fa0ab35 commit d341a83
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion osrdyne/src/drivers/kubernetes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ pub struct KubernetesDeploymentOptions {

/// The tolerations to use for the worker (passthrough to kubernetes deployment)
pub tolerations: Option<Vec<Toleration>>,

/// The labels to add to the worker (passthrough to kubernetes deployment)
pub labels: Option<BTreeMap<String, String>>,

/// The annotations to add to the worker (passthrough to kubernetes deployment)
pub annotations: Option<BTreeMap<String, String>>,
}

#[derive(Serialize, Deserialize, Clone, Debug)]
Expand Down Expand Up @@ -164,7 +170,16 @@ impl WorkerDriver for KubernetesDriver {
replicas: Some(1),
template: PodTemplateSpec {
metadata: Some(ObjectMeta {
labels: Some(labels.clone()),
labels: {
let mut labels = labels.clone();
if let Some(deployment_labels) =
&self.options.kube_deployment_options.labels
{
labels.extend(deployment_labels.clone());
}
Some(labels)
},
annotations: self.options.kube_deployment_options.annotations.clone(),
..Default::default()
}),
spec: Some(PodSpec {
Expand Down

0 comments on commit d341a83

Please sign in to comment.