Реализовать lab3 в общем Helm-релизе с Traefik, TLS и HPA
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/google/uuid"
|
||||
"go.lab260.ru/fielderr"
|
||||
"go.uber.org/zap"
|
||||
|
||||
@@ -19,6 +20,7 @@ import (
|
||||
// Its configuration is copied at construction and must not change during serving.
|
||||
// Fx manages its listener through Start and Stop.
|
||||
type Controller struct {
|
||||
metrics *httpMetrics
|
||||
log *zap.Logger
|
||||
cfg config.Controller
|
||||
service service.Service
|
||||
@@ -28,6 +30,7 @@ type Controller struct {
|
||||
auth service.Authentication
|
||||
readiness Readiness
|
||||
stopping atomic.Bool
|
||||
instanceID string
|
||||
serveDone chan error
|
||||
}
|
||||
|
||||
@@ -43,6 +46,7 @@ func New(log *zap.Logger, cfg *config.Controller, svc service.Service, registry
|
||||
return nil, fmt.Errorf("HTTP logger, service, error registry and admission limiter are required")
|
||||
}
|
||||
ctrl := &Controller{
|
||||
metrics: newHTTPMetrics(),
|
||||
log: log.Named("controller.http.fiber"),
|
||||
cfg: *cfg,
|
||||
service: svc,
|
||||
@@ -52,6 +56,10 @@ func New(log *zap.Logger, cfg *config.Controller, svc service.Service, registry
|
||||
readiness: readiness,
|
||||
serveDone: make(chan error, 1),
|
||||
}
|
||||
ctrl.instanceID = cfg.InstanceID
|
||||
if ctrl.instanceID == "" {
|
||||
ctrl.instanceID = uuid.NewString()
|
||||
}
|
||||
ctrl.configure()
|
||||
return ctrl, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user