aicam commented on code in PR #5629:
URL: https://github.com/apache/texera/pull/5629#discussion_r3408557264
##########
access-control-service/src/main/scala/org/apache/texera/service/resource/AccessControlResource.scala:
##########
@@ -136,12 +138,27 @@ object AccessControlResource extends LazyLogging {
}
// Dynamic Routing Logic
- val workflowComputingUnitPoolName = KubernetesConfig.computeUnitPoolName
- val workflowComputingUnitPoolNamespace =
KubernetesConfig.computeUnitPoolNamespace
- val workflowComputingUnitPoolPort = KubernetesConfig.computeUnitPortNumber
-
- val targetHost =
-
s"computing-unit-$cuidInt.$workflowComputingUnitPoolName-svc.$workflowComputingUnitPoolNamespace.svc.cluster.local:$workflowComputingUnitPoolPort"
+ // Use the URI persisted for the computing unit (written by the managing
+ // service when the pod is created) as the routing target, so the address
is
+ // resolved from a single source of truth instead of being reconstructed
+ // here. Fall back to the conventional in-cluster address if no URI has
been
+ // recorded for the unit yet.
+ val cuDao = new WorkflowComputingUnitDao(
+ SqlServer.getInstance().createDSLContext().configuration()
+ )
+ val unit = cuDao.fetchOneByCuid(cuidInt)
+ val recordedUri = Option(unit).flatMap(u =>
Option(u.getUri)).map(_.trim).filter(_.nonEmpty)
+
+ val targetHost = recordedUri match {
+ case Some(uri) =>
+ logger.info(s"Routing CU $cuidInt to recorded host: $uri")
+ uri
+ case None =>
+ val workflowComputingUnitPoolName =
KubernetesConfig.computeUnitPoolName
+ val workflowComputingUnitPoolNamespace =
KubernetesConfig.computeUnitPoolNamespace
+ val workflowComputingUnitPoolPort =
KubernetesConfig.computeUnitPortNumber
+
s"computing-unit-$cuidInt.$workflowComputingUnitPoolName-svc.$workflowComputingUnitPoolNamespace.svc.cluster.local:$workflowComputingUnitPoolPort"
Review Comment:
Done in 97ea514 — removed the fallback. When no URI is recorded for the
computing unit the request is now refused with `403 FORBIDDEN` (logged as
`Refusing CU <cuid>: no URI recorded`) instead of reconstructing an in-cluster
address. Also dropped the now-unused `KubernetesConfig` import.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]