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
+4 -6
View File
@@ -1067,9 +1067,9 @@ func deployK8sWorker(image string, identifier string, env []string) error {
} }
labels := map[string]string{ labels := map[string]string{
"app.kubernetes.io/name": "shuffle-worker", // Well-known Kubernetes labels
"app.kubernetes.io/instance": identifier, "app.kubernetes.io/name": "shuffle-worker",
// "app.kubernetes.io/version": "", "app.kubernetes.io/instance": identifier,
"app.kubernetes.io/part-of": "shuffle", "app.kubernetes.io/part-of": "shuffle",
"app.kubernetes.io/managed-by": "shuffle-orborus", "app.kubernetes.io/managed-by": "shuffle-orborus",
// Keep legacy labels for backward compatibility // Keep legacy labels for backward compatibility
@@ -1212,7 +1212,6 @@ func deployK8sWorker(image string, identifier string, env []string) error {
return err return err
} }
// kubectl expose deployment shuffle-workers --type=NodePort --port=33333 --target-port=33333
service := &corev1.Service{ service := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: identifier, Name: identifier,
@@ -1227,7 +1226,7 @@ func deployK8sWorker(image string, identifier string, env []string) error {
TargetPort: intstr.FromInt(33333), TargetPort: intstr.FromInt(33333),
}, },
}, },
Type: corev1.ServiceTypeNodePort, Type: corev1.ServiceTypeClusterIP,
}, },
} }
@@ -1271,7 +1270,6 @@ func deployWorker(image string, identifier string, env []string, executionReques
Resources: container.Resources{}, Resources: container.Resources{},
} }
// This is just to test the mounting locally so // This is just to test the mounting locally so
// I can control from what source I'm mounting // I can control from what source I'm mounting
// the certs to. Default behaviour is: // the certs to. Default behaviour is:
+15 -15
View File
@@ -489,13 +489,16 @@ func deployk8sApp(image string, identifier string, env []string) error {
name := strings.ReplaceAll(identifier, "_", "-") name := strings.ReplaceAll(identifier, "_", "-")
labels := map[string]string{ labels := map[string]string{
"app.kubernetes.io/name": "shuffle-app", // Well-known Kubernetes labels
"app.kubernetes.io/instance": name, "app.kubernetes.io/name": "shuffle-app",
// "app.kubernetes.io/version": "", "app.kubernetes.io/instance": name,
"app.kubernetes.io/part-of": "shuffle", "app.kubernetes.io/part-of": "shuffle",
"app.kubernetes.io/managed-by": "shuffle-worker", "app.kubernetes.io/managed-by": "shuffle-worker",
// Keep legacy labels for backward compatibility // Keep legacy labels for backward compatibility
"app": name, "app": name,
// TODO: Add Shuffle specific labels
// "app.shuffler.io/name": "APP_NAME",
// "app.shuffler.io/version": "APP_VERSION",
} }
matchLabels := map[string]string{ matchLabels := map[string]string{
@@ -614,7 +617,6 @@ func deployk8sApp(image string, identifier string, env []string) error {
return err return err
} }
// kubectl expose deployment {podName} --type=NodePort --port=80 --target-port=80
service := &corev1.Service{ service := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: name, Name: name,
@@ -629,7 +631,7 @@ func deployk8sApp(image string, identifier string, env []string) error {
TargetPort: intstr.FromInt(80), TargetPort: intstr.FromInt(80),
}, },
}, },
Type: corev1.ServiceTypeNodePort, Type: corev1.ServiceTypeClusterIP,
}, },
} }
@@ -940,9 +942,9 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
} }
builtMount := mount.Mount{ builtMount := mount.Mount{
Type: mount.TypeBind, Type: mount.TypeBind,
Source: sourceFolder, Source: sourceFolder,
Target: destinationFolder, Target: destinationFolder,
ReadOnly: readOnly, ReadOnly: readOnly,
} }
@@ -1859,12 +1861,12 @@ func executionInit(workflowExecution shuffle.WorkflowExecution) error {
// 2. Only ONE action // 2. Only ONE action
// 3. Every predefined result having result.Action.Category == "rerun" // 3. Every predefined result having result.Action.Category == "rerun"
/* /*
if len(workflowExecution.Workflow.Actions) == 1 && len(workflowExecution.Results) > 0 { if len(workflowExecution.Workflow.Actions) == 1 && len(workflowExecution.Results) > 0 {
finished := shuffle.ValidateFinished(ctx, extra, workflowExecution) finished := shuffle.ValidateFinished(ctx, extra, workflowExecution)
if finished { if finished {
return nil return nil
}
} }
}
*/ */
nextActions = append(nextActions, startAction) nextActions = append(nextActions, startAction)
@@ -1954,7 +1956,6 @@ func executionInit(workflowExecution shuffle.WorkflowExecution) error {
//log.Printf("Successfully downloaded and built %s", image) //log.Printf("Successfully downloaded and built %s", image)
} }
visited := []string{} visited := []string{}
executed := []string{} executed := []string{}
environments := []string{} environments := []string{}
@@ -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)) log.Printf("\n\n\n[DEBUG] Finished resetting execution %s. Body: %s. Starting execution.\n\n\n", newresp.Status, string(body))
} }
// Initial loop etc // Initial loop etc