Merge pull request #1691 from P4sca1/k8s-service-type-clusterip

fix(k8s): expose worker and apps using ClusterIP service instead of NodePort
This commit is contained in:
Frikky
2025-05-18 23:33:12 +02:00
committed by GitHub
2 changed files with 11 additions and 9 deletions
+4 -5
View File
@@ -1083,9 +1083,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
@@ -1252,7 +1252,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,
@@ -1267,7 +1266,7 @@ func deployK8sWorker(image string, identifier string, env []string) error {
TargetPort: intstr.FromInt(33333), TargetPort: intstr.FromInt(33333),
}, },
}, },
Type: corev1.ServiceTypeNodePort, Type: corev1.ServiceTypeClusterIP,
}, },
} }
+7 -4
View File
@@ -497,13 +497,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{
@@ -666,7 +669,7 @@ func deployk8sApp(image string, identifier string, env []string) error {
TargetPort: intstr.FromInt(deployport), TargetPort: intstr.FromInt(deployport),
}, },
}, },
Type: corev1.ServiceTypeNodePort, Type: corev1.ServiceTypeClusterIP,
}, },
} }