diff --git a/backend/go-app/go.mod b/backend/go-app/go.mod index 4895bf22..659f6364 100644 --- a/backend/go-app/go.mod +++ b/backend/go-app/go.mod @@ -20,7 +20,7 @@ require ( github.com/gorilla/mux v1.8.1 github.com/h2non/filetype v1.1.3 github.com/satori/go.uuid v1.2.0 - github.com/shuffle/shuffle-shared v0.6.31 + github.com/shuffle/shuffle-shared v0.6.40 golang.org/x/crypto v0.22.0 google.golang.org/api v0.176.1 google.golang.org/grpc v1.63.2 @@ -76,6 +76,7 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.3 // indirect + github.com/imdario/mergo v0.3.12 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -103,6 +104,7 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/skeema/knownhosts v1.2.2 // indirect github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect + github.com/spf13/pflag v1.0.5 // indirect github.com/src-d/gcfg v1.4.0 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect go.opencensus.io v0.24.0 // indirect diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index b6b3258c..3d417472 100755 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -578,6 +578,7 @@ func handleGetStreamResults(resp http.ResponseWriter, request *http.Request) { if len(actionResult.ExecutionId) > 0 { log.Printf("[WARNING][%s] Failed getting execution (streamresult): %s", actionResult.ExecutionId, err) } + resp.WriteHeader(401) resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Bad authorization key or execution_id might not exist."}`))) return @@ -1062,16 +1063,17 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request } } - workflowExecution, execInfo, _, err := shuffle.PrepareWorkflowExecution(ctx, workflow, request, int64(maxExecutionDepth)) - if err != nil { - err = shuffle.SetWorkflowExecution(ctx, workflowExecution, true) + workflowExecution, execInfo, _, workflowExecErr := shuffle.PrepareWorkflowExecution(ctx, workflow, request, int64(maxExecutionDepth)) + if workflowExecErr != nil { + err := shuffle.SetWorkflowExecution(ctx, workflowExecution, true) if err != nil { log.Printf("[ERROR] Failed setting workflow execution during init (2): %s", err) } - if strings.Contains(fmt.Sprintf("%s", err), "User Input") { + if strings.Contains(fmt.Sprintf("%s", workflowExecErr), "User Input") { // Special for user input callbacks - return workflowExecution, fmt.Sprintf("%s", err), nil + log.Printf("[INFO] User input callback: %s", workflowExecErr) + // return workflowExecution, fmt.Sprintf("%s", err), nil } else { log.Printf("[ERROR] Failed in prepareExecution: '%s'", err) return shuffle.WorkflowExecution{}, fmt.Sprintf("Failed starting workflow: %s", err), err @@ -1079,7 +1081,7 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request } - err = imageCheckBuilder(execInfo.ImageNames) + err := imageCheckBuilder(execInfo.ImageNames) if err != nil { log.Printf("[ERROR] Failed building the required images from %#v: %s", execInfo.ImageNames, err) return shuffle.WorkflowExecution{}, "Failed unmarshal during execution", err diff --git a/functions/kubernetes/README.md b/functions/kubernetes/README.md index e8e315af..a54884e8 100644 --- a/functions/kubernetes/README.md +++ b/functions/kubernetes/README.md @@ -34,3 +34,35 @@ Step 2: Open the ```all-in-one.yaml``` file and review the configuration values. Step 3: Now, open ```https://:30008``` or ```http://:30007```. You should be seeing a signup page. NODE_IP should be where the frontend is deployed. +### Dev Mode + +1. Run backend and orborus with the environment variable `IS_KUBERNETES=true`: + +```bash +export IS_KUBERNETES=true +``` + +2. Turn on the k8s engine with minikube: + +```bash +minikube start +``` + +3. To use the worker scale feature, build the image with the following command: + +```bash +$NAME=shuffle-worker-scale +$VERSION=1.2.0 + +minikube build . -t shuffle/shuffle:$NAME -t shuffle/shuffle:$NAME_$VERSION -t docker.pkg.github.com/shuffle/shuffle/$NAME:$VERSION -t ghcr.io/shuffle/$NAME:$VERSION -t ghcr.io/shuffle/$NAME:nightly -t ghcr.io/shuffle/$NAME:$VERSION -t ghcr.io/shuffle/$NAME:nightly -t ghcr.io/shuffle/$NAME:latest +``` + +4. To run executions, Make sure to do the following: + +```bash +kubectl create role pod-creator --namespace=default --verb=create --resource=pods +kubectl create rolebinding pod-creator-binding --namespace=default --role=pod-creator --serviceaccount=default:default +``` + + +