Skip to content

Commit 8aaa850

Browse files
authored
feat: add shared entrances to AppInfo and update app list processing (#148)
1 parent bb6ea5e commit 8aaa850

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

pkg/app_service/v1/internal.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ func (c *Client) getAppListFromData(apps []map[string]interface{}) ([]*AppInfo,
4545
var res []*AppInfo
4646
for _, data := range apps {
4747
var appEntrances []Entrance
48+
var appSharedEntrances []Entrance
4849
appPorts := make([]ServicePort, 0)
4950
appACLs := make([]ACL, 0)
5051

@@ -150,6 +151,22 @@ func (c *Client) getAppListFromData(apps []map[string]interface{}) ([]*AppInfo,
150151
}
151152
}
152153

154+
sharedEntrances, ok := appSpec["sharedEntrances"]
155+
if ok {
156+
entrancesInterface := sharedEntrances.([]interface{})
157+
for _, entranceInterface := range entrancesInterface {
158+
entranceMap := entranceInterface.(map[string]interface{})
159+
var appEntrance Entrance
160+
if t, ok := entranceMap["name"]; ok {
161+
appEntrance.Name = stringOrEmpty(t)
162+
}
163+
if t, ok := entranceMap["url"]; ok {
164+
appEntrance.URL = stringOrEmpty(t)
165+
}
166+
appSharedEntrances = append(appSharedEntrances, appEntrance)
167+
}
168+
}
169+
153170
ports, ok := appSpec["ports"]
154171
if ok {
155172
portsInterface := ports.([]interface{})
@@ -224,6 +241,7 @@ func (c *Client) getAppListFromData(apps []map[string]interface{}) ([]*AppInfo,
224241
MobileSupported: mobileSupported,
225242
RequiredGpu: requiredGPU,
226243
DefaultThirdLevelDomainConfig: defaultThirdLevelDomainConfig,
244+
SharedEntrances: appSharedEntrances,
227245
})
228246

229247
}

pkg/app_service/v1/types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package app_service
22

33
import (
4-
appv1 "bytetrade.io/web3os/bfl/internal/ingress/api/app.bytetrade.io/v1alpha1"
54
"time"
65

6+
appv1 "bytetrade.io/web3os/bfl/internal/ingress/api/app.bytetrade.io/v1alpha1"
7+
78
k8sv1 "k8s.io/api/apps/v1"
89
)
910

@@ -26,6 +27,7 @@ type AppInfo struct {
2627
IsClusterScoped bool `json:"isClusterScoped"`
2728
MobileSupported bool `json:"mobileSupported"`
2829
DefaultThirdLevelDomainConfig string `json:"defaultThirdLevelDomainConfig"`
30+
SharedEntrances []Entrance `json:"sharedEntrances,omitempty"`
2931
}
3032

3133
type Entrance struct {

0 commit comments

Comments
 (0)