fix: working my way towards a stable k8s release

This commit is contained in:
Aditya
2024-06-13 02:48:39 +05:30
parent 0455b59bd8
commit 5e7e120b89
+18 -9
View File
@@ -659,13 +659,7 @@ func handleBackendImageDownload(ctx context.Context, images string) error {
return nil
}
func deployWorker(image string, identifier string, env []string, executionRequest shuffle.ExecutionRequest) error {
if len(os.Getenv("REGISTRY_URL")) > 0 && os.Getenv("REGISTRY_URL") != "" {
env = append(env, fmt.Sprintf("REGISTRY_URL=%s", os.Getenv("REGISTRY_URL")))
}
if isKubernetes == "true" {
func deployK8sWorker(image string, identifier string, env []string, executionRequest shuffle.ExecutionRequest) error {
env = append(env, fmt.Sprintf("IS_KUBERNETES=true"))
env = append(env, fmt.Sprintf("KUBERNETES_NAMESPACE=%s", os.Getenv("KUBERNETES_NAMESPACE")))
@@ -771,7 +765,7 @@ func deployWorker(image string, identifier string, env []string, executionReques
ctx := context.Background()
if len(podname) > 0 {
currentPodStatus, err := shuffle.GetCurrentPodNetworkConfig(ctx, clientset, kubernetesNamespace, podname)
_, err := shuffle.GetCurrentPodNetworkConfig(ctx, clientset, kubernetesNamespace, podname)
if err != nil {
log.Printf("[ERROR] Failed getting current pod network: %s", err)
} else {
@@ -804,7 +798,7 @@ func deployWorker(image string, identifier string, env []string, executionReques
// Get current pod's network so we can make the pod in it
networks, err := clientset.CoreV1().Pods(kubernetesNamespace).List(context.Background(), metav1.ListOptions{})
_, err = clientset.CoreV1().Pods(kubernetesNamespace).List(context.Background(), metav1.ListOptions{})
if err != nil {
log.Printf("[ERROR] Failed listing pods: %s", err)
}
@@ -818,6 +812,21 @@ func deployWorker(image string, identifier string, env []string, executionReques
log.Printf("[INFO] Created pod %q in namespace %q\n", createdPod.Name, createdPod.Namespace)
return nil
}
func deployWorker(image string, identifier string, env []string, executionRequest shuffle.ExecutionRequest) error {
if len(os.Getenv("REGISTRY_URL")) > 0 && os.Getenv("REGISTRY_URL") != "" {
env = append(env, fmt.Sprintf("REGISTRY_URL=%s", os.Getenv("REGISTRY_URL")))
}
if isKubernetes == "true" {
err := deployK8sWorker(image, identifier, env, executionRequest)
if err != nil {
log.Printf("[ERROR] Failed deploying Kubernetes worker: %s", err)
}
return err
}
// Binds is the actual "-v" volume.