* Add readiness probe * Remove builder manager http api interface since we don’t use/need it * Check environment builder status and block build requests until builder is ready * Replace deprecated api extension interface * Add healthy check to python env
31 lines
672 B
Go
31 lines
672 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
"os"
|
|
|
|
"github.com/fission/fission/environments/fetcher"
|
|
)
|
|
|
|
// Usage: fetcher <shared volume path>
|
|
func main() {
|
|
dir := os.Args[1]
|
|
if _, err := os.Stat(dir); err != nil {
|
|
if os.IsNotExist(err) {
|
|
err = os.MkdirAll(dir, os.ModeDir|0700)
|
|
if err != nil {
|
|
log.Fatalf("Error creating directory: %v", err)
|
|
}
|
|
}
|
|
}
|
|
fetcher := fetcher.MakeFetcher(dir)
|
|
mux := http.NewServeMux()
|
|
mux.HandleFunc("/", fetcher.FetchHandler)
|
|
mux.HandleFunc("/upload", fetcher.UploadHandler)
|
|
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
|
|
w.WriteHeader(http.StatusOK)
|
|
})
|
|
http.ListenAndServe(":8000", mux)
|
|
}
|