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" {
|
if os.Getenv("IS_KUBERNETES") == "true" {
|
||||||
|
|
||||||
namespace := "shuffle"
|
namespace := "shuffle"
|
||||||
|
localRegistry := os.Getenv("REGISTRY_URL")
|
||||||
|
|
||||||
envMap := make(map[string]string)
|
envMap := make(map[string]string)
|
||||||
for _, envStr := range env {
|
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
|
// checking if app is generated or not
|
||||||
appDetails := strings.Split(image, ":")[1]
|
appDetails := strings.Split(image, ":")[1]
|
||||||
appDetailsSplit := strings.Split(appDetails, "_")
|
appDetailsSplit := strings.Split(appDetails, "_")
|
||||||
appName := appDetailsSplit[0]
|
appName := strings.Join(appDetailsSplit[:len(appDetailsSplit)-1], "_")
|
||||||
appVersion := appDetailsSplit[1]
|
appVersion := appDetailsSplit[len(appDetailsSplit)-1]
|
||||||
|
|
||||||
|
log.Printf("APP VERSION IS: %s", appVersion)
|
||||||
|
|
||||||
for _, app := range workflowExecution.Workflow.Actions {
|
for _, app := range workflowExecution.Workflow.Actions {
|
||||||
log.Printf("[DEBUG] App: %s, Version: %s", appName, appVersion)
|
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.AppName == appName && app.AppVersion == appVersion {
|
||||||
if app.Generated == true {
|
if app.Generated == true {
|
||||||
log.Printf("[DEBUG] Generated app, setting local registry")
|
log.Printf("[DEBUG] Generated app, setting local registry")
|
||||||
image = fmt.Sprintf("%s/%s", registryName, image)
|
image = fmt.Sprintf("%s/%s", localRegistry, image)
|
||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
log.Printf("[DEBUG] Not generated app, setting shuffle registry")
|
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{
|
Spec: corev1.PodSpec{
|
||||||
|
NodeName: "worker1", // change this in prod
|
||||||
RestartPolicy: "Never",
|
RestartPolicy: "Never",
|
||||||
Containers: []corev1.Container{
|
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{})
|
createdPod, err := clientset.CoreV1().Pods(namespace).Create(context.Background(), pod, metav1.CreateOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Error creating pod: %v\n", err)
|
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)
|
fmt.Printf("[DEBUG] Created pod %q in namespace %q\n", createdPod.Name, createdPod.Namespace)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user