Skip to content

Commit

Permalink
fix: last testing
Browse files Browse the repository at this point in the history
  • Loading branch information
at88mph committed Feb 11, 2025
1 parent 69939f0 commit 93f8dc2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public class PostAction extends SessionAction {
public static final String SKAHA_SESSIONTYPE = "skaha.sessiontype";
public static final String SKAHA_SESSIONEXPIRY = "skaha.sessionexpiry";
public static final String SKAHA_JOBNAME = "skaha.jobname";
public static final String SKAHA_JOBUID = "skaha.jobuid";
public static final String SOFTWARE_JOBNAME = "software.jobname";
public static final String SOFTWARE_HOSTNAME = "software.hostname";
public static final String SOFTWARE_APPID = "software.appid";
Expand Down Expand Up @@ -618,15 +619,17 @@ public void createSession(
log.debug("Create service result: " + createResult);
}

// Ingress construction is still done using plain String interpolation for now. When the Kubernetes Gateway
// API is in place, we can swap this out with a proper Java client API.
if (type.supportsIngress()) {
final Job job = CommandExecutioner.getJob(jobName);
byte[] ingressBytes = Files.readAllBytes(type.getIngressConfigPath());
String ingressString = new String(ingressBytes, StandardCharsets.UTF_8);
ingressString = SessionJobBuilder.setConfigValue(ingressString, PostAction.SKAHA_SESSIONID, sessionID);
ingressString = SessionJobBuilder.setConfigValue(ingressString, PostAction.SKAHA_JOBNAME, job.getName());
ingressString = SessionJobBuilder.setConfigValue(ingressString, "skaha.jobuid", job.getUID());
ingressString = SessionJobBuilder.setConfigValue(ingressString, PostAction.SKAHA_SESSIONID, this.sessionID);
ingressString = SessionJobBuilder.setConfigValue(
ingressString, PostAction.SKAHA_SESSIONS_HOSTNAME, K8SUtil.getSessionsHostName());
ingressString = SessionJobBuilder.setConfigValue(ingressString, PostAction.SKAHA_JOBUID, job.getUID());
ingressString = SessionJobBuilder.setConfigValue(ingressString, PostAction.SKAHA_JOBNAME, job.getName());
jsonLaunchFile = super.stageFile(ingressString);
final KubectlCommandBuilder.KubectlCommand ingressLaunchCommand = KubectlCommandBuilder.command("create")
.namespace(k8sNamespace)
Expand Down
13 changes: 8 additions & 5 deletions skaha/src/test/resources/test-carta-service.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Service YAML for a Netbook interactive session. This will be loaded by Skaha and modified to include the session ID and job name.
# Sample Service YAML for a CARTA interactive session. This will be loaded by Skaha and modified to include the session ID and job name.
---
apiVersion: v1
kind: Service
metadata:
name: skaha-notebook-svc-${skaha.sessionid}
name: skaha-carta-svc-${skaha.sessionid}
labels:
run: skaha-notebook-svc-${skaha.sessionid}
run: skaha-carta-svc-${skaha.sessionid}
ownerReferences:
- apiVersion: batch/v1
blockOwnerDeletion: true
Expand All @@ -15,8 +15,11 @@ metadata:
uid: "${skaha.jobuid}"
spec:
ports:
- port: 8888
- port: 6901
protocol: TCP
name: notebook-port
name: http-connection
- port: 5901
protocol: TCP
name: socket-connection
selector:
canfar-net-sessionID: ${skaha.sessionid}

0 comments on commit 93f8dc2

Please sign in to comment.