Skip to content

Commit

Permalink
Avoid ambiguous service selector when multiple mysql apps in a model …
Browse files Browse the repository at this point in the history
…have the same cluster-name
  • Loading branch information
shayancanonical committed Sep 6, 2024
1 parent ed0deb4 commit d6856fe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/k8s_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ def create_endpoint_services(self, roles: List[str]) -> None:
roles: List of roles to append on the service name
"""
for role in roles:
selector = {"cluster-name": self.cluster_name, "role": role}
selector = {
"cluster-name": self.cluster_name,
"application_name": self.app_name,
"role": role,
}
service_name = f"{self.app_name}-{role}"
pod0 = self.client.get(
res=Pod,
Expand Down Expand Up @@ -128,6 +132,7 @@ def label_pod(self, role: str, pod_name: Optional[str] = None) -> None:
logger.debug(f"Patching {pod_name=} with {role=}")

pod.metadata.labels["cluster-name"] = self.cluster_name
pod.metadata.labels["application-name"] = self.app_name
pod.metadata.labels["role"] = role
self.client.patch(Pod, pod_name, pod)
except ApiError as e:
Expand Down

0 comments on commit d6856fe

Please sign in to comment.