Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add rootPath for helm values #103

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/appinstaller/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"bytetrade.io/web3os/app-service/pkg/kubesphere"
"bytetrade.io/web3os/app-service/pkg/tapr"
"bytetrade.io/web3os/app-service/pkg/users/userspace"
userspacev1 "bytetrade.io/web3os/app-service/pkg/users/userspace/v1"
"bytetrade.io/web3os/app-service/pkg/utils"

"github.com/emicklei/go-restful/v3"
Expand Down Expand Up @@ -463,6 +464,13 @@ func (h *HelmOps) setValues() (values map[string]interface{}, err error) {
return values, err
}
values["admin"] = admin

rootPath := userspacev1.DefaultRootPath
if os.Getenv(userspacev1.OlaresRootPath) != "" {
rootPath = os.Getenv(userspacev1.OlaresRootPath)
}
values["rootPath"] = rootPath

return values, err
}

Expand Down
13 changes: 12 additions & 1 deletion pkg/users/userspace/v1/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ type Creator struct {
const (
USER_SPACE_ROLE = "admin"
MAX_RAND_INT = 1000000
OlaresRootPath = "OLARES_ROOT_DIR"
DefaultRootPath = "/olares"
)

var (
Expand Down Expand Up @@ -197,6 +199,11 @@ func (c *Creator) installSysApps(ctx context.Context, bflPod *corev1.Pod) error
"username": c.user,
},
}
rootPath := DefaultRootPath
if os.Getenv(OlaresRootPath) != "" {
rootPath = os.Getenv(OlaresRootPath)
}
vals["rootPath"] = rootPath

pvcData, err := c.findPVC(ctx, bflPod.Namespace)
if err != nil {
Expand Down Expand Up @@ -287,7 +294,11 @@ func (c *Creator) installLauncher(ctx context.Context, userspace string) (string
"appKey": k,
"appSecret": s,
}

rootPath := DefaultRootPath
if os.Getenv(OlaresRootPath) != "" {
rootPath = os.Getenv(OlaresRootPath)
}
vals["rootPath"] = rootPath
name := helm.ReleaseName("launcher", c.user)
err := helm.InstallCharts(ctx, c.helmCfg.ActionCfg, c.helmCfg.Settings, name, constants.UserChartsPath+"/launcher", "", userspace, vals)
if err != nil {
Expand Down
Loading