fixed local registry part in wokrer
This commit is contained in:
@@ -233,6 +233,7 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
|
||||
if os.Getenv("IS_KUBERNETES") == "true" {
|
||||
|
||||
namespace := "shuffle"
|
||||
localRegistry := os.Getenv("REGISTRY_URL")
|
||||
|
||||
envMap := make(map[string]string)
|
||||
for _, envStr := range env {
|
||||
@@ -257,8 +258,10 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
|
||||
// checking if app is generated or not
|
||||
appDetails := strings.Split(image, ":")[1]
|
||||
appDetailsSplit := strings.Split(appDetails, "_")
|
||||
appName := appDetailsSplit[0]
|
||||
appVersion := appDetailsSplit[1]
|
||||
appName := strings.Join(appDetailsSplit[:len(appDetailsSplit)-1], "_")
|
||||
appVersion := appDetailsSplit[len(appDetailsSplit)-1]
|
||||
|
||||
log.Printf("APP VERSION IS: %s", appVersion)
|
||||
|
||||
for _, app := range workflowExecution.Workflow.Actions {
|
||||
log.Printf("[DEBUG] App: %s, Version: %s", appName, appVersion)
|
||||
@@ -266,7 +269,7 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
|
||||
if app.AppName == appName && app.AppVersion == appVersion {
|
||||
if app.Generated == true {
|
||||
log.Printf("[DEBUG] Generated app, setting local registry")
|
||||
image = fmt.Sprintf("%s/%s", registryName, image)
|
||||
image = fmt.Sprintf("%s/%s", localRegistry, image)
|
||||
break
|
||||
} else {
|
||||
log.Printf("[DEBUG] Not generated app, setting shuffle registry")
|
||||
@@ -287,6 +290,7 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
|
||||
},
|
||||
},
|
||||
Spec: corev1.PodSpec{
|
||||
NodeName: "worker1", // change this in prod
|
||||
RestartPolicy: "Never",
|
||||
Containers: []corev1.Container{
|
||||
{
|
||||
@@ -301,7 +305,7 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
|
||||
createdPod, err := clientset.CoreV1().Pods(namespace).Create(context.Background(), pod, metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error creating pod: %v\n", err)
|
||||
os.Exit(1)
|
||||
// os.Exit(1)
|
||||
}
|
||||
fmt.Printf("[DEBUG] Created pod %q in namespace %q\n", createdPod.Name, createdPod.Namespace)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user