expose worker and apps using service type ClusterIP
Signed-off-by: Pascal Sthamer <10992664+P4sca1@users.noreply.github.com>
This commit is contained in:
@@ -747,7 +747,7 @@ func handleBackendImageDownload(ctx context.Context, images string) error {
|
|||||||
//log.Printf("[DEBUG] Removing existing image (s): %s", images)
|
//log.Printf("[DEBUG] Removing existing image (s): %s", images)
|
||||||
newImages := []string{}
|
newImages := []string{}
|
||||||
|
|
||||||
successful := []string{}
|
successful := []string{}
|
||||||
for _, curimage := range strings.Split(images, ",") {
|
for _, curimage := range strings.Split(images, ",") {
|
||||||
curimage = strings.TrimSpace(curimage)
|
curimage = strings.TrimSpace(curimage)
|
||||||
if shuffle.ArrayContains(handled, curimage) {
|
if shuffle.ArrayContains(handled, curimage) {
|
||||||
@@ -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:
|
||||||
|
|||||||
@@ -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,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -917,7 +919,7 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
|
|||||||
// Add more volume binds if possible
|
// Add more volume binds if possible
|
||||||
if len(volumeBinds) > 0 {
|
if len(volumeBinds) > 0 {
|
||||||
|
|
||||||
// Only use mounts, not direct binds
|
// Only use mounts, not direct binds
|
||||||
hostConfig.Binds = []string{}
|
hostConfig.Binds = []string{}
|
||||||
hostConfig.Mounts = []mount.Mount{}
|
hostConfig.Mounts = []mount.Mount{}
|
||||||
for _, bind := range volumeBinds {
|
for _, bind := range volumeBinds {
|
||||||
@@ -931,7 +933,7 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
|
|||||||
sourceFolder := bindSplit[0]
|
sourceFolder := bindSplit[0]
|
||||||
destinationFolder := bindSplit[1]
|
destinationFolder := bindSplit[1]
|
||||||
|
|
||||||
readOnly := false
|
readOnly := false
|
||||||
if len(bindSplit) > 2 {
|
if len(bindSplit) > 2 {
|
||||||
mode := bindSplit[2]
|
mode := bindSplit[2]
|
||||||
if mode == "ro" {
|
if mode == "ro" {
|
||||||
@@ -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,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1853,18 +1855,18 @@ func executionInit(workflowExecution shuffle.WorkflowExecution) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validates RERUN of single actions
|
// Validates RERUN of single actions
|
||||||
// Identified by:
|
// Identified by:
|
||||||
// 1. Predefined result from previous exec
|
// 1. Predefined result from previous exec
|
||||||
// 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{}
|
||||||
@@ -3777,7 +3778,7 @@ func checkStandaloneRun() {
|
|||||||
if !strings.Contains(backendUrl, "http") {
|
if !strings.Contains(backendUrl, "http") {
|
||||||
log.Printf("[ERROR] Backend URL should start with http:// or https://")
|
log.Printf("[ERROR] Backend URL should start with http:// or https://")
|
||||||
return
|
return
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format:
|
// Format:
|
||||||
@@ -3851,7 +3852,7 @@ func checkStandaloneRun() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is to handle reruns of SINGLE actions
|
// This is to handle reruns of SINGLE actions
|
||||||
if result.Action.Category == "rerun" {
|
if result.Action.Category == "rerun" {
|
||||||
newResults = append(newResults, result)
|
newResults = append(newResults, result)
|
||||||
continue
|
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))
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user