Compare commits

...

6 Commits

Author SHA1 Message Date
eball
ac03f2a13d fix: remove deprecated ingress mode handling from NginxController 2026-02-09 16:23:56 +08:00
eball
f6eb6574d6 Merge branch 'main' into module-bfl
* main:
  settings: add settings new version and update provider api (#2456)
  refactor(cli): unify config of command line options and envs (#2453)
  appservice: v2 app stop (#2455)
  download-server:add download err category && modify aria2 max concurrent (#2445)
  docs: add storage expansion via CLI (#2409)
  cli: upgrade l4-bfl-proxy to v0.3.10 (#2442)
  l4: skip invalid expose port  (#2441)
  appservice: add clickhouse support (#2440)
  daemon: change pcap open timeout to 1 millisecond to prevent close hang (#2439)
  tapr: add clickhouse support  (#2437)
  feat(gpu): supports dynamic detection of hot plugged-in GPUs (#2435)
  feat(olares-app): update version to v1.8.2 (#2433)
  bfl: myapps api add rawAppName  (#2432)
  cli: feat amdgpu install (#2430)
  feat(cli): collect nginx logs stored temporarily in some containers (#2429)
  docs/update/olares-space-storage-info

# Conflicts:
#	framework/bfl/.olares/config/launcher/templates/bfl_deploy.yaml
2026-01-30 23:05:16 +08:00
eball
9113e14b7a bfl: enhance user login background handling with style support 2026-01-30 23:02:48 +08:00
eball
fc62d8280a feat: enhance user login background handling with style support (#2462) 2026-01-30 22:56:08 +08:00
hys
b8d6e2f3cc update bfl api image tag to v0.4.39 2026-01-21 19:19:07 +08:00
hys
763c80c5fa fix: myapps api add rawAppName field 2026-01-21 19:19:07 +08:00
7 changed files with 17 additions and 112 deletions

View File

@@ -266,7 +266,7 @@ spec:
containers:
- name: api
image: beclab/bfl:v0.4.39
image: beclab/bfl:v0.4.40
imagePullPolicy: IfNotPresent
securityContext:
runAsUser: 1000

View File

@@ -299,111 +299,6 @@ func (r *NginxController) generateNginxServers() ([]config.Server, error) {
ctx := context.TODO()
// get the bfl service
var svc corev1.Service
err := r.Get(ctx, types.NamespacedName{Namespace: constants.Namespace, Name: constants.BFLServiceName}, &svc)
if err != nil {
return nil, fmt.Errorf("no bfl service found, %v", err)
}
latestAppPort := func(portName string) int {
// compute the latest and available app port
var latestPort, maxAppPort int32
if len(svc.Spec.Ports) < 1 {
return int(constants.AppListenFromPort)
} else {
maxPort := svc.Spec.Ports[0].Port
for _, p := range svc.Spec.Ports {
if p.Name == portName {
// never used
// latestPort = p.Port
break
}
if p.Port > maxPort {
maxPort = p.Port
}
if strings.HasPrefix(p.Name, constants.AppPortNamePrefix) && p.Port > maxAppPort {
maxAppPort = p.Port
}
}
if maxAppPort+1 > constants.AppListenFromPort && maxAppPort+1 < maxPort {
latestPort = maxAppPort + 1
} else if maxAppPort < constants.AppListenFromPort {
latestPort = constants.AppListenFromPort
} else {
latestPort = maxPort + 1
}
}
klog.InfoS("Figure out the latest port", "maxAppPort", maxAppPort, "latestPort", latestPort)
portExists := false
for _, app := range svc.Spec.Ports {
if portName == app.Name {
app.Port = latestPort
app.TargetPort = intstr.FromInt(int(latestPort))
portExists = true
break
}
}
if !portExists {
// update svc
svcPort := corev1.ServicePort{
Name: portName,
Protocol: "TCP",
Port: latestPort,
TargetPort: intstr.FromInt(int(latestPort)),
}
svc.Spec.Ports = append(svc.Spec.Ports, svcPort)
}
return int(latestPort)
}
// For each applications port server
for _, app := range r.apps {
if len(app.Spec.Entrances) == 0 {
klog.Warningf("invalid app %q, ignore it. app=%s", app.Spec.Name, utils.PrettyJSON(app.Spec))
continue
}
for _, entrance := range app.Spec.Entrances {
if entrance.Host == "" {
continue
}
appPortName := fmt.Sprintf("%s%s", constants.AppPortNamePrefix, entrance.Name)
appPort := latestAppPort(appPortName)
s := config.Server{
Port: appPort,
Locations: []config.Location{
{
Prefix: "/",
ProxyPass: fmt.Sprintf("http://%s.%s.svc.cluster.local:%d", entrance.Host, app.Spec.Namespace, entrance.Port),
},
},
}
// server patches
if patches, ok := patches[entrance.Name]; ok {
for _, patch := range patches {
_, err = patch(ctx, r, &s)
if err != nil {
klog.Errorf("failed to apply patch for app %s, %v", app.Spec.Name, err)
return nil, err
}
}
}
servers = append(servers, s)
}
}
klog.Infof("Prepared and updating service ports:\n%v", utils.PrettyJSON(svc.Spec.Ports))
err = r.Update(context.TODO(), &svc)
if err != nil {
return nil, err
}
// For each domain servers
if r.sslConfigData != nil {

View File

@@ -281,7 +281,7 @@ func (h *Handler) handleTerminusInfo(req *restful.Request, resp *restful.Respons
tInfo.TailScaleEnable = denyAll == 1
}
tInfo.LoginBackground = userOp.GetLoginBackground(user)
tInfo.LoginBackground, tInfo.Style = userOp.GetLoginBackground(user)
tInfo.Avatar = userOp.GetAvatar(user)
tInfo.UserDID = userOp.GetUserDID(user)
@@ -347,7 +347,7 @@ func (h *Handler) handleOlaresInfo(req *restful.Request, resp *restful.Response)
tInfo.TailScaleEnable = denyAll == 1
}
tInfo.LoginBackground = userOp.GetLoginBackground(user)
tInfo.LoginBackground, tInfo.Style = userOp.GetLoginBackground(user)
tInfo.Avatar = userOp.GetAvatar(user)
tInfo.UserDID = userOp.GetUserDID(user)

View File

@@ -40,6 +40,7 @@ type TerminusInfo struct {
UserDID string `json:"did"`
ReverseProxy string `json:"reverseProxy"`
Terminusd string `json:"terminusd"`
Style string `json:"style"`
}
type OlaresInfo struct {
@@ -53,6 +54,7 @@ type OlaresInfo struct {
ID string `json:"id"`
UserDID string `json:"did"`
Olaresd string `json:"olaresd"`
Style string `json:"style"`
}
type MyAppsParam struct {

View File

@@ -127,13 +127,18 @@ func (o *UserOperator) GetReverseProxyType() (string, error) {
return o.GetUserAnnotation(user, constants.UserAnnotationReverseProxyType), nil
}
func (o *UserOperator) GetLoginBackground(user *iamV1alpha2.User) string {
func (o *UserOperator) GetLoginBackground(user *iamV1alpha2.User) (string, string) {
b := o.GetUserAnnotation(user, constants.UserLoginBackground)
s := o.GetUserAnnotation(user, constants.UserLoginBackgroundStyle)
if b == "" {
return "/bg/0.jpg"
b = "/bg/0.jpg"
}
return b
if s == "" {
s = "fill"
}
return b, s
}
func (o *UserOperator) GetAvatar(user *iamV1alpha2.User) string {

View File

@@ -612,6 +612,7 @@ func (h *Handler) handleUpdateLocale(req *restful.Request, resp *restful.Respons
func (h *Handler) handlerUpdateUserLoginBackground(req *restful.Request, resp *restful.Response) {
var background struct {
Background string `json:"background"`
Style string `json:"style"`
}
err := req.ReadEntity(&background)
@@ -636,6 +637,7 @@ func (h *Handler) handlerUpdateUserLoginBackground(req *restful.Request, resp *r
err = userOp.UpdateUser(user, []func(*iamV1alpha2.User){
func(u *iamV1alpha2.User) {
u.Annotations[constants.UserLoginBackground] = background.Background
u.Annotations[constants.UserLoginBackgroundStyle] = background.Style
},
})

View File

@@ -175,7 +175,8 @@ var (
UserAvatar = fmt.Sprintf("%s/avatar", AnnotationGroup)
UserLoginBackground = fmt.Sprintf("%s/login-background", AnnotationGroup)
UserLoginBackground = fmt.Sprintf("%s/login-background", AnnotationGroup)
UserLoginBackgroundStyle = fmt.Sprintf("%s/login-background-style", AnnotationGroup)
)
var (