From b18c96586099c545f6243c302bdbf0d3cfced1c0 Mon Sep 17 00:00:00 2001 From: smruthi2187 Date: Tue, 6 Feb 2018 10:28:48 -0800 Subject: [PATCH] Adding readiness, liveness probe for storagesvc. --- charts/fission-all/templates/deployment.yaml | 12 ++++++++++++ storagesvc/storagesvc.go | 5 +++++ test/test_utils.sh | 1 + 3 files changed, 18 insertions(+) diff --git a/charts/fission-all/templates/deployment.yaml b/charts/fission-all/templates/deployment.yaml index caf6afb2..0298c363 100644 --- a/charts/fission-all/templates/deployment.yaml +++ b/charts/fission-all/templates/deployment.yaml @@ -559,6 +559,18 @@ spec: volumeMounts: - name: fission-storage mountPath: /fission + readinessProbe: + httpGet: + path: "/healthz" + port: 8000 + initialDelaySeconds: 5 + periodSeconds: 2 + livenessProbe: + httpGet: + path: "/healthz" + port: 8000 + initialDelaySeconds: 16 + periodSeconds: 5 serviceAccount: fission-svc volumes: - name: fission-storage diff --git a/storagesvc/storagesvc.go b/storagesvc/storagesvc.go index 4f253f71..db744d20 100644 --- a/storagesvc/storagesvc.go +++ b/storagesvc/storagesvc.go @@ -149,6 +149,10 @@ func (ss *StorageService) downloadHandler(w http.ResponseWriter, r *http.Request } } +func (ss *StorageService) healthHandler(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) +} + func MakeStorageService(storageClient *StowClient, port int) *StorageService { return &StorageService{ storageClient: storageClient, @@ -161,6 +165,7 @@ func (ss *StorageService) Start(port int) { r.HandleFunc("/v1/archive", ss.uploadHandler).Methods("POST") r.HandleFunc("/v1/archive", ss.downloadHandler).Methods("GET") r.HandleFunc("/v1/archive", ss.deleteHandler).Methods("DELETE") + r.HandleFunc("/healthz", ss.healthHandler).Methods("GET") address := fmt.Sprintf(":%v", port) log.Fatal(http.ListenAndServe(address, handlers.LoggingHandler(os.Stdout, r))) diff --git a/test/test_utils.sh b/test/test_utils.sh index caac4686..9c37e28f 100755 --- a/test/test_utils.sh +++ b/test/test_utils.sh @@ -379,6 +379,7 @@ dump_logs() { dump_fission_logs $ns $fns router dump_fission_logs $ns $fns buildermgr dump_fission_logs $ns $fns executor + dump_fission_logs $ns $fn storagsvc dump_function_pod_logs $ns $fns dump_builder_pod_logs $bns dump_fission_crds