Merge branch '2.0.0' of https://github.com/shuffle/shuffle into 2.0.0

This commit is contained in:
Frikky
2024-11-06 21:47:19 +01:00
10 changed files with 277 additions and 7 deletions
+2 -2
View File
@@ -4,13 +4,13 @@ go 1.22.0
toolchain go1.22.2
replace github.com/shuffle/shuffle-shared => ../../../../shuffle-shared
// replace github.com/shuffle/shuffle-shared => ../../../../shuffle-shared
require (
github.com/docker/docker v27.0.2+incompatible
github.com/docker/go-connections v0.5.0
github.com/satori/go.uuid v1.2.0
github.com/shuffle/shuffle-shared v0.6.74
github.com/shuffle/shuffle-shared v0.6.79
k8s.io/api v0.30.2
k8s.io/apimachinery v0.30.2
)
+4
View File
@@ -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_GCHR_OVERRIDE_FOR_AUTODEPLOY")) > 0 {
env = append(env, fmt.Sprintf("SHUFFLE_USE_GCHR_OVERRIDE_FOR_AUTODEPLOY=%s", os.Getenv("SHUFFLE_USE_GCHR_OVERRIDE_FOR_AUTODEPLOY")))
}
clientset, _, err := shuffle.GetKubernetesClient()
if err != nil {
log.Printf("[ERROR] Error getting kubernetes client:", err)
+23 -4
View File
@@ -423,8 +423,27 @@ func deployk8sApp(image string, identifier string, env []string) error {
// value = strings.ReplaceAll(value, "_", "-")
value := identifier
baseDeployMode := false
// check if autoDeploy contains a value
// that is equal to the image being deployed.
for _, value := range autoDeploy {
if value == image {
baseDeployMode = true
}
}
autoDeployOverride := os.Getenv("SHUFFLE_USE_GCHR_OVERRIDE_FOR_AUTODEPLOY") == "true"
localRegistry := ""
// Checking if app is generated or not
localRegistry := os.Getenv("REGISTRY_URL")
if !baseDeployMode && !autoDeployOverride {
localRegistry = os.Getenv("REGISTRY_URL")
} else {
log.Printf("[DEBUG] Detected baseDeploy image (%s) and ghcr override. Resorting to using ghcr instead of registry", image)
}
/*
appDetails := strings.Split(image, ":")[1]
appDetailsSplit := strings.Split(appDetails, "_")
@@ -445,15 +464,15 @@ func deployk8sApp(image string, identifier string, env []string) error {
}
*/
if len(localRegistry) == 0 && len(os.Getenv("SHUFFLE_BASE_IMAGE_REGISTRY")) > 0 {
if (len(localRegistry) == 0 && len(os.Getenv("SHUFFLE_BASE_IMAGE_REGISTRY")) > 0) && !(baseDeployMode && autoDeployOverride) {
localRegistry = os.Getenv("SHUFFLE_BASE_IMAGE_REGISTRY")
}
if len(localRegistry) > 0 && strings.Count(image, "/") <= 2 {
if (len(localRegistry) > 0 && strings.Count(image, "/") <= 2) && !(baseDeployMode && autoDeployOverride) {
log.Printf("[DEBUG] Using REGISTRY_URL %s", localRegistry)
image = fmt.Sprintf("%s/%s", localRegistry, image)
} else {
if strings.Count(image, "/") <= 2 {
if strings.Count(image, "/") <= 2 && !strings.HasPrefix(image, "frikky/shuffle:") {
image = fmt.Sprintf("frikky/shuffle:%s", image)
}
}