feat(k8s): specify app protocol for worker and app services

Signed-off-by: Pascal Sthamer <10992664+P4sca1@users.noreply.github.com>
This commit is contained in:
Pascal Sthamer
2025-10-15 10:43:45 +02:00
parent 39c7b1e7d0
commit 68efb7111a
2 changed files with 27 additions and 31 deletions
+2
View File
@@ -1395,6 +1395,7 @@ func deployK8sWorker(image string, identifier string, env []string) error {
return err
}
svcAppProtocol := "http"
service := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: identifier,
@@ -1405,6 +1406,7 @@ func deployK8sWorker(image string, identifier string, env []string) error {
Ports: []corev1.ServicePort{
{
Protocol: "TCP",
AppProtocol: &svcAppProtocol,
Port: 33333,
TargetPort: intstr.FromInt(33333),
},
+3 -9
View File
@@ -2,7 +2,7 @@ package main
import (
"github.com/shuffle/shuffle-shared"
"github.com/shuffle/singul/pkg"
singul "github.com/shuffle/singul/pkg"
"bytes"
"context"
@@ -678,6 +678,7 @@ func deployk8sApp(image string, identifier string, env []string) error {
return err
}
svcAppProtocol := "http"
service := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: name,
@@ -688,6 +689,7 @@ func deployk8sApp(image string, identifier string, env []string) error {
Ports: []corev1.ServicePort{
{
Protocol: "TCP",
AppProtocol: &svcAppProtocol,
Port: 80,
TargetPort: intstr.FromInt(deployport),
},
@@ -3233,8 +3235,6 @@ func deploySwarmService(dockercli *dockerclient.Client, name, image string, depl
log.Printf("[DEBUG] Deploying service for %s to swarm on port %d", name, deployport)
//containerName := fmt.Sprintf("shuffle-worker-%s", parsedUuid)
// Check if the image exists or not - just in case
_, _, err := dockercli.ImageInspectWithRaw(context.Background(), image)
if err != nil {
@@ -3257,7 +3257,6 @@ func deploySwarmService(dockercli *dockerclient.Client, name, image string, depl
}
}
if len(baseimagename) == 0 || baseimagename == "/" {
baseimagename = "frikky/shuffle"
//var baseimagename = "frikky/shuffle"
@@ -3310,7 +3309,6 @@ func deploySwarmService(dockercli *dockerclient.Client, name, image string, depl
nodeCount = 1
}
replicatedJobs := uint64(replicas * nodeCount)
log.Printf("[DEBUG] Deploying app with name %s with image %s", name, image)
@@ -3472,7 +3470,6 @@ func findAppInfo(image, name string, redeploy bool) (int, error) {
// chance of being successful
time.Sleep(time.Duration(rand.Intn(1500)) * time.Millisecond)
highest := baseport
exposedPort := -1
@@ -3695,7 +3692,6 @@ func initSwarmNetwork() error {
mtu := 1500
options["com.docker.network.driver.mtu"] = fmt.Sprintf("%d", mtu)
ingressOptions := network.CreateOptions{
Driver: "overlay",
Attachable: false,
@@ -3782,8 +3778,6 @@ func initSwarmNetwork() error {
return nil
}
/*** ENDREMOVE ***/
func sendAppRequest(ctx context.Context, incomingUrl, appName string, port int, action *shuffle.Action, workflowExecution *shuffle.WorkflowExecution, image string, attempts int64) error {