Added sigHandler to print stackTrace, modified probe params

This commit is contained in:
smruthi2187
2018-02-08 13:58:44 -08:00
parent 93dde93afe
commit bce45d6d25
8 changed files with 102 additions and 17 deletions
+16 -12
View File
@@ -133,13 +133,14 @@ spec:
httpGet: httpGet:
path: "/healthz" path: "/healthz"
port: 8888 port: 8888
initialDelaySeconds: 5 initialDelaySeconds: 1
periodSeconds: 2 periodSeconds: 1
failureThreshold: 30
livenessProbe: livenessProbe:
httpGet: httpGet:
path: "/healthz" path: "/healthz"
port: 8888 port: 8888
initialDelaySeconds: 16 initialDelaySeconds: 35
periodSeconds: 5 periodSeconds: 5
serviceAccount: fission-svc serviceAccount: fission-svc
@@ -167,13 +168,14 @@ spec:
httpGet: httpGet:
path: "/router-healthz" path: "/router-healthz"
port: 8888 port: 8888
initialDelaySeconds: 5 initialDelaySeconds: 1
periodSeconds: 2 periodSeconds: 1
failureThreshold: 30
livenessProbe: livenessProbe:
httpGet: httpGet:
path: "/router-healthz" path: "/router-healthz"
port: 8888 port: 8888
initialDelaySeconds: 16 initialDelaySeconds: 35
periodSeconds: 5 periodSeconds: 5
serviceAccount: fission-svc serviceAccount: fission-svc
@@ -224,13 +226,14 @@ spec:
httpGet: httpGet:
path: "/healthz" path: "/healthz"
port: 8888 port: 8888
initialDelaySeconds: 5 initialDelaySeconds: 1
periodSeconds: 2 periodSeconds: 1
failureThreshold: 30
livenessProbe: livenessProbe:
httpGet: httpGet:
path: "/healthz" path: "/healthz"
port: 8888 port: 8888
initialDelaySeconds: 16 initialDelaySeconds: 35
periodSeconds: 5 periodSeconds: 5
serviceAccount: fission-svc serviceAccount: fission-svc
@@ -563,13 +566,14 @@ spec:
httpGet: httpGet:
path: "/healthz" path: "/healthz"
port: 8000 port: 8000
initialDelaySeconds: 5 initialDelaySeconds: 1
periodSeconds: 2 periodSeconds: 1
failureThreshold: 30
livenessProbe: livenessProbe:
httpGet: httpGet:
path: "/healthz" path: "/healthz"
port: 8000 port: 8000
initialDelaySeconds: 16 initialDelaySeconds: 35
periodSeconds: 5 periodSeconds: 5
serviceAccount: fission-svc serviceAccount: fission-svc
volumes: volumes:
+17
View File
@@ -18,11 +18,28 @@ package controller
import ( import (
"log" "log"
"os/signal"
"syscall"
"os"
"runtime/debug"
"github.com/fission/fission/crd" "github.com/fission/fission/crd"
) )
func dumpStackTrace() {
debug.PrintStack()
}
func Start(port int) { func Start(port int) {
// register signal handler for dumping stack trace.
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGTERM)
go func() {
<-c
dumpStackTrace()
os.Exit(1)
}()
fc, _, apiExtClient, err := crd.MakeFissionClient() fc, _, apiExtClient, err := crd.MakeFissionClient()
if err != nil { if err != nil {
log.Fatalf("Failed to connect to K8s API: %v", err) log.Fatalf("Failed to connect to K8s API: %v", err)
+16
View File
@@ -12,13 +12,29 @@ import (
"os" "os"
"strconv" "strconv"
"time" "time"
"os/signal"
"syscall"
"runtime/debug"
"github.com/fission/fission" "github.com/fission/fission"
"github.com/fission/fission/environments/fetcher" "github.com/fission/fission/environments/fetcher"
) )
func dumpStackTrace() {
debug.PrintStack()
}
// Usage: fetcher <shared volume path> // Usage: fetcher <shared volume path>
func main() { func main() {
// register signal handler for dumping stack trace.
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGTERM)
go func() {
<-c
dumpStackTrace()
os.Exit(1)
}()
flag.Usage = fetcherUsage flag.Usage = fetcherUsage
specializeOnStart := flag.Bool("specialize-on-startup", false, "Flag to activate specialize process at pod starup") specializeOnStart := flag.Bool("specialize-on-startup", false, "Flag to activate specialize process at pod starup")
fetchPayload := flag.String("fetch-request", "", "JSON Payload for fetch request") fetchPayload := flag.String("fetch-request", "", "JSON Payload for fetch request")
+17
View File
@@ -21,6 +21,10 @@ import (
"strings" "strings"
"sync" "sync"
"time" "time"
"os"
"os/signal"
"syscall"
"runtime/debug"
"github.com/dchest/uniuri" "github.com/dchest/uniuri"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -181,9 +185,22 @@ func (executor *Executor) getFunctionEnv(m *metav1.ObjectMeta) (*crd.Environment
return env, nil return env, nil
} }
func dumpStackTrace() {
debug.PrintStack()
}
// StartExecutor Starts executor and the executor components such as Poolmgr, // StartExecutor Starts executor and the executor components such as Poolmgr,
// deploymgr and potential future executor types // deploymgr and potential future executor types
func StartExecutor(fissionNamespace string, functionNamespace string, port int) error { func StartExecutor(fissionNamespace string, functionNamespace string, port int) error {
// register signal handler for dumping stack trace.
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGTERM)
go func() {
<-c
dumpStackTrace()
os.Exit(1)
}()
fissionClient, kubernetesClient, _, err := crd.MakeFissionClient() fissionClient, kubernetesClient, _, err := crd.MakeFissionClient()
restClient := fissionClient.GetCrdClient() restClient := fissionClient.GetCrdClient()
if err != nil { if err != nil {
+16
View File
@@ -46,6 +46,9 @@ import (
"net/http" "net/http"
"os" "os"
"time" "time"
"os/signal"
"syscall"
"runtime/debug"
"github.com/gorilla/handlers" "github.com/gorilla/handlers"
"github.com/gorilla/mux" "github.com/gorilla/mux"
@@ -71,7 +74,20 @@ func serve(ctx context.Context, port int, httpTriggerSet *HTTPTriggerSet, resolv
http.ListenAndServe(url, handlers.LoggingHandler(os.Stdout, mr)) http.ListenAndServe(url, handlers.LoggingHandler(os.Stdout, mr))
} }
func dumpStackTrace() {
debug.PrintStack()
}
func Start(port int, executorUrl string) { func Start(port int, executorUrl string) {
// register signal handler for dumping stack trace.
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGTERM)
go func() {
<-c
dumpStackTrace()
os.Exit(1)
}()
fmap := makeFunctionServiceMap(time.Minute) fmap := makeFunctionServiceMap(time.Minute)
fissionClient, _, _, err := crd.MakeFissionClient() fissionClient, _, _, err := crd.MakeFissionClient()
+16
View File
@@ -24,6 +24,9 @@ import (
"os" "os"
"strconv" "strconv"
"time" "time"
"os/signal"
"syscall"
"runtime/debug"
"github.com/gorilla/handlers" "github.com/gorilla/handlers"
"github.com/gorilla/mux" "github.com/gorilla/mux"
@@ -171,7 +174,20 @@ func (ss *StorageService) Start(port int) {
log.Fatal(http.ListenAndServe(address, handlers.LoggingHandler(os.Stdout, r))) log.Fatal(http.ListenAndServe(address, handlers.LoggingHandler(os.Stdout, r)))
} }
func dumpStackTrace() {
debug.PrintStack()
}
func RunStorageService(storageType StorageType, storagePath string, containerName string, port int, enablePruner bool) *StorageService { func RunStorageService(storageType StorageType, storagePath string, containerName string, port int, enablePruner bool) *StorageService {
// register signal handler for dumping stack trace.
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGTERM)
go func() {
<-c
dumpStackTrace()
os.Exit(1)
}()
// initialize logger // initialize logger
log.SetLevel(log.InfoLevel) log.SetLevel(log.InfoLevel)
+3 -4
View File
@@ -264,9 +264,7 @@ helm_uninstall_fission() {(set +e
echo "Uninstalling fission" echo "Uninstalling fission"
helm delete --purge $id helm delete --purge $id
# kubectl delete ns f-$id || true kubectl delete ns f-$id || true
# kubectl delete ns f-func-$id || true
# kubectl delete ns fission-builder || true
)} )}
export -f helm_uninstall_fission export -f helm_uninstall_fission
@@ -284,7 +282,7 @@ set_environment() {
dump_builder_pod_logs() { dump_builder_pod_logs() {
bns=$1 bns=$1
builderPods=$(kubectl -n $bns get pod -o name) builderPods=$(kubectl -n $bns get pod -o name)
for p in $builderPods for p in $builderPods
do do
echo "--- builder pod logs $p ---" echo "--- builder pod logs $p ---"
@@ -359,6 +357,7 @@ dump_all_fission_resources() {
echo "--- All objects in the fission namespace $ns ---" echo "--- All objects in the fission namespace $ns ---"
kubectl -n $ns get all kubectl -n $ns get all
kubectl -n $ns get pods -o wide
echo "--- End objects in the fission namespace $ns ---" echo "--- End objects in the fission namespace $ns ---"
} }
@@ -62,5 +62,5 @@ if [ $num -ne 4 ]
then then
echo "Test Failed: expected 4, found $num logs" echo "Test Failed: expected 4, found $num logs"
fi fi
echo "All done." echo "All done."