expose worker and apps using service type ClusterIP

Signed-off-by: Pascal Sthamer <10992664+P4sca1@users.noreply.github.com>
This commit is contained in:
Pascal Sthamer
2025-04-15 09:26:57 +02:00
parent 319c939c1f
commit 2738766411
2 changed files with 26 additions and 28 deletions
+21 -21
View File
@@ -489,13 +489,16 @@ func deployk8sApp(image string, identifier string, env []string) error {
name := strings.ReplaceAll(identifier, "_", "-")
labels := map[string]string{
"app.kubernetes.io/name": "shuffle-app",
"app.kubernetes.io/instance": name,
// "app.kubernetes.io/version": "",
// Well-known Kubernetes labels
"app.kubernetes.io/name": "shuffle-app",
"app.kubernetes.io/instance": name,
"app.kubernetes.io/part-of": "shuffle",
"app.kubernetes.io/managed-by": "shuffle-worker",
// Keep legacy labels for backward compatibility
"app": name,
// TODO: Add Shuffle specific labels
// "app.shuffler.io/name": "APP_NAME",
// "app.shuffler.io/version": "APP_VERSION",
}
matchLabels := map[string]string{
@@ -614,7 +617,6 @@ func deployk8sApp(image string, identifier string, env []string) error {
return err
}
// kubectl expose deployment {podName} --type=NodePort --port=80 --target-port=80
service := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: name,
@@ -629,7 +631,7 @@ func deployk8sApp(image string, identifier string, env []string) error {
TargetPort: intstr.FromInt(80),
},
},
Type: corev1.ServiceTypeNodePort,
Type: corev1.ServiceTypeClusterIP,
},
}
@@ -917,7 +919,7 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
// Add more volume binds if possible
if len(volumeBinds) > 0 {
// Only use mounts, not direct binds
// Only use mounts, not direct binds
hostConfig.Binds = []string{}
hostConfig.Mounts = []mount.Mount{}
for _, bind := range volumeBinds {
@@ -931,7 +933,7 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
sourceFolder := bindSplit[0]
destinationFolder := bindSplit[1]
readOnly := false
readOnly := false
if len(bindSplit) > 2 {
mode := bindSplit[2]
if mode == "ro" {
@@ -940,9 +942,9 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
}
builtMount := mount.Mount{
Type: mount.TypeBind,
Source: sourceFolder,
Target: destinationFolder,
Type: mount.TypeBind,
Source: sourceFolder,
Target: destinationFolder,
ReadOnly: readOnly,
}
@@ -1853,18 +1855,18 @@ func executionInit(workflowExecution shuffle.WorkflowExecution) error {
}
}
// Validates RERUN of single actions
// Identified by:
// Validates RERUN of single actions
// Identified by:
// 1. Predefined result from previous exec
// 2. Only ONE action
// 3. Every predefined result having result.Action.Category == "rerun"
/*
if len(workflowExecution.Workflow.Actions) == 1 && len(workflowExecution.Results) > 0 {
finished := shuffle.ValidateFinished(ctx, extra, workflowExecution)
if finished {
return nil
if len(workflowExecution.Workflow.Actions) == 1 && len(workflowExecution.Results) > 0 {
finished := shuffle.ValidateFinished(ctx, extra, workflowExecution)
if finished {
return nil
}
}
}
*/
nextActions = append(nextActions, startAction)
@@ -1954,7 +1956,6 @@ func executionInit(workflowExecution shuffle.WorkflowExecution) error {
//log.Printf("Successfully downloaded and built %s", image)
}
visited := []string{}
executed := []string{}
environments := []string{}
@@ -3777,7 +3778,7 @@ func checkStandaloneRun() {
if !strings.Contains(backendUrl, "http") {
log.Printf("[ERROR] Backend URL should start with http:// or https://")
return
}
// Format:
@@ -3851,7 +3852,7 @@ func checkStandaloneRun() {
continue
}
// This is to handle reruns of SINGLE actions
// This is to handle reruns of SINGLE actions
if result.Action.Category == "rerun" {
newResults = append(newResults, result)
continue
@@ -3905,7 +3906,6 @@ func checkStandaloneRun() {
log.Printf("\n\n\n[DEBUG] Finished resetting execution %s. Body: %s. Starting execution.\n\n\n", newresp.Status, string(body))
}
// Initial loop etc