Skip to content

Commit

Permalink
feat: add activation-id label for kubernetes resources
Browse files Browse the repository at this point in the history
  • Loading branch information
kurokobo committed Feb 1, 2024
1 parent 717524b commit 24d17be
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/aap_eda/services/activation/engine/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def __init__(
self.client = get_k8s_client()

self._set_namespace()
self.activation_id = activation_id
self.secret_name = f"activation-secret-{activation_id}"
self.job_name = None
self.pod_name = None
Expand Down Expand Up @@ -337,7 +338,11 @@ def _create_pod_template_spec(
spec=spec,
metadata=k8sclient.V1ObjectMeta(
name=self.pod_name,
labels={"app": "eda", "job-name": self.job_name},
labels={
"app": "eda",
"job-name": self.job_name,
"activation-id": str(self.activation_id),
},
),
)

Expand Down Expand Up @@ -366,7 +371,11 @@ def _create_service(self, port: int) -> None:
),
metadata=k8sclient.V1ObjectMeta(
name=f"{service_name}",
labels={"app": "eda", "job-name": self.job_name},
labels={
"app": "eda",
"job-name": self.job_name,
"activation-id": str(self.activation_id),
},
namespace=self.namespace,
),
)
Expand Down Expand Up @@ -413,8 +422,9 @@ def _create_job(
metadata = k8sclient.V1ObjectMeta(
name=self.job_name,
labels={
"job-name": self.job_name,
"app": "eda",
"job-name": self.job_name,
"activation-id": str(self.activation_id),
},
)

Expand Down Expand Up @@ -552,7 +562,10 @@ def _create_secret(
metadata={
"name": self.secret_name,
"namespace": self.namespace,
"labels": {"aap": "eda"},
"labels": {
"aap": "eda",
"activation-id": str(self.activation_id),
},
},
type="kubernetes.io/dockerconfigjson",
)
Expand Down

0 comments on commit 24d17be

Please sign in to comment.