Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: failed to save outputs: verify serviceaccount default:default has necessary privileges #1362

Merged
merged 14 commits into from
May 31, 2019
Merged
2 changes: 2 additions & 0 deletions cmd/argoexec/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package commands

import (
"encoding/json"
"github.com/argoproj/argo/util"
"os"

"github.com/argoproj/pkg/cli"
Expand Down Expand Up @@ -105,6 +106,7 @@ func initExecutor() *executor.WorkflowExecutor {
// checkErr is a convenience function to panic upon error
func checkErr(err error) {
if err != nil {
util.WriteTeriminateMessage(err.Error())
panic(err.Error())
}
}
10 changes: 10 additions & 0 deletions util/util.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package util

import "io/ioutil"

type Closer interface {
Close() error
}
Expand All @@ -9,3 +11,11 @@ type Closer interface {
func Close(c Closer) {
_ = c.Close()
}

// Write the Terminate message in pod spec
func WriteTeriminateMessage(message string) {
err := ioutil.WriteFile("/dev/termination-log", []byte(message), 0644)
if err != nil {
panic(err)
}
}
3 changes: 3 additions & 0 deletions workflow/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/argoproj/argo/util"
"io"
"io/ioutil"
"net/url"
Expand Down Expand Up @@ -112,9 +113,11 @@ func NewExecutor(clientset kubernetes.Interface, podName, namespace, podAnnotati
func (we *WorkflowExecutor) HandleError() {
if r := recover(); r != nil {
_ = we.AddAnnotation(common.AnnotationKeyNodeMessage, fmt.Sprintf("%v", r))
util.WriteTeriminateMessage(fmt.Sprintf("%v", r))
log.Fatalf("executor panic: %+v\n%s", r, debug.Stack())
} else {
if len(we.errors) > 0 {
util.WriteTeriminateMessage(we.errors[0].Error())
_ = we.AddAnnotation(common.AnnotationKeyNodeMessage, we.errors[0].Error())
}
}
Expand Down