Added prepull.

This commit is contained in:
rony5394
2026-04-27 15:16:24 +02:00
parent 32069f7e9d
commit 7214e26168
7 changed files with 141 additions and 4 deletions

View File

@@ -27,6 +27,8 @@ var scale sync.Map;
var token string = "12345";
var theConfig cfg.Config;
var theShutdownFuncPointer *context.CancelFunc;
type aService struct{
ServiceId string `json:"serviceId"`;
VolumeNames []string `json:"volumeNames"`;
@@ -39,6 +41,7 @@ func Run(Config cfg.Config){
theConfig = Config;
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM);
theShutdownFuncPointer = &stop;
var err error;
ApiClient, err = client.NewClientWithOpts(client.FromEnv);
@@ -62,6 +65,7 @@ func Run(Config cfg.Config){
Addr: ":1234",
}
http.HandleFunc("/prepull", prepullImage);
http.HandleFunc("/services", listServices);
http.HandleFunc("/scale/up", scaleUp);
http.HandleFunc("/scale/down", scaleDown);