From 6c42e1c1abd69ca0e9bbb181901a032ba1357840 Mon Sep 17 00:00:00 2001 From: Aditya <60684641+0x0elliot@users.noreply.github.com> Date: Mon, 4 Nov 2024 12:47:56 +0530 Subject: [PATCH] fix: use dockerhub on override variable --- .env | 4 ++++ functions/onprem/orborus/orborus.go | 4 ++++ functions/onprem/worker/worker.go | 7 +++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.env b/.env index 48bd17bc..f125bc4e 100755 --- a/.env +++ b/.env @@ -69,6 +69,10 @@ IS_KUBERNETES=false SHUFFLE_BASE_IMAGE_REPOSITORY=frikky #SHUFFLE_BASE_IMAGE_TAG_SUFFIX="-1.4.0" +# For environments using their own docker registry +# where they don't want to update http, subflow and shuffle tools again +SHUFFLE_USE_DOCKERHUB_FOR_AUTODEPLOY=true + # The eth0 interface inside a container corresponds # to the virtual Ethernet interface that connects # the container to the docker0 diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index 857e216d..790180da 100755 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -966,6 +966,10 @@ func deployK8sWorker(image string, identifier string, env []string) error { env = append(env, fmt.Sprintf("REGISTRY_URL=%s", os.Getenv("REGISTRY_URL"))) } + if len(os.Getenv("SHUFFLE_USE_DOCKERHUB_FOR_AUTODEPLOY")) > 0 { + env = append(env, fmt.Sprintf("SHUFFLE_USE_DOCKERHUB_FOR_AUTODEPLOY=%s", os.Getenv("SHUFFLE_USE_DOCKERHUB_FOR_AUTODEPLOY"))) + } + clientset, _, err := shuffle.GetKubernetesClient() if err != nil { log.Printf("[ERROR] Error getting kubernetes client:", err) diff --git a/functions/onprem/worker/worker.go b/functions/onprem/worker/worker.go index b911ef98..a0452b4e 100644 --- a/functions/onprem/worker/worker.go +++ b/functions/onprem/worker/worker.go @@ -429,16 +429,19 @@ func deployk8sApp(image string, identifier string, env []string) error { // that is equal to the image being deployed. for _, value := range autoDeploy { if value == image { - log.Printf("[DEBUG] Detected baseDeploy image. Resorting to not using the registry") baseDeployMode = true } } + autoDeployOverride := os.Getenv("SHUFFLE_USE_DOCKERHUB_FOR_AUTODEPLOY") == "true" + localRegistry := "" // Checking if app is generated or not - if !baseDeployMode { + if !baseDeployMode && !autoDeployOverride { localRegistry := os.Getenv("REGISTRY_URL") + } else { + log.Printf("[DEBUG] Detected baseDeploy image (%s) and dockerhub override. Resorting to using dockerhub instead of registry", image) } /*