Compare commits

...

3 Commits

Author SHA1 Message Date
hysyeah
738198350f fix: skip nginx reload if configuration has not changed (#2555) 2026-02-25 13:54:09 +08:00
eball
5de7ea01bc fix: skip nginx reload if configuration has not changed 2026-02-25 11:45:13 +08:00
hysyeah
ff7765bcb9 fix: skip invalid expose port (#2434) 2026-01-22 12:00:32 +08:00

View File

@@ -146,6 +146,8 @@ type Server struct {
ngxCmd *nginx.Command
ngxTmpl *template.Template
prevNgxConf []byte
}
func (s *Server) init() error {
@@ -906,6 +908,9 @@ func (s *Server) generateStreamServers() ([]StreamServer, error) {
if bflHost == "" {
return nil, fmt.Errorf("can not find bfl service for user=%s", app.Spec.Owner)
}
if p.ExposePort < 1 || p.ExposePort > 65535 {
continue
}
server := StreamServer{
Protocol: p.Protocol,
Port: p.ExposePort,
@@ -929,6 +934,13 @@ func (s *Server) renderAndReload() error {
return err
}
nginxConfig := buf.Bytes()
if bytes.Equal(nginxConfig, s.prevNgxConf) {
klog.Infof("nginx config not changed, skip reload")
return nil
}
s.prevNgxConf = nginxConfig
err = s.testTemplate(nginxConfig)
if err != nil {
return err