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 return nil
} }
func deployK8sWorker(image string, identifier string, env []string, executionRequest shuffle.ExecutionRequest) error {
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" {
env = append(env, fmt.Sprintf("IS_KUBERNETES=true")) env = append(env, fmt.Sprintf("IS_KUBERNETES=true"))
env = append(env, fmt.Sprintf("KUBERNETES_NAMESPACE=%s", os.Getenv("KUBERNETES_NAMESPACE"))) 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() ctx := context.Background()
if len(podname) > 0 { if len(podname) > 0 {
currentPodStatus, err := shuffle.GetCurrentPodNetworkConfig(ctx, clientset, kubernetesNamespace, podname) _, err := shuffle.GetCurrentPodNetworkConfig(ctx, clientset, kubernetesNamespace, podname)
if err != nil { if err != nil {
log.Printf("[ERROR] Failed getting current pod network: %s", err) log.Printf("[ERROR] Failed getting current pod network: %s", err)
} else { } 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 // 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 { if err != nil {
log.Printf("[ERROR] Failed listing pods: %s", err) log.Printf("[ERROR] Failed listing pods: %s", err)
} }
@@ -820,6 +814,21 @@ func deployWorker(image string, identifier string, env []string, executionReques
return nil 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. // Binds is the actual "-v" volume.
// Max 20% CPU every second // Max 20% CPU every second