continue beOS rebrand and add native verification
Some checks failed
Native Verification / Build Docs (pull_request) Successful in 1m12s
Native Verification / Build App-Service Native (pull_request) Successful in 1m27s
Native Verification / Build Daemon Native (pull_request) Successful in 42s
Lint and Test Charts / lint-test (pull_request_target) Failing after 19s
Lint and Test Charts / test-version (pull_request_target) Successful in 0s
Lint and Test Charts / push-image (pull_request_target) Failing after 15s
Lint and Test Charts / upload-cli (pull_request_target) Failing after 1m15s
Lint and Test Charts / upload-daemon (pull_request_target) Failing after 1m12s
Lint and Test Charts / push-deps (pull_request_target) Has been skipped
Lint and Test Charts / push-deps-arm64 (pull_request_target) Has been skipped
Lint and Test Charts / push-image-arm64 (pull_request_target) Has been cancelled
Lint and Test Charts / upload-package (pull_request_target) Has been cancelled
Lint and Test Charts / install-test (pull_request_target) Has been cancelled

This commit is contained in:
2026-03-10 13:48:45 +01:00
parent 3e07c556c5
commit df38148149
432 changed files with 2410 additions and 1642 deletions

View File

@@ -0,0 +1,85 @@
name: Native Verification
on:
push:
branches:
- main
- release-*
paths:
- .gitea/workflows/native-verification.yaml
- daemon/**
- framework/app-service/**
- docs/**
- build/verify-native-in-container.sh
pull_request:
paths:
- .gitea/workflows/native-verification.yaml
- daemon/**
- framework/app-service/**
- docs/**
- build/verify-native-in-container.sh
workflow_dispatch:
jobs:
docs-build:
name: Build Docs
runs-on: ubuntu-latest
defaults:
run:
working-directory: docs
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install docs dependencies
run: npm ci
- name: Build docs
run: npm run build
appservice-native-build:
name: Build App-Service Native
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24.11'
- name: Install native dependencies
run: |
sudo apt-get update
sudo apt-get install -y btrfs-progs libbtrfs-dev
- name: Build app-service
run: go build ./...
working-directory: framework/app-service
daemon-native-build:
name: Build Daemon Native
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24.11'
- name: Install native dependencies
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev libpcap-dev
- name: Build daemon
run: go build ./cmd/...
working-directory: daemon

View File

@@ -24,9 +24,9 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y btrfs-progs libbtrfs-dev
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.24.6'
go-version: '1.24.11'
- run: make build
working-directory: framework/app-service

View File

@@ -0,0 +1,88 @@
name: Native Verification
on:
push:
branches:
- main
- 'release-*'
paths:
- '.github/workflows/native-verification.yaml'
- 'daemon/**'
- 'framework/app-service/**'
- 'docs/**'
pull_request:
paths:
- '.github/workflows/native-verification.yaml'
- 'daemon/**'
- 'framework/app-service/**'
- 'docs/**'
workflow_dispatch:
permissions:
contents: read
jobs:
docs-build:
name: Build Docs
runs-on: ubuntu-24.04
defaults:
run:
working-directory: docs
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm
cache-dependency-path: docs/package-lock.json
- name: Install docs dependencies
run: npm ci
- name: Build docs
run: npm run build
appservice-native-build:
name: Build App-Service Native
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24.11'
- name: Install native dependencies
run: |
sudo apt-get update
sudo apt-get install -y btrfs-progs libbtrfs-dev
- name: Build app-service
run: go build ./...
working-directory: framework/app-service
daemon-native-build:
name: Build Daemon Native
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24.11'
- name: Install native dependencies
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev libpcap-dev
- name: Build daemon
run: go build ./cmd/...
working-directory: daemon

View File

@@ -35,11 +35,15 @@ if [[ "${REPO_PATH}" != "" && "$REPO_PATH" != "/" ]]; then
fi
find $BASE_DIR/../ -type f -name Olares.yaml | while read f; do
find $BASE_DIR/../ -type f \( -name BeOS.yaml -o -name Olares.yaml \) | while read f; do
if [[ "$f" == *"/vendor/"* ]]; then
echo "skip vendor file $f"
continue
fi
if [[ "$f" == *"/Olares.yaml"* && -f "${f%Olares.yaml}BeOS.yaml" ]]; then
echo "skip legacy manifest $f"
continue
fi
echo "Processing $f"
declare -a bins
IFS=

View File

@@ -0,0 +1,68 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
require_docker() {
if ! command -v docker >/dev/null 2>&1; then
echo "docker is required" >&2
exit 1
fi
}
run_docs() {
echo "==> Building docs in container"
docker run --rm \
-v "$ROOT_DIR/docs":/src:ro \
node:20-bookworm \
bash -lc 'cp -a /src /tmp/docs && cd /tmp/docs && npm ci && npm run build'
}
run_appservice() {
echo "==> Building app-service in container"
docker run --rm \
-v "$ROOT_DIR":/src:ro \
-w /src/framework/app-service \
golang:1.24-bookworm \
bash -lc 'export PATH=/usr/local/go/bin:$PATH GOFLAGS=-buildvcs=false && apt-get update && apt-get install -y btrfs-progs libbtrfs-dev && go build ./...'
}
run_daemon() {
echo "==> Building daemon in container"
docker run --rm \
-v "$ROOT_DIR":/src:ro \
-w /src/daemon \
golang:1.24-bookworm \
bash -lc 'export PATH=/usr/local/go/bin:$PATH GOFLAGS=-buildvcs=false && apt-get update && apt-get install -y libudev-dev libpcap-dev && go build ./cmd/...'
}
main() {
require_docker
local targets=("$@")
if [ ${#targets[@]} -eq 0 ] || { [ ${#targets[@]} -eq 1 ] && [ "${targets[0]}" = "all" ]; }; then
targets=(docs app-service daemon)
fi
local target
for target in "${targets[@]}"; do
case "$target" in
docs)
run_docs
;;
app-service|appservice)
run_appservice
;;
daemon)
run_daemon
;;
*)
echo "unknown target: $target" >&2
exit 1
;;
esac
done
}
main "$@"

View File

@@ -1,8 +1,8 @@
project_name: olares-cli
project_name: beos-cli
builds:
- env:
- CGO_ENABLED=0
binary: olares-cli
binary: beos-cli
main: ./cmd/main.go
goos:
- linux
@@ -26,14 +26,14 @@ builds:
ldflags:
- -s
- -w
- -X github.com/beclab/Olares/cli/version.VERSION={{ .Version }}
- -X github.com/beclab/beOS Pro/cli/version.VERSION={{ .Version }}
- >-
{{- if index .Env "OLARES_VENDOR_TYPE" }}
-X github.com/beclab/Olares/cli/version.VENDOR={{ .Env.OLARES_VENDOR_TYPE }}
-X github.com/beclab/beOS Pro/cli/version.VENDOR={{ .Env.OLARES_VENDOR_TYPE }}
{{- end }}
- >-
{{- if index .Env "OLARES_VENDOR_REPO_PATH" }}
-X github.com/beclab/Olares/cli/version.VENDOR_REPO_PATH={{ .Env.OLARES_VENDOR_REPO_PATH }}
-X github.com/beclab/beOS Pro/cli/version.VENDOR_REPO_PATH={{ .Env.OLARES_VENDOR_REPO_PATH }}
{{- end }}
dist: ./output
archives:

View File

@@ -29,7 +29,7 @@ func AddVersionFlagBy(flagSetter CommandFlagSetter) {
flagSetter.Add(common.FlagVersion,
"v",
version.VERSION,
"Set Olares version, e.g., 1.10.0, 1.10.0-20241109",
"Set beOS version, e.g., 1.10.0, 1.10.0-20241109",
)
}
@@ -37,7 +37,7 @@ func AddBaseDirFlagBy(flagSetter CommandFlagSetter) {
flagSetter.Add(common.FlagBaseDir,
"b",
"",
"Set Olares package base dir, defaults to $HOME/"+cc.DefaultBaseDir,
"Set beOS package base dir, defaults to $HOME/"+cc.DefaultBaseDir,
)
}
@@ -60,8 +60,8 @@ func AddKubeTypeFlagBy(flagSetter CommandFlagSetter) {
func AddCDNServiceFlagBy(flagSetter CommandFlagSetter) {
flagSetter.Add(common.FlagCDNService,
"",
cc.DefaultOlaresCDNService,
"Set the CDN accelerated download address in the format https://cdn.olares.cn. If not set, the default download address will be used",
cc.DefaultBeOSCDNService,
"Set an optional CDN download address in the format https://cdn.example.com. If not set, configured defaults will be used",
).WithEnv(common.ENV_OLARES_CDN_SERVICE)
}

View File

@@ -18,7 +18,7 @@ import (
// 2) Enable viper to read environment variables
// 3) Bind environment variables for all known keys we care about
func Init() {
godotenv.Load(common.OlaresReleaseFile)
godotenv.Load(common.BeOSReleaseFile)
viper.SetEnvPrefix("OLARES")
viper.SetEnvKeyReplacer(envKeyReplacer)
viper.AutomaticEnv()

View File

@@ -12,5 +12,3 @@ func NewCmdAmdGpu() *cobra.Command {
cmd.AddCommand(NewCmdAmdGpuStatus())
return cmd
}

View File

@@ -14,7 +14,7 @@ import (
"github.com/spf13/cobra"
)
const defaultOlaresVGName = "olares-vg"
const defaultBeOSVGName = "beos-vg"
func NewExtendDiskCommand() *cobra.Command {
cmd := &cobra.Command{
@@ -196,7 +196,7 @@ func selectExtendingLV(vgName string, lvs []*lvm.LvItem) (string, error) {
return lvs[0].LvName, nil
}
if vgName == defaultOlaresVGName {
if vgName == defaultBeOSVGName {
selectedLv := ""
for _, lv := range lvs {
if lv.LvName == "root" {

View File

@@ -10,7 +10,7 @@ import (
func NewCmdDisableGpu() *cobra.Command {
cmd := &cobra.Command{
Use: "disable",
Short: "Disable GPU drivers for Olares node",
Short: "Disable GPU drivers for beOS node",
Run: func(cmd *cobra.Command, args []string) {
if err := pipelines.DisableGpuNode(); err != nil {
log.Fatalf("error: %v", err)

View File

@@ -19,5 +19,3 @@ func NewCmdDisableNouveau() *cobra.Command {
}
return cmd
}

View File

@@ -10,7 +10,7 @@ import (
func NewCmdEnableGpu() *cobra.Command {
cmd := &cobra.Command{
Use: "enable",
Short: "Enable GPU drivers for Olares node",
Short: "Enable GPU drivers for beOS node",
Run: func(cmd *cobra.Command, args []string) {
if err := pipelines.EnableGpuNode(); err != nil {
log.Fatalf("error: %v", err)

View File

@@ -11,7 +11,7 @@ import (
func NewCmdInstallGpu() *cobra.Command {
cmd := &cobra.Command{
Use: "install",
Short: "Install GPU drivers for Olares",
Short: "Install GPU drivers for beOS Pro",
Run: func(cmd *cobra.Command, args []string) {
if err := pipelines.InstallGpuDrivers(); err != nil {
log.Fatalf("error: %v", err)

View File

@@ -10,7 +10,7 @@ import (
func NewCmdUninstallpu() *cobra.Command {
cmd := &cobra.Command{
Use: "uninstall",
Short: "uninstall GPU drivers for Olares",
Short: "uninstall GPU drivers for beOS Pro",
Run: func(cmd *cobra.Command, args []string) {
if err := pipelines.UninstallGpuDrivers(); err != nil {
log.Fatalf("error: %v", err)

View File

@@ -12,7 +12,7 @@ import (
func NewCmdChangeIP() *cobra.Command {
cmd := &cobra.Command{
Use: "change-ip",
Short: "change The IP address of Olares OS",
Short: "change The IP address of beOS Pro",
Run: func(cmd *cobra.Command, args []string) {
if err := pipelines.ChangeIPPipeline(); err != nil {
log.Fatalf("error: %v", err)

View File

@@ -12,7 +12,7 @@ import (
func NewCmdRootDownload() *cobra.Command {
rootDownloadCmd := &cobra.Command{
Use: "download",
Short: "Download the packages and components needed to install Olares",
Short: "Download the packages and components needed to install beOS Pro",
}
rootDownloadCmd.AddCommand(NewCmdCheckDownload())
@@ -25,7 +25,7 @@ func NewCmdRootDownload() *cobra.Command {
func NewCmdDownload() *cobra.Command {
cmd := &cobra.Command{
Use: "component",
Short: "Download the packages and components needed to install Olares",
Short: "Download the packages and components needed to install beOS Pro",
Run: func(cmd *cobra.Command, args []string) {
if err := pipelines.DownloadInstallationPackage(); err != nil {
@@ -45,7 +45,7 @@ func NewCmdDownload() *cobra.Command {
func NewCmdDownloadWizard() *cobra.Command {
cmd := &cobra.Command{
Use: "wizard",
Short: "Download the Olares installation wizard",
Short: "Download the beOS installation wizard",
Run: func(cmd *cobra.Command, args []string) {
if err := pipelines.DownloadInstallationWizard(); err != nil {
@@ -67,7 +67,7 @@ func NewCmdDownloadWizard() *cobra.Command {
func NewCmdCheckDownload() *cobra.Command {
cmd := &cobra.Command{
Use: "check",
Short: "Check Downloaded Olares Installation Package",
Short: "Check Downloaded beOS Pro Installation Package",
Run: func(cmd *cobra.Command, args []string) {
if err := pipelines.CheckDownloadInstallationPackage(); err != nil {

View File

@@ -8,7 +8,7 @@ import (
func NewCmdPrintInfo() *cobra.Command {
cmd := &cobra.Command{
Use: "info",
Short: "Print Olares info",
Short: "Print beOS Pro info",
Run: func(cmd *cobra.Command, args []string) {
pipelines.PrintTerminusInfo()
},

View File

@@ -12,7 +12,7 @@ import (
func NewCmdInstallOs() *cobra.Command {
cmd := &cobra.Command{
Use: "install",
Short: "Install Olares",
Short: "Install beOS Pro",
Run: func(cmd *cobra.Command, args []string) {
if err := pipelines.CliInstallTerminusPipeline(); err != nil {
log.Fatalf("error: %v", err)
@@ -23,17 +23,17 @@ func NewCmdInstallOs() *cobra.Command {
flagSetter.Add(common.FlagOSUserName,
"",
"",
"Set the username for the Olares instance, if not set, will be prompted for input",
"Set the username for the beOS Pro instance, if not set, will be prompted for input",
).WithEnv(common.EnvLegacyOSUserName)
flagSetter.Add(common.FlagOSDomainName,
"",
"",
"Set the domain name for the Olares instance, if not set, will be prompted for input",
"Set the domain name for the beOS Pro instance, if not set, will be prompted for input",
).WithEnv(common.EnvLegacyOSDomainName)
flagSetter.Add(common.FlagOSPassword,
"",
"",
"Set the inital password for the first user of the Olares instance, if not set, a randomly generated password will be used",
"Set the inital password for the first user of the beOS Pro instance, if not set, a randomly generated password will be used",
)
flagSetter.Add(common.FlagEnableReverseProxy,
"",
@@ -43,7 +43,7 @@ func NewCmdInstallOs() *cobra.Command {
flagSetter.Add(common.FlagEnableJuiceFS,
"",
false,
"Use JuiceFS as the rootfs for Olares workloads, rather than the local disk.",
"Use JuiceFS as the rootfs for beOS workloads, rather than the local disk.",
).WithAlias(common.FlagLegacyEnableJuiceFS).WithEnv(common.EnvLegacyEnableJuiceFS)
flagSetter.Add(common.FlagEnablePodSwap,
"",

View File

@@ -43,7 +43,7 @@ type LogCollectOptions struct {
SkipKubeAPISserver bool
}
var servicesToCollectLogs = []string{"k3s", "containerd", "olaresd", "kubelet", "juicefs", "redis", "minio", "etcd", "NetworkManager"}
var servicesToCollectLogs = []string{"k3s", "containerd", "beosd", "olaresd", "kubelet", "juicefs", "redis", "minio", "etcd", "NetworkManager"}
// setSkipIfK8sNotReachable checks if the Kubernetes API server port is reachable
// and automatically sets skip-kube-apiserver to true if not reachable
@@ -124,9 +124,9 @@ func collectLogs(options *LogCollectOptions) error {
return fmt.Errorf("failed to collect kubernetes logs: %v", err)
}
fmt.Println("collecting olares-cli logs...")
if err := collectOlaresCLILogs(tw, options); err != nil {
return fmt.Errorf("failed to collect OlaresCLI logs: %v", err)
fmt.Println("collecting beos-cli logs...")
if err := collectBeOSCLILogs(tw, options); err != nil {
return fmt.Errorf("failed to collect BeOSCLI logs: %v", err)
}
fmt.Println("collecting network configs...")
@@ -138,14 +138,14 @@ func collectLogs(options *LogCollectOptions) error {
return nil
}
func collectOlaresCLILogs(tw *tar.Writer, options *LogCollectOptions) error {
func collectBeOSCLILogs(tw *tar.Writer, options *LogCollectOptions) error {
basedir, err := getBaseDir()
if err != nil {
return err
}
cliLogDir := filepath.Join(basedir, "logs")
if _, err := os.Stat(cliLogDir); err != nil {
fmt.Printf("warning: directory %s does not exist, skipping collecting olares-cli logs\n", cliLogDir)
fmt.Printf("warning: directory %s does not exist, skipping collecting beos-cli logs\n", cliLogDir)
return nil
}
err = filepath.Walk(cliLogDir, func(path string, info os.FileInfo, err error) error {
@@ -169,7 +169,7 @@ func collectOlaresCLILogs(tw *tar.Writer, options *LogCollectOptions) error {
}
header := &tar.Header{
Name: filepath.Join("olares-cli", relPath),
Name: filepath.Join("beos-cli", relPath),
Mode: 0644,
Size: info.Size(),
ModTime: info.ModTime(),
@@ -185,7 +185,7 @@ func collectOlaresCLILogs(tw *tar.Writer, options *LogCollectOptions) error {
return nil
})
if err != nil {
return fmt.Errorf("failed to collect olares-cli logs from %s: %v", cliLogDir, err)
return fmt.Errorf("failed to collect beos-cli logs from %s: %v", cliLogDir, err)
}
return nil
}
@@ -652,16 +652,16 @@ func NewCmdLogs() *cobra.Command {
cmd := &cobra.Command{
Use: "logs",
Short: "Collect logs from all Olares system components",
Long: `Collect logs from various Olares system components, that may or may not be installed on this machine, including:
Short: "Collect logs from all beOS Pro system components",
Long: `Collect logs from various beOS Pro system components, that may or may not be installed on this machine, including:
- K3s/Kubelet logs
- Containerd logs
- JuiceFS logs
- Redis logs
- MinIO logs
- etcd logs
- Olaresd logs
- olares-cli logs
- BeOSd logs
- beos-cli logs
- network configurations
- Kubernetes pod info and logs
- Kubernetes node info`,
@@ -675,7 +675,7 @@ func NewCmdLogs() *cobra.Command {
cmd.Flags().StringVar(&options.Since, "since", options.Since, "Only return logs newer than a relative duration like 5s, 2m, or 3h, to limit the log file")
cmd.Flags().IntVar(&options.MaxLines, "max-lines", options.MaxLines, "Maximum number of lines to collect per log source, to limit the log file size")
cmd.Flags().StringVar(&options.OutputDir, "output-dir", options.OutputDir, "Directory to store collected logs, will be created if not existing")
cmd.Flags().StringSliceVar(&options.Components, "components", nil, "Specific components (systemd service) to collect logs from (comma-separated). If empty, collects from all Olares-related components that can be found")
cmd.Flags().StringSliceVar(&options.Components, "components", nil, "Specific components (systemd service) to collect logs from (comma-separated). If empty, collects from all beOS-related components that can be found")
cmd.Flags().BoolVar(&options.IgnoreKubeErrors, "ignore-kube-errors", options.IgnoreKubeErrors, "Continue collecting logs even if kubectl commands fail")
cmd.Flags().BoolVar(&options.SkipKubeAPISserver, "skip-kube-apiserver", options.SkipKubeAPISserver, "Skip retrieving logs from kube-apiserver, it's automatically set if apiserver is not reachable. To tolerate other cases, set the ignore-kube-errors")

View File

@@ -21,7 +21,7 @@ import (
func NewCmdRelease() *cobra.Command {
cmd := &cobra.Command{
Use: "release",
Short: "Build release based on a local Olares repository",
Short: "Build release based on a local beOS repository",
Run: func(cmd *cobra.Command, args []string) {
baseDir := viper.GetString(common.FlagBaseDir)
version := viper.GetString(common.FlagVersion)
@@ -35,7 +35,7 @@ func NewCmdRelease() *cobra.Command {
os.Exit(1)
}
if !strings.HasPrefix(strings.ToLower(filepath.Base(cwd)), "olares") {
fmt.Println("error: please run release command under the root path of Olares repo")
fmt.Println("error: please run release command under the root path of beOS repo")
os.Exit(1)
}
if baseDir == "" {

View File

@@ -12,9 +12,9 @@ import (
func NewCmdStart() *cobra.Command {
cmd := &cobra.Command{
Use: "start",
Short: "Start the Olares OS",
Short: "Start the beOS Pro",
Run: func(cmd *cobra.Command, args []string) {
if err := pipelines.StartOlares(); err != nil {
if err := pipelines.StartBeOS(); err != nil {
log.Fatalf("error: %v", err)
}
},
@@ -29,9 +29,9 @@ func NewCmdStop() *cobra.Command {
)
cmd := &cobra.Command{
Use: "stop",
Short: "Stop the Olares OS",
Short: "Stop the beOS Pro",
Run: func(cmd *cobra.Command, args []string) {
if err := pipelines.StopOlares(timeout, checkInterval); err != nil {
if err := pipelines.StopBeOS(timeout, checkInterval); err != nil {
log.Fatalf("error: %v", err)
}
},

View File

@@ -11,7 +11,7 @@ import (
func NewCmdInstallStorage() *cobra.Command {
cmd := &cobra.Command{
Use: "storage",
Short: "install a storage backend for the Olares shared filesystem, or in the case of external storage, validate the config",
Short: "install a storage backend for the beOS Pro shared filesystem, or in the case of external storage, validate the config",
Run: func(cmd *cobra.Command, args []string) {
if err := pipelines.CliInstallStoragePipeline(); err != nil {
log.Fatalf("error: %v", err)

View File

@@ -14,7 +14,7 @@ import (
func NewCmdUninstallOs() *cobra.Command {
cmd := &cobra.Command{
Use: "uninstall",
Short: "Uninstall Olares",
Short: "Uninstall beOS Pro",
Run: func(cmd *cobra.Command, args []string) {
err := pipelines.UninstallTerminusPipeline()
if err != nil {
@@ -31,7 +31,7 @@ func NewCmdUninstallOs() *cobra.Command {
// these two flags' names are too general, and only used in cmd options, so we manually bind them to the viper
// inside the pipeline creator, it still uses the flag vars to get the values
cmd.Flags().Bool("all", false, "Uninstall Olares completely, including prepared dependencies")
cmd.Flags().Bool("all", false, "Uninstall beOS Pro completely, including prepared dependencies")
viper.BindPFlag(common.FlagUninstallAll, cmd.Flags().Lookup("all"))
cmd.Flags().String("phase", cluster.PhaseInstall.String(), "Uninstall from a specified phase and revert to the previous one. For example, using --phase install will remove the tasks performed in the 'install' phase, effectively returning the system to the 'prepare' state.")
viper.BindPFlag(common.FlagUninstallPhase, cmd.Flags().Lookup("phase"))

View File

@@ -18,9 +18,9 @@ import (
func NewCmdUpgradeOs() *cobra.Command {
cmd := &cobra.Command{
Use: "upgrade",
Short: "Upgrade Olares to a newer version",
Short: "Upgrade beOS Pro to a newer version",
Run: func(cmd *cobra.Command, args []string) {
if err := pipelines.UpgradeOlaresPipeline(); err != nil {
if err := pipelines.UpgradeBeOSPipeline(); err != nil {
log.Fatalf("error: %v", err)
}
},
@@ -40,7 +40,7 @@ func NewCmdCurrentVersionUpgradeSpec() *cobra.Command {
cmd := &cobra.Command{
Use: "spec",
Aliases: []string{"current-spec"},
Short: fmt.Sprintf("Get the upgrade spec of the current olares-cli version (%s)", version.VERSION),
Short: fmt.Sprintf("Get the upgrade spec of the current beos-cli version (%s)", version.VERSION),
RunE: func(cmd *cobra.Command, args []string) error {
spec, err := upgrade.CurrentVersionSpec()
if err != nil {
@@ -62,7 +62,7 @@ func NewCmdUpgradeViable() *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
if baseVersionStr == "" {
var err error
baseVersionStr, err = phase.GetOlaresVersion()
baseVersionStr, err = phase.GetBeOSVersion()
if err != nil {
return err
}
@@ -84,14 +84,14 @@ func NewCmdUpgradeViable() *cobra.Command {
return nil
},
}
cmd.Flags().StringVarP(&baseVersionStr, "base", "b", "", "base version, defaults to the current Olares system's version")
cmd.Flags().StringVarP(&baseVersionStr, "base", "b", "", "base version, defaults to the current beOS Pro system's version")
return cmd
}
func NewCmdUpgradePrecheck() *cobra.Command {
cmd := &cobra.Command{
Use: "precheck",
Short: "Precheck Olares for Upgrade",
Short: "Precheck beOS Pro for Upgrade",
Run: func(cmd *cobra.Command, args []string) {
if err := pipelines.UpgradePreCheckPipeline(); err != nil {
log.Fatalf("error: %v", err)

View File

@@ -14,7 +14,7 @@ type activateUserOptions struct {
BflUrl string
VaultUrl string
Password string
OlaresId string
BeOSId string
ResetPassword string
Location string
@@ -27,11 +27,11 @@ type activateUserOptions struct {
func NewCmdActivateUser() *cobra.Command {
o := &activateUserOptions{}
cmd := &cobra.Command{
Use: "activate {Olares ID (e.g., user@example.com)}",
Use: "activate {beOS ID (e.g., user@example.com)}",
Short: "activate a new user",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
o.OlaresId = args[0]
o.BeOSId = args[0]
if err := o.Validate(); err != nil {
log.Fatal(err)
}
@@ -58,8 +58,8 @@ func (o *activateUserOptions) AddFlags(cmd *cobra.Command) {
}
func (o *activateUserOptions) Validate() error {
if o.OlaresId == "" {
return fmt.Errorf("Olares ID is required")
if o.BeOSId == "" {
return fmt.Errorf("beOS ID is required")
}
if o.Password == "" {
return fmt.Errorf("Password is required")
@@ -76,24 +76,24 @@ func (o *activateUserOptions) Validate() error {
func (c *activateUserOptions) Run() error {
log.Println("=== TermiPass CLI - User Bind Terminus ===")
localName := c.OlaresId
if strings.Contains(c.OlaresId, "@") {
localName = strings.Split(c.OlaresId, "@")[0]
localName := c.BeOSId
if strings.Contains(c.BeOSId, "@") {
localName = strings.Split(c.BeOSId, "@")[0]
}
log.Printf("Parameters:")
log.Printf(" BflUrl: %s", c.BflUrl)
log.Printf(" VaultUrl: %s", c.VaultUrl)
log.Printf(" Terminus Name: %s", c.OlaresId)
log.Printf(" Terminus Name: %s", c.BeOSId)
log.Printf(" Local Name: %s", localName)
log.Printf("Initializing global stores with mnemonic...")
err := wizard.InitializeGlobalStores(c.Mnemonic, c.OlaresId)
err := wizard.InitializeGlobalStores(c.Mnemonic, c.BeOSId)
if err != nil {
return fmt.Errorf("failed to initialize global stores: %v", err)
}
accessToken, err := wizard.UserBindTerminus(c.Mnemonic, c.BflUrl, c.VaultUrl, c.Password, c.OlaresId, localName)
accessToken, err := wizard.UserBindTerminus(c.Mnemonic, c.BflUrl, c.VaultUrl, c.Password, c.BeOSId, localName)
if err != nil {
return fmt.Errorf("user bind failed: %v", err)
}

View File

@@ -51,7 +51,7 @@ func NewCmdCreateUser() *cobra.Command {
func (o *createUserOptions) AddFlags(cmd *cobra.Command) {
cmd.Flags().StringVar(&o.displayName, "display-name", "", "display name (optional)")
cmd.Flags().StringVar(&o.domain, "domain", "", "domain (optional, defaults to the Olares system's domain)")
cmd.Flags().StringVar(&o.domain, "domain", "", "domain (optional, defaults to the beOS Pro system's domain)")
cmd.Flags().StringVarP(&o.role, "role", "r", "normal", "owner role (optional, one of owner, admin, normal)")
cmd.Flags().StringVarP(&o.memoryLimit, "memory-limit", "m", defaultMemoryLimit, "memory limit (optional)")
cmd.Flags().StringVarP(&o.cpuLimit, "cpu-limit", "c", defaultCPULimit, "cpu limit (optional)")
@@ -146,7 +146,7 @@ func (o *createUserOptions) Run() error {
log.Println("generated initial password:", password)
o.password = passwordEncrypted
} else {
o.password = utils.MD5(o.password + "@Olares2025")
o.password = utils.MD5(o.password + "@beOSPro2025")
}
olaresName := fmt.Sprintf("%s@%s", o.name, o.domain)

View File

@@ -23,13 +23,13 @@ import (
const (
resetNamespace = "os-framework"
resetServiceAccount = "olares-cli-sa"
resetServiceAccount = "beos-cli-sa"
resetServiceName = "auth-provider-svc"
resetServicePortName = "server"
defaultServicePort = 28080
passwordSaltSuffix = "@Olares2025"
passwordSaltSuffix = "@beOSPro2025"
authHeaderBearer = "Bearer "
cliAuthHeader = "Olares-CLI-Authorization"
cliAuthHeader = "BeOS-CLI-Authorization"
resetRequestPathTmpl = "http://%s:%d/cli/api/reset/%s/password"
)

View File

@@ -6,8 +6,8 @@ import (
"strconv"
"time"
"github.com/beclab/beos/framework/app-service/api/sys.bytetrade.io/v1alpha1"
iamv1alpha2 "github.com/beclab/api/iam/v1alpha2"
"github.com/beclab/beos/framework/app-service/api/sys.bytetrade.io/v1alpha1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/tools/clientcmd"

View File

@@ -65,7 +65,7 @@ func (t *InstallAmdRocm) Execute(runtime connector.Runtime) error {
rocmV, _ := connector.RocmVersion()
min := semver.MustParse("7.1.1")
if rocmV != nil && rocmV.LessThan(min) {
return fmt.Errorf("detected ROCm version %s, which is lower than required %s; please uninstall existing ROCm/AMDGPU components before installation with command: olares-cli amdgpu uninstall", rocmV.Original(), min.Original())
return fmt.Errorf("detected ROCm version %s, which is lower than required %s; please uninstall existing ROCm/AMDGPU components before installation with command: beos-cli amdgpu uninstall", rocmV.Original(), min.Original())
}
if rocmV != nil && rocmV.GreaterThan(min) {
logger.Warnf("Warning: detected ROCm version %s great than maximum tested version %s")

View File

@@ -229,7 +229,7 @@ func (n *NodeConfigureOS) Execute(runtime connector.Runtime) error {
}
// if running in docker container, /etc/hosts file is bind mounting, cannot be replaced via mv command
if !n.KubeConf.Arg.IsOlaresInContainer {
if !n.KubeConf.Arg.IsBeOSInContainer {
_, err1 := runtime.GetRunner().SudoCmd(fmt.Sprintf("hostnamectl set-hostname %s && sed -i '/^127.0.1.1/s/.*/127.0.1.1 %s/g' /etc/hosts", host.GetName(), host.GetName()), false, false)
if err1 != nil {
return errors.Wrap(errors.WithStack(err1), "Failed to override hostname")

View File

@@ -8,7 +8,7 @@ import (
var SwapServiceTmpl = template.Must(template.New("olares-swap.service").Parse(
dedent.Dedent(`[Unit]
Description=Olares Swap Configuring Service
Description=beOS Pro Swap Configuring Service
After=local-fs.target
StartLimitIntervalSec=0

View File

@@ -295,7 +295,7 @@ func (t *DisableLocalDNSTask) configResolvConf(runtime connector.Runtime) error
}
primaryDNSServer, secondaryDNSServer := "1.1.1.1", "114.114.114.114"
if strings.Contains(t.KubeConf.Arg.RegistryMirrors, common.OlaresRegistryMirrorHost) || strings.Contains(t.KubeConf.Arg.RegistryMirrors, common.OlaresRegistryMirrorHostLegacy) {
if strings.Contains(t.KubeConf.Arg.RegistryMirrors, common.BeOSRegistryMirrorHost) || strings.Contains(t.KubeConf.Arg.RegistryMirrors, common.BeOSRegistryMirrorHostLegacy) {
primaryDNSServer, secondaryDNSServer = secondaryDNSServer, primaryDNSServer
}

View File

@@ -115,7 +115,7 @@ func (t *RequiredPortsCheck) Check(runtime connector.Runtime) error {
defer l.Close()
}
if len(unbindablePorts) > 0 {
return fmt.Errorf("port %v required by Olares cannot be bound, you can check which process using the command `sudo netstat -tlnp`", unbindablePorts)
return fmt.Errorf("port %v required by beOS Pro cannot be bound, you can check which process using the command `sudo netstat -tlnp`", unbindablePorts)
}
return nil
}
@@ -135,14 +135,14 @@ func (t *ConflictingContainerdCheck) Check(runtime connector.Runtime) error {
return nil
}
fixMSG := "\nIf it is installed as a component of Docker, it should be uninstalled per the official doc https://docs.docker.com/engine/install/ubuntu/#uninstall-old-versions"
fixMSG += "\nIf it is left over from a previous installation of Olares, clean it up using the command `sudo olares-cli uninstall --all`"
fixMSG += "\nIf it is left over from a previous installation of beOS Pro, clean it up using the command `sudo beos-cli uninstall --all`"
containerdBin, err := util.GetCommand("containerd")
if err == nil && containerdBin != "" {
return fmt.Errorf("found existing containerd binary: %s, a containerd managed by Olares is required to ensure normal function%s", containerdBin, fixMSG)
return fmt.Errorf("found existing containerd binary: %s, a containerd managed by beOS Pro is required to ensure normal function%s", containerdBin, fixMSG)
}
containerdSocket := "/run/containerd/containerd.sock"
if util.IsExist(containerdSocket) {
return fmt.Errorf("found existing containerd socket: %s, a containerd managed by Olares is required to ensure normal function%s", containerdSocket, fixMSG)
return fmt.Errorf("found existing containerd socket: %s, a containerd managed by beOS Pro is required to ensure normal function%s", containerdSocket, fixMSG)
}
return nil
}
@@ -160,7 +160,7 @@ func (t *SystemdCheck) Check(runtime connector.Runtime) error {
if util.IsExist("/run/systemd/system") {
return nil
}
return errors.New("this system is not inited by systemd, which is required by Olares")
return errors.New("this system is not inited by systemd, which is required by beOS Pro")
}
type MasterNodeReadyCheck struct{}
@@ -288,7 +288,7 @@ func (t *NvidiaCardArchChecker) Check(runtime connector.Runtime) error {
return nil
}
if !slices.Contains(supportedArchs, arch) {
return fmt.Errorf("unsupported NVIDIA card %s of architecture: %s, Olares only supports the following architectures: %s", model, arch, strings.Join(supportedArchs, ", "))
return fmt.Errorf("unsupported NVIDIA card %s of architecture: %s, beOS Pro only supports the following architectures: %s", model, arch, strings.Join(supportedArchs, ", "))
}
return nil
}
@@ -326,7 +326,7 @@ func (n *NouveauChecker) Check(runtime connector.Runtime) error {
}
val := strings.TrimSpace(string(data))
if val == "1" || val == "-1" {
return fmt.Errorf("detected nouveau kernel module loaded with modeset=%s; this conflicts with the NVIDIA driver that Olares will install, please disable it by running `sudo olares-cli gpu disable-nouveau`, REBOOT your machine, and try again", val)
return fmt.Errorf("detected nouveau kernel module loaded with modeset=%s; this conflicts with the NVIDIA driver that beOS Pro will install, please disable it by running `sudo beos-cli gpu disable-nouveau`, REBOOT your machine, and try again", val)
}
return nil
}
@@ -411,7 +411,7 @@ func (r *RocmChecker) Check(runtime connector.Runtime) error {
min := semver.MustParse("7.1.1")
if curV.LessThan(min) {
return fmt.Errorf("detected ROCm version %s, which is lower than required %s; please uninstall existing ROCm/AMDGPU components before installation with command: olares-cli amdgpu uninstall", curV.Original(), min.Original())
return fmt.Errorf("detected ROCm version %s, which is lower than required %s; please uninstall existing ROCm/AMDGPU components before installation with command: beos-cli amdgpu uninstall", curV.Original(), min.Original())
}
return nil
}
@@ -424,7 +424,7 @@ type GreetingsTask struct {
}
func (h *GreetingsTask) Execute(runtime connector.Runtime) error {
_, err := runtime.GetRunner().Cmd("echo 'Greetings, Olares'", false, true)
_, err := runtime.GetRunner().Cmd("echo 'Greetings, beOS Pro'", false, true)
if err != nil {
return err
}
@@ -605,8 +605,8 @@ func (t *RemoveWSLChattr) Execute(runtime connector.Runtime) error {
return nil
}
var ErrUnsupportedCudaVersion = errors.New("unsupported cuda version, please uninstall it using the command `sudo olares-cli gpu uninstall`, REBOOT your machine, and try again")
var ErrUnsupportedCudaVersion = errors.New("unsupported cuda version, please uninstall it using the command `sudo beos-cli gpu uninstall`, REBOOT your machine, and try again")
var ErrKernelDriverUninstalledButRunning = errors.New("NVIDIA driver is uninstalled, but the kernel driver is still running, please REBOOT your machine, and try again")
var ErrNotInstalledByRunfile = errors.New("NVIDIA driver is installed, but not installed by runfile, please uninstall it using the command `sudo olares-cli gpu uninstall`, REBOOT your machine, and try again")
var ErrNotInstalledByRunfile = errors.New("NVIDIA driver is installed, but not installed by runfile, please uninstall it using the command `sudo beos-cli gpu uninstall`, REBOOT your machine, and try again")
var ErrDriverLibraryVersionMismatch = errors.New("NVIDIA driver is installed, but the library version with the running version is mismatched, please REBOOT your machine, and try again")
var supportedCudaVersions = []string{common.CurrentVerifiedCudaVersion}

View File

@@ -123,8 +123,8 @@ const (
)
const (
OlaresRegistryMirrorHost = "mirrors.joinolares.cn"
OlaresRegistryMirrorHostLegacy = "mirrors.jointerminus.cn"
BeOSRegistryMirrorHost = "mirrors.beos.local"
BeOSRegistryMirrorHostLegacy = "mirrors-legacy.beos.local"
)
const (
@@ -137,7 +137,7 @@ const (
TerminusStateFilePrepared = ".prepared"
TerminusStateFileInstalled = ".installed"
MasterHostConfigFile = "master.conf"
OlaresReleaseFile = "/etc/olares/release"
BeOSReleaseFile = "/etc/olares/release"
)
const (
@@ -308,5 +308,5 @@ func SetSystemEnv(key, value string) {
}
const (
HelmValuesKeyOlaresRootFSPath = "rootPath"
HelmValuesKeyBeOSRootFSPath = "rootPath"
)

View File

@@ -46,15 +46,15 @@ type KubeRuntime struct {
type Argument struct {
KubernetesVersion string `json:"kubernetes_version"`
OlaresVersion string `json:"olares_version"`
BeOSVersion string `json:"olares_version"`
SecurityEnhancement bool `json:"security_enhancement"`
InCluster bool `json:"in_cluster"`
ContainerManager string `json:"container_manager"`
Kubetype string `json:"kube_type"`
SystemInfo connector.Systems
RegistryMirrors string `json:"registry_mirrors"`
OlaresCDNService string `json:"olares_cdn_service"`
RegistryMirrors string `json:"registry_mirrors"`
BeOSCDNService string `json:"olares_cdn_service"`
// Swap config
*SwapConfig
@@ -84,7 +84,7 @@ type Argument struct {
ConsoleLogTruncate bool `json:"console_log_truncate"`
HostIP string `json:"host_ip"`
IsOlaresInContainer bool `json:"is_olares_in_container"`
IsBeOSInContainer bool `json:"is_olares_in_container"`
}
type SwapConfig struct {
@@ -199,7 +199,7 @@ func NewArgument() *Argument {
},
NetworkSettings: &NetworkSettings{},
RegistryMirrors: viper.GetString(FlagRegistryMirrors),
OlaresCDNService: viper.GetString(FlagCDNService),
BeOSCDNService: viper.GetString(FlagCDNService),
HostIP: viper.GetString(ENV_HOST_IP),
Environment: os.Environ(),
MasterHostConfig: &MasterHostConfig{},
@@ -208,8 +208,8 @@ func NewArgument() *Argument {
// default enable GPU unless explicitly set to "0"
arg.GPU.Enable = !strings.EqualFold(os.Getenv(ENV_LOCAL_GPU_ENABLE), "0")
arg.IsCloudInstance, _ = strconv.ParseBool(os.Getenv(ENV_TERMINUS_IS_CLOUD_VERSION))
arg.IsOlaresInContainer = os.Getenv(ENV_CONTAINER_MODE) == "oic"
si.IsOIC = arg.IsOlaresInContainer
arg.IsBeOSInContainer = os.Getenv(ENV_CONTAINER_MODE) == "oic"
si.IsOIC = arg.IsBeOSInContainer
si.ProductName = arg.GetProductName()
// Ensure BaseDir is initialized before loading master.conf
@@ -223,22 +223,22 @@ func (a *Argument) SaveReleaseInfo(withoutName bool) error {
if a.BaseDir == "" {
return errors.New("invalid: empty base directory")
}
if a.OlaresVersion == "" {
if a.BeOSVersion == "" {
return errors.New("invalid: empty olares version")
}
releaseInfoMap := map[string]string{
ENV_OLARES_BASE_DIR: a.BaseDir,
ENV_OLARES_VERSION: a.OlaresVersion,
ENV_OLARES_VERSION: a.BeOSVersion,
}
if !withoutName {
if a.User != nil && a.User.UserName != "" && a.User.DomainName != "" {
releaseInfoMap["OLARES_NAME"] = fmt.Sprintf("%s@%s", a.User.UserName, a.User.DomainName)
} else {
if util.IsExist(OlaresReleaseFile) {
if util.IsExist(BeOSReleaseFile) {
// if the user is not set, try to load the user name from the release file
envs, err := godotenv.Read(OlaresReleaseFile)
envs, err := godotenv.Read(BeOSReleaseFile)
if err == nil {
if userName, ok := envs["OLARES_NAME"]; ok {
releaseInfoMap["OLARES_NAME"] = userName
@@ -248,12 +248,12 @@ func (a *Argument) SaveReleaseInfo(withoutName bool) error {
}
}
if !util.IsExist(filepath.Dir(OlaresReleaseFile)) {
if err := os.MkdirAll(filepath.Dir(OlaresReleaseFile), 0755); err != nil {
return fmt.Errorf("failed to create directory %s: %v", filepath.Dir(OlaresReleaseFile), err)
if !util.IsExist(filepath.Dir(BeOSReleaseFile)) {
if err := os.MkdirAll(filepath.Dir(BeOSReleaseFile), 0755); err != nil {
return fmt.Errorf("failed to create directory %s: %v", filepath.Dir(BeOSReleaseFile), err)
}
}
return godotenv.Write(releaseInfoMap, OlaresReleaseFile)
return godotenv.Write(releaseInfoMap, BeOSReleaseFile)
}
func (a *Argument) GetWslUserPath() string {
@@ -278,12 +278,12 @@ func (a *Argument) GetWslUserPath() string {
return res
}
func (a *Argument) SetOlaresCDNService(url string) {
func (a *Argument) SetBeOSCDNService(url string) {
u := strings.TrimSuffix(url, "/")
if u == "" {
u = common.DefaultOlaresCDNService
u = common.DefaultBeOSCDNService
}
a.OlaresCDNService = u
a.BeOSCDNService = u
}
func (a *Argument) SetGPU(enable bool) {
@@ -293,7 +293,7 @@ func (a *Argument) SetGPU(enable bool) {
a.GPU.Enable = enable
}
func (a *Argument) SetOlaresVersion(version string) {
func (a *Argument) SetBeOSVersion(version string) {
if version == "" || len(version) <= 2 {
return
}
@@ -301,7 +301,7 @@ func (a *Argument) SetOlaresVersion(version string) {
if version[0] == 'v' {
version = version[1:]
}
a.OlaresVersion = version
a.BeOSVersion = version
}
func (a *Argument) SetStorage(storage *Storage) {
@@ -475,7 +475,7 @@ func NewKubeRuntime(arg Argument) (*KubeRuntime, error) {
}
base := connector.NewBaseRuntime(cluster.Name, connector.NewDialer(),
arg.BaseDir, arg.OlaresVersion, arg.ConsoleLogFileName, arg.ConsoleLogTruncate, arg.SystemInfo)
arg.BaseDir, arg.BeOSVersion, arg.ConsoleLogFileName, arg.ConsoleLogTruncate, arg.SystemInfo)
clusterSpec := &cluster.Spec
defaultCluster, roleGroups := clusterSpec.SetDefaultClusterSpec(arg.InCluster, arg.SystemInfo.IsDarwin())

View File

@@ -36,7 +36,7 @@ const (
WizardDir = "wizard"
ComponentsDir = "components"
DeployDir = "deploy"
OlaresDir = "olares"
BeOSDir = "olares"
DefaultBaseDir = ".beos-pro"
DefaultDomainName = "beos.local"
@@ -92,8 +92,8 @@ const (
)
const (
DefaultOlaresCDNService = ""
DefaultBashUrl = "beos.sh"
DefaultBeOSCDNService = ""
DefaultBashUrl = "beos.sh"
)
const (

View File

@@ -39,12 +39,12 @@ func (u *UninstallTerminusdModule) Init() {
}
}
type ReplaceOlaresdBinaryModule struct {
type ReplaceBeOSdBinaryModule struct {
common.KubeModule
manifest.ManifestModule
}
func (m *ReplaceOlaresdBinaryModule) Init() {
func (m *ReplaceBeOSdBinaryModule) Init() {
m.Name = "ReplaceBeOSdBinaryModule"
m.Desc = "Replace beosd"
@@ -63,7 +63,7 @@ func (m *ReplaceOlaresdBinaryModule) Init() {
updateEnv := &task.LocalTask{
Name: "UpdateBeOSdEnv",
Desc: "Update beosd env",
Action: new(UpdateOlaresdServiceEnv),
Action: new(UpdateBeOSdServiceEnv),
}
restart := &task.LocalTask{

View File

@@ -25,33 +25,36 @@ func (g *InstallTerminusdBinary) Execute(runtime connector.Runtime) error {
return err
}
binary, err := g.Manifest.Get("olaresd")
binary, err := g.Manifest.Get("beosd")
if err != nil {
return fmt.Errorf("get kube binary olaresd info failed: %w", err)
binary, err = g.Manifest.Get("olaresd")
}
if err != nil {
return fmt.Errorf("get kube binary beosd info failed: %w", err)
}
path := binary.FilePath(g.BaseDir)
dst := filepath.Join(common.TmpDir, binary.Filename)
if err := runtime.GetRunner().Scp(path, dst); err != nil {
return errors.Wrap(errors.WithStack(err), "sync olaresd tar.gz failed")
return errors.Wrap(errors.WithStack(err), "sync beosd tar.gz failed")
}
installCmd := fmt.Sprintf("tar -zxf %s && cp -f olaresd /usr/local/bin/beosd && cp -f olaresd /usr/local/bin/olaresd && chmod +x /usr/local/bin/beosd /usr/local/bin/olaresd && rm -rf olaresd*", dst)
installCmd := fmt.Sprintf("tar -zxf %s && src=$( [ -f beosd ] && printf beosd || printf olaresd ) && cp -f \"$src\" /usr/local/bin/beosd && cp -f \"$src\" /usr/local/bin/olaresd && chmod +x /usr/local/bin/beosd /usr/local/bin/olaresd && rm -rf beosd* olaresd*", dst)
if _, err := runtime.GetRunner().SudoCmd(installCmd, false, false); err != nil {
return errors.Wrap(errors.WithStack(err), "install beosd binaries failed")
}
return nil
}
type UpdateOlaresdServiceEnv struct {
type UpdateBeOSdServiceEnv struct {
common.KubeAction
}
func (a *UpdateOlaresdServiceEnv) Execute(runtime connector.Runtime) error {
func (a *UpdateBeOSdServiceEnv) Execute(runtime connector.Runtime) error {
envFilePath := filepath.Join("/etc/systemd/system/", templates.TerminusdEnv.Name())
versionKey := "INSTALLED_VERSION"
updateVersionCMD := fmt.Sprintf("sed -i '/%s/c\\%s=%s' %s ", versionKey, versionKey, a.KubeConf.Arg.OlaresVersion, envFilePath)
updateVersionCMD := fmt.Sprintf("sed -i '/%s/c\\%s=%s' %s ", versionKey, versionKey, a.KubeConf.Arg.BeOSVersion, envFilePath)
if _, err := runtime.GetRunner().SudoCmd(updateVersionCMD, false, false); err != nil {
return fmt.Errorf("update beosd env failed: %v", err)
}
@@ -65,11 +68,11 @@ type GenerateTerminusdServiceEnv struct {
func (g *GenerateTerminusdServiceEnv) Execute(runtime connector.Runtime) error {
var baseDir = runtime.GetBaseDir()
templateAction := action.Template{
Name: "OlaresdServiceEnv",
Name: "BeOSdServiceEnv",
Template: templates.TerminusdEnv,
Dst: filepath.Join("/etc/systemd/system/", templates.TerminusdEnv.Name()),
Data: util.Data{
"Version": g.KubeConf.Arg.OlaresVersion,
"Version": g.KubeConf.Arg.BeOSVersion,
"KubeType": g.KubeConf.Arg.Kubetype,
"RegistryMirrors": g.KubeConf.Arg.RegistryMirrors,
"BaseDir": baseDir,
@@ -91,7 +94,7 @@ type GenerateTerminusdService struct {
func (g *GenerateTerminusdService) Execute(runtime connector.Runtime) error {
templateAction := action.Template{
Name: "OlaresdService",
Name: "BeOSdService",
Template: templates.TerminusdService,
Dst: filepath.Join("/etc/systemd/system/", templates.TerminusdService.Name()),
Data: util.Data{},

View File

@@ -274,7 +274,7 @@ func NewKubeBinary(name, arch, osType, osVersion, osPlatformFamily, version, pre
component.Type = COMPONENT
component.FileName = fmt.Sprintf("redis-%s.tar.gz", version)
component.FileNameHash = utils.MD5(component.FileName)
component.Url = fmt.Sprintf(RedisUrl, common.DefaultOlaresCDNService, component.FileNameHash)
component.Url = fmt.Sprintf(RedisUrl, common.DefaultBeOSCDNService, component.FileNameHash)
component.CheckSum = false
component.BaseDir = filepath.Join(prePath, component.Type)
case juicefs:
@@ -330,21 +330,21 @@ func NewKubeBinary(name, arch, osType, osVersion, osPlatformFamily, version, pre
component.Type = GPU
component.FileName = fmt.Sprintf("%s_%s_cuda-keyring_%s-1_all.deb", osPlatformFamily, osVersion, version)
component.FileNameHash = utils.MD5(component.FileName)
component.Url = fmt.Sprintf(CudaKeyringCNDUrl, common.DefaultOlaresCDNService, getGpuCDNPrefix(arch, component.FileNameHash)) //getCudaKeyringUrl(arch, constants.OsVersion, version)
component.Url = fmt.Sprintf(CudaKeyringCNDUrl, common.DefaultBeOSCDNService, getGpuCDNPrefix(arch, component.FileNameHash)) //getCudaKeyringUrl(arch, constants.OsVersion, version)
component.CheckSum = false
component.BaseDir = filepath.Join(prePath, component.Type)
case gpgkey:
component.Type = GPU
component.FileName = "gpgkey"
component.FileNameHash = utils.MD5(component.FileName)
component.Url = fmt.Sprintf(CudaKeyringCNDUrl, common.DefaultOlaresCDNService, getGpuCDNPrefix(arch, component.FileNameHash))
component.Url = fmt.Sprintf(CudaKeyringCNDUrl, common.DefaultBeOSCDNService, getGpuCDNPrefix(arch, component.FileNameHash))
component.CheckSum = false
component.BaseDir = filepath.Join(prePath, component.Type)
case libnvidia:
component.Type = GPU
component.FileName = fmt.Sprintf("%s_%s_libnvidia-container.list", osPlatformFamily, osVersion)
component.FileNameHash = utils.MD5(component.FileName)
component.Url = fmt.Sprintf(CudaKeyringCNDUrl, common.DefaultOlaresCDNService, getGpuCDNPrefix(arch, component.FileNameHash))
component.Url = fmt.Sprintf(CudaKeyringCNDUrl, common.DefaultBeOSCDNService, getGpuCDNPrefix(arch, component.FileNameHash))
component.CheckSum = false
component.BaseDir = filepath.Join(prePath, component.Type)
case wsl: // + wsl
@@ -377,7 +377,7 @@ func NewKubeBinary(name, arch, osType, osVersion, osPlatformFamily, version, pre
func (b *KubeBinary) GetDownloadMirrors(downloadMirrors string) string {
if downloadMirrors == "" {
return common.DefaultOlaresCDNService
return common.DefaultBeOSCDNService
}
return downloadMirrors
}

View File

@@ -165,7 +165,7 @@ func (t *UpdateNvidiaContainerToolkitSource) Execute(runtime connector.Runtime)
// decide mirror based on OLARES_SYSTEM_CDN_SERVICE
var mirrorHost string
cdnService := t.KubeConf.Arg.OlaresCDNService
cdnService := t.KubeConf.Arg.BeOSCDNService
if cdnService != "" {
cdnRaw := cdnService
if !strings.HasPrefix(cdnRaw, "http") {
@@ -176,10 +176,10 @@ func (t *UpdateNvidiaContainerToolkitSource) Execute(runtime connector.Runtime)
if host == "" {
host = cdnService
}
if strings.HasSuffix(host, "olares.cn") {
if strings.HasSuffix(host, ".cn") {
mirrorHost = "mirrors.ustc.edu.cn"
}
} else if strings.HasSuffix(cdnService, "olares.cn") {
} else if strings.HasSuffix(cdnService, ".cn") {
mirrorHost = "mirrors.ustc.edu.cn"
}
}

View File

@@ -104,7 +104,7 @@ func (t *LoadImages) Execute(runtime connector.Runtime) (reserr error) {
// loadParm = "--snapshotter=zfs"
// }
if t.KubeConf.Arg.IsOlaresInContainer {
if t.KubeConf.Arg.IsBeOSInContainer {
loadParm = "--no-unpack"
}

View File

@@ -233,7 +233,7 @@ func (g *GenerateK3sService) Execute(runtime connector.Runtime) error {
"JuiceFSPreCheckEnabled": util.IsExist(storage.JuiceFsServiceFile),
"JuiceFSServiceUnit": storagetpl.JuicefsService.Name(),
"JuiceFSBinPath": storage.JuiceFsFile,
"JuiceFSMountPoint": storage.OlaresJuiceFSRootDir,
"JuiceFSMountPoint": storage.BeOSJuiceFSRootDir,
}
templateAction := action.Template{

View File

@@ -71,7 +71,7 @@ type GetKubeVersion struct{}
func (g *GetKubeVersion) Execute() (string, string, error) {
var kubectlpath, err = util.GetCommand(common.CommandKubectl)
if err != nil {
return "", "", fmt.Errorf("kubectl not found, Olares might not be installed.")
return "", "", fmt.Errorf("kubectl not found, beOS Pro might not be installed.")
}
var ctx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
@@ -224,7 +224,7 @@ func (t *GenerateKubeletService) Execute(runtime connector.Runtime) error {
"JuiceFSPreCheckEnabled": util.IsExist(storage.JuiceFsServiceFile),
"JuiceFSServiceUnit": storagetpl.JuicefsService.Name(),
"JuiceFSBinPath": storage.JuiceFsFile,
"JuiceFSMountPoint": storage.OlaresJuiceFSRootDir,
"JuiceFSMountPoint": storage.BeOSJuiceFSRootDir,
},
}
return tplActions.Execute(runtime)

View File

@@ -232,12 +232,12 @@ func (t *CreateSharedPathInMiniKubeContainer) Execute(runtime connector.Runtime)
if err != nil {
return fmt.Errorf("failed to get minikube command: %w", err)
}
createCMD := fmt.Sprintf("%s ssh 'sudo mkdir -p %s' -p %s", minikube, storage.OlaresSharedLibDir, t.KubeConf.Arg.MinikubeProfile)
createCMD := fmt.Sprintf("%s ssh 'sudo mkdir -p %s' -p %s", minikube, storage.BeOSSharedLibDir, t.KubeConf.Arg.MinikubeProfile)
_, err = runtime.GetRunner().Cmd(createCMD, false, false)
if err != nil {
return fmt.Errorf("failed to create shared path in minikube container: %w", err)
}
chownCMD := fmt.Sprintf("%s ssh 'sudo chown 1000:1000 %s' -p %s", minikube, storage.OlaresSharedLibDir, t.KubeConf.Arg.MinikubeProfile)
chownCMD := fmt.Sprintf("%s ssh 'sudo chown 1000:1000 %s' -p %s", minikube, storage.BeOSSharedLibDir, t.KubeConf.Arg.MinikubeProfile)
_, err = runtime.GetRunner().Cmd(chownCMD, false, false)
if err != nil {
return fmt.Errorf("failed to change ownership of shared path in minikube container: %w", err)

View File

@@ -15,7 +15,7 @@ func ChangeIP(runtime *common.KubeRuntime) *pipeline.Pipeline {
runtime.Arg.HostIP = si.GetLocalIp()
modules = []module.Module{&terminus.ChangeHostIPModule{}}
} else {
logger.Infof("changing the Olares OS IP to %s ...", si.GetLocalIp())
logger.Infof("changing the beOS Pro IP to %s ...", si.GetLocalIp())
modules = []module.Module{
&terminus.CheckPreparedModule{},
&terminus.CheckInstalledModule{},
@@ -24,7 +24,7 @@ func ChangeIP(runtime *common.KubeRuntime) *pipeline.Pipeline {
}
return &pipeline.Pipeline{
Name: "Change the IP address of Olares OS components",
Name: "Change the IP address of beOS Pro components",
Modules: modules,
Runtime: runtime,
}

View File

@@ -172,7 +172,7 @@ func UninstallTerminus(phase string, runtime *common.KubeRuntime) pipeline.Pipel
}
return pipeline.Pipeline{
Name: "Uninstall Olares",
Name: "Uninstall beOS Pro",
Runtime: builder.runtime,
Modules: builder.modules,
}

View File

@@ -27,6 +27,6 @@ type windowsUninstallPhaseBuilder struct {
func (w *windowsUninstallPhaseBuilder) build() []module.Module {
return []module.Module{
&windows.UninstallOlaresModule{},
&windows.UninstallBeOSModule{},
}
}

View File

@@ -15,7 +15,7 @@ func NewCheckDownload(mainifest string, runtime *common.KubeRuntime) *pipeline.P
}
return &pipeline.Pipeline{
Name: "Check Downloaded Olares Installation Package",
Name: "Check Downloaded beOS Pro Installation Package",
Modules: m,
Runtime: runtime,
}

View File

@@ -12,7 +12,7 @@ func NewDownloadPackage(mainifest string, runtime *common.KubeRuntime) *pipeline
m := []module.Module{
&precheck.GreetingsModule{},
&download.PackageDownloadModule{Manifest: mainifest, BaseDir: runtime.GetBaseDir(), CDNService: runtime.Arg.OlaresCDNService},
&download.PackageDownloadModule{Manifest: mainifest, BaseDir: runtime.GetBaseDir(), CDNService: runtime.Arg.BeOSCDNService},
}
return &pipeline.Pipeline{

View File

@@ -12,7 +12,7 @@ func NewDownloadWizard(runtime *common.KubeRuntime, urlOverride, releaseID strin
m := []module.Module{
&precheck.GreetingsModule{},
&terminus.InstallWizardDownloadModule{Version: runtime.Arg.OlaresVersion, CDNService: runtime.Arg.OlaresCDNService, UrlOverride: urlOverride, ReleaseID: releaseID},
&terminus.InstallWizardDownloadModule{Version: runtime.Arg.BeOSVersion, CDNService: runtime.Arg.BeOSCDNService, UrlOverride: urlOverride, ReleaseID: releaseID},
}
return &pipeline.Pipeline{

View File

@@ -5,8 +5,8 @@ import (
"github.com/beclab/beos/cli/pkg/terminus"
)
func GetOlaresVersion() (string, error) {
var terminusTask = &terminus.GetOlaresVersion{}
func GetBeOSVersion() (string, error) {
var terminusTask = &terminus.GetBeOSVersion{}
return terminusTask.Execute()
}

View File

@@ -13,11 +13,11 @@ import (
func AddNodePipeline() error {
arg := common.NewArgument()
if !arg.SystemInfo.IsLinux() {
fmt.Println("error: Only Linux nodes can be added to an Olares cluster!")
fmt.Println("error: Only Linux nodes can be added to an beOS Pro cluster!")
os.Exit(1)
}
arg.SetOlaresVersion(viper.GetString(common.FlagVersion))
arg.SetBeOSVersion(viper.GetString(common.FlagVersion))
arg.SetConsoleLog("addnode.log", true)
if err := arg.MasterHostConfig.Validate(); err != nil {

View File

@@ -14,11 +14,11 @@ func ChangeIPPipeline() error {
terminusVersion := viper.GetString(common.FlagVersion)
kubeType := phase.GetKubeType()
if terminusVersion == "" {
terminusVersion, _ = phase.GetOlaresVersion()
terminusVersion, _ = phase.GetBeOSVersion()
}
var arg = common.NewArgument()
arg.SetOlaresVersion(terminusVersion)
arg.SetBeOSVersion(terminusVersion)
arg.SetConsoleLog("changeip.log", true)
arg.SetKubeVersion(kubeType)
arg.SetMinikubeProfile(viper.GetString(common.FlagMiniKubeProfile))

View File

@@ -11,7 +11,7 @@ import (
func CheckDownloadInstallationPackage() error {
arg := common.NewArgument()
arg.SetOlaresVersion(viper.GetString(common.FlagVersion))
arg.SetBeOSVersion(viper.GetString(common.FlagVersion))
runtime, err := common.NewKubeRuntime(*arg)
if err != nil {

View File

@@ -13,15 +13,15 @@ import (
func DownloadInstallationPackage() error {
arg := common.NewArgument()
arg.SetOlaresVersion(viper.GetString(common.FlagVersion))
arg.SetOlaresCDNService(viper.GetString(common.FlagCDNService))
arg.SetBeOSVersion(viper.GetString(common.FlagVersion))
arg.SetBeOSCDNService(viper.GetString(common.FlagCDNService))
runtime, err := common.NewKubeRuntime(*arg)
if err != nil {
return err
}
if ok := utils.CheckUrl(arg.OlaresCDNService); !ok {
if ok := utils.CheckUrl(arg.BeOSCDNService); !ok {
return fmt.Errorf("invalid cdn service")
}

View File

@@ -12,15 +12,15 @@ import (
func DownloadInstallationWizard() error {
arg := common.NewArgument()
arg.SetOlaresVersion(viper.GetString(common.FlagVersion))
arg.SetOlaresCDNService(viper.GetString(common.FlagCDNService))
arg.SetBeOSVersion(viper.GetString(common.FlagVersion))
arg.SetBeOSCDNService(viper.GetString(common.FlagCDNService))
runtime, err := common.NewKubeRuntime(*arg)
if err != nil {
return err
}
if ok := utils.CheckUrl(arg.OlaresCDNService); !ok {
if ok := utils.CheckUrl(arg.BeOSCDNService); !ok {
return fmt.Errorf("invalid cdn service")
}

View File

@@ -14,7 +14,7 @@ import (
func InstallGpuDrivers() error {
arg := common.NewArgument()
arg.SetOlaresVersion(viper.GetString(common.FlagVersion))
arg.SetBeOSVersion(viper.GetString(common.FlagVersion))
arg.SetConsoleLog("gpuinstall.log", true)
runtime, err := common.NewKubeRuntime(*arg)
if err != nil {

View File

@@ -7,12 +7,12 @@ import (
)
func PrintTerminusInfo() {
var cli = &terminus.GetOlaresVersion{}
var cli = &terminus.GetBeOSVersion{}
terminusVersion, err := cli.Execute()
if err != nil {
fmt.Printf("Olares: not installed\n")
fmt.Printf("beOS Pro: not installed\n")
return
}
fmt.Printf("Olares: %s\n", terminusVersion)
fmt.Printf("beOS Pro: %s\n", terminusVersion)
}

View File

@@ -14,14 +14,14 @@ import (
)
func CliInstallTerminusPipeline() error {
var terminusVersion, _ = phase.GetOlaresVersion()
var terminusVersion, _ = phase.GetBeOSVersion()
if terminusVersion != "" {
return errors.New("Olares is already installed, please uninstall it first.")
return errors.New("beOS Pro is already installed, please uninstall it first.")
}
arg := common.NewArgument()
arg.SetKubeVersion(viper.GetString(common.FlagKubeType))
arg.SetOlaresVersion(viper.GetString(common.FlagVersion))
arg.SetBeOSVersion(viper.GetString(common.FlagVersion))
arg.SetMinikubeProfile(viper.GetString(common.FlagMiniKubeProfile))
arg.SetStorage(getStorageConfig())
arg.SetSwapConfig(common.SwapConfig{
@@ -49,7 +49,7 @@ func CliInstallTerminusPipeline() error {
runtime.Arg.SetManifest(manifest)
var p = cluster.InstallSystemPhase(runtime)
logger.InfoInstallationProgress("Start to Install Olares ...")
logger.InfoInstallationProgress("Start to Install beOS Pro ...")
if err := p.Start(); err != nil {
return err
}

View File

@@ -13,7 +13,7 @@ import (
func MasterInfoPipeline() error {
arg := common.NewArgument()
if !arg.SystemInfo.IsLinux() {
fmt.Println("error: Only Linux nodes can be added to an Olares cluster!")
fmt.Println("error: Only Linux nodes can be added to an beOS Pro cluster!")
os.Exit(1)
}
arg.SetConsoleLog("masterinfo.log", true)

View File

@@ -10,7 +10,7 @@ import (
func StartPreCheckPipeline() error {
var arg = common.NewArgument()
arg.SetOlaresVersion(viper.GetString(common.FlagVersion))
arg.SetBeOSVersion(viper.GetString(common.FlagVersion))
arg.SetConsoleLog("precheck.log", true)
runtime, err := common.NewKubeRuntime(*arg)

View File

@@ -22,7 +22,7 @@ import (
)
func PrepareSystemPipeline(components []string) error {
var terminusVersion, _ = phase.GetOlaresVersion()
var terminusVersion, _ = phase.GetBeOSVersion()
if terminusVersion != "" && len(components) == 0 {
return errors.New("beOS Pro is already installed; uninstall it first")
}
@@ -30,7 +30,7 @@ func PrepareSystemPipeline(components []string) error {
var arg = common.NewArgument()
arg.SetKubeVersion(viper.GetString(common.FlagKubeType))
arg.SetMinikubeProfile(viper.GetString(common.FlagMiniKubeProfile))
arg.SetOlaresVersion(viper.GetString(common.FlagVersion))
arg.SetBeOSVersion(viper.GetString(common.FlagVersion))
arg.SetStorage(getStorageConfig())
arg.ClearMasterHostConfig()
@@ -78,7 +78,7 @@ func PrepareSystemPipeline(components []string) error {
p := &pipeline.Pipeline{
Name: "Prepare beOS daemon",
Modules: []module.Module{
&daemon.ReplaceOlaresdBinaryModule{
&daemon.ReplaceBeOSdBinaryModule{
ManifestModule: manifest.ManifestModule{
Manifest: manifestMap,
BaseDir: runtime.GetBaseDir(),

View File

@@ -9,7 +9,7 @@ import (
"github.com/beclab/beos/cli/pkg/terminus"
)
func StartOlares() error {
func StartBeOS() error {
arg := common.NewArgument()
arg.SetConsoleLog("start.log", true)
runtime, err := common.NewKubeRuntime(*arg)
@@ -18,9 +18,9 @@ func StartOlares() error {
}
p := &pipeline.Pipeline{
Name: "StartOlares",
Name: "StartBeOS",
Modules: []module.Module{
&terminus.StartOlaresModule{},
&terminus.StartBeOSModule{},
},
Runtime: runtime,
}
@@ -28,7 +28,7 @@ func StartOlares() error {
return p.Start()
}
func StopOlares(timeout, checkInterval time.Duration) error {
func StopBeOS(timeout, checkInterval time.Duration) error {
arg := common.NewArgument()
arg.SetConsoleLog("stop.log", true)
runtime, err := common.NewKubeRuntime(*arg)
@@ -37,9 +37,9 @@ func StopOlares(timeout, checkInterval time.Duration) error {
}
p := &pipeline.Pipeline{
Name: "StopOlares",
Name: "StopBeOS",
Modules: []module.Module{
&terminus.StopOlaresModule{
&terminus.StopBeOSModule{
Timeout: timeout,
CheckInterval: checkInterval,
},

View File

@@ -12,13 +12,13 @@ import (
)
func CliInstallStoragePipeline() error {
var terminusVersion, _ = phase.GetOlaresVersion()
var terminusVersion, _ = phase.GetBeOSVersion()
if terminusVersion != "" {
return errors.New("Olares is already installed, please uninstall it first.")
return errors.New("beOS Pro is already installed, please uninstall it first.")
}
arg := common.NewArgument()
arg.SetOlaresVersion(viper.GetString(common.FlagVersion))
arg.SetBeOSVersion(viper.GetString(common.FlagVersion))
arg.SetStorage(getStorageConfig())
runtime, err := common.NewKubeRuntime(*arg)

View File

@@ -15,11 +15,11 @@ func UninstallTerminusPipeline() error {
kubeType := phase.GetKubeType()
if version == "" {
version, _ = phase.GetOlaresVersion()
version, _ = phase.GetBeOSVersion()
}
var arg = common.NewArgument()
arg.SetOlaresVersion(version)
arg.SetBeOSVersion(version)
arg.SetConsoleLog("uninstall.log", true)
arg.SetKubeVersion(kubeType)
arg.SetStorage(getStorageConfig())
@@ -43,7 +43,7 @@ func UninstallTerminusPipeline() error {
var p = cluster.UninstallTerminus(phase, runtime)
if err := p.Start(); err != nil {
logger.Errorf("uninstall Olares failed: %v", err)
logger.Errorf("uninstall beOS Pro failed: %v", err)
return err
}

View File

@@ -17,22 +17,22 @@ import (
"github.com/pkg/errors"
)
func UpgradeOlaresPipeline() error {
currentVersionString, err := phase.GetOlaresVersion()
func UpgradeBeOSPipeline() error {
currentVersionString, err := phase.GetBeOSVersion()
if err != nil {
return errors.Wrap(err, "failed to get current Olares version")
return errors.Wrap(err, "failed to get current beOS version")
}
if currentVersionString == "" {
return errors.New("Olares is not installed, please install it first")
return errors.New("beOS Pro is not installed, please install it first")
}
currentVersion, err := utils.ParseOlaresVersionString(currentVersionString)
currentVersion, err := utils.ParseBeOSVersionString(currentVersionString)
if err != nil {
return fmt.Errorf("error parsing current Olares version: %v", err)
return fmt.Errorf("error parsing current beOS version: %v", err)
}
targetVersion, err := utils.ParseOlaresVersionString(version.VERSION)
targetVersion, err := utils.ParseBeOSVersionString(version.VERSION)
if err != nil {
return fmt.Errorf("error parsing target Olares version: %v", err)
return fmt.Errorf("error parsing target beOS version: %v", err)
}
if err := upgrade.Check(currentVersion, targetVersion); err != nil {
@@ -40,7 +40,7 @@ func UpgradeOlaresPipeline() error {
}
arg := common.NewArgument()
arg.SetOlaresVersion(viper.GetString(common.FlagVersion))
arg.SetBeOSVersion(viper.GetString(common.FlagVersion))
arg.SetConsoleLog("upgrade.log", true)
arg.SetKubeVersion(phase.GetKubeType())
@@ -57,17 +57,17 @@ func UpgradeOlaresPipeline() error {
}
p := &pipeline.Pipeline{
Name: "UpgradeOlares",
Name: "UpgradeBeOS",
Modules: []module.Module{upgradeModule},
Runtime: runtime,
}
logger.Infof("Starting Olares upgrade from %s to %s...", currentVersion, targetVersion)
logger.Infof("Starting beOS Pro upgrade from %s to %s...", currentVersion, targetVersion)
if err := p.Start(); err != nil {
return errors.Wrap(err, "upgrade failed")
}
logger.Info("Olares upgrade completed successfully!")
logger.Info("beOS Pro upgrade completed successfully!")
return nil
}

View File

@@ -18,7 +18,7 @@ import (
"sigs.k8s.io/kustomize/kyaml/yaml"
)
type OlaresManifest struct {
type BeOSManifest struct {
APIVersion string `yaml:"apiVersion"`
Target string `yaml:"target"`
Output OutputManifest `yaml:"output"`
@@ -60,7 +60,7 @@ func NewManager(olaresRepoRoot, distPath, cdnURL string, ignoreMissingImages boo
func (m *Manager) Generate() error {
if err := m.scan(); err != nil {
return fmt.Errorf("failed to scan Olares repository for images and components: %v", err)
return fmt.Errorf("failed to scan beOS repository for images and components: %v", err)
}
manifestPath := filepath.Join(m.distPath, "installation.manifest")
@@ -189,7 +189,7 @@ func (m *Manager) scan() error {
return err
}
// shortcut to Olares manifest file
// shortcut to beOS Pro manifest file
if strings.EqualFold(info.Name(), "olares.yaml") {
content, err := os.ReadFile(filePath)
if err != nil {
@@ -198,7 +198,7 @@ func (m *Manager) scan() error {
}
return err
}
olaresManifest := &OlaresManifest{}
olaresManifest := &BeOSManifest{}
err = yaml.Unmarshal(content, olaresManifest)
if err != nil {
return fmt.Errorf("failed to unmarshal olares manifest %s: %v", filePath, err)
@@ -357,16 +357,16 @@ func (m *Manager) patchImage(image string) (string, error) {
}
func (m *Manager) patchComponent(component BinaryOutput) (BinaryOutput, error) {
if component.ID != "olaresd" {
if component.ID != "beosd" && component.ID != "olaresd" {
return component, nil
}
latestDailyBuildTag, latestDailyBuildCommit, err := m.getLatestDailyBuildTagAndCommit()
if err != nil {
return BinaryOutput{}, fmt.Errorf("failed to get latest daily build tag (required to replace olaresd version): %v", err)
return BinaryOutput{}, fmt.Errorf("failed to get latest daily build tag (required to replace beosd version): %v", err)
}
fmt.Printf("patching olaresd version to %s\n", latestDailyBuildTag)
fmt.Printf("patching beosd version to %s\n", latestDailyBuildTag)
component.Name = strings.ReplaceAll(component.Name, "#__VERSION__", latestDailyBuildTag)
component.AMD64 = strings.ReplaceAll(component.AMD64, "#__VERSION__", latestDailyBuildTag)

View File

@@ -9,14 +9,14 @@ import (
)
var (
Root = path.Join("/")
StorageDataDir = path.Join(Root, "osdata")
StorageDataOlaresDir = path.Join(StorageDataDir, common.OlaresDir)
OlaresRootDir = path.Join(Root, common.OlaresDir)
OlaresSharedLibDir = path.Join(OlaresRootDir, "share")
OlaresUserDataDir = path.Join(OlaresRootDir, "userdata")
Root = path.Join("/")
StorageDataDir = path.Join(Root, "osdata")
StorageDataBeOSDir = path.Join(StorageDataDir, common.BeOSDir)
BeOSRootDir = path.Join(Root, common.BeOSDir)
BeOSSharedLibDir = path.Join(BeOSRootDir, "share")
BeOSUserDataDir = path.Join(BeOSRootDir, "userdata")
RedisRootDir = path.Join(OlaresRootDir, "data", "redis")
RedisRootDir = path.Join(BeOSRootDir, "data", "redis")
RedisConfigDir = path.Join(RedisRootDir, "etc")
RedisDataDir = path.Join(RedisRootDir, "data")
RedisLogDir = path.Join(RedisRootDir, "log")
@@ -28,14 +28,14 @@ var (
RedisServerInstalledFile = path.Join(Root, "usr", "local", "bin", "redis-server")
RedisCliInstalledFile = path.Join(Root, "usr", "local", "bin", "redis-cli")
JuiceFsFile = path.Join(Root, "usr", "local", "bin", "juicefs")
JuiceFsDataDir = path.Join(OlaresRootDir, "data", "juicefs")
JuiceFsCacheDir = path.Join(OlaresRootDir, "jfscache")
OlaresJuiceFSRootDir = path.Join(OlaresRootDir, "rootfs")
JuiceFsServiceFile = path.Join(Root, "etc", "systemd", "system", templates.JuicefsService.Name())
JuiceFsFile = path.Join(Root, "usr", "local", "bin", "juicefs")
JuiceFsDataDir = path.Join(BeOSRootDir, "data", "juicefs")
JuiceFsCacheDir = path.Join(BeOSRootDir, "jfscache")
BeOSJuiceFSRootDir = path.Join(BeOSRootDir, "rootfs")
JuiceFsServiceFile = path.Join(Root, "etc", "systemd", "system", templates.JuicefsService.Name())
MinioRootUser = "minioadmin"
MinioDataDir = path.Join(OlaresRootDir, "data", "minio", "vol1")
MinioDataDir = path.Join(BeOSRootDir, "data", "minio", "vol1")
MinioFile = path.Join(Root, "usr", "local", "bin", "minio")
MinioServiceFile = path.Join(Root, "etc", "systemd", "system", "minio.service")
MinioConfigFile = path.Join(Root, "etc", "default", "minio")

View File

@@ -137,7 +137,7 @@ func (t *EnableJuiceFsService) Execute(runtime connector.Runtime) error {
"JuiceFsBinPath": JuiceFsFile,
"JuiceFsCachePath": JuiceFsCacheDir,
"JuiceFsMetaDb": redisService,
"JuiceFsMountPoint": OlaresJuiceFSRootDir,
"JuiceFsMountPoint": BeOSJuiceFSRootDir,
}
juiceFsServiceStr, err := util.Render(juicefsTemplates.JuicefsService, data)
@@ -210,7 +210,7 @@ func (t *CheckJuiceFsState) Execute(runtime connector.Runtime) error {
time.Sleep(5 * time.Second)
if _, err := runtime.GetRunner().SudoCmd(fmt.Sprintf("%s summary %s", JuiceFsFile, OlaresJuiceFSRootDir), false, false); err != nil {
if _, err := runtime.GetRunner().SudoCmd(fmt.Sprintf("%s summary %s", JuiceFsFile, BeOSJuiceFSRootDir), false, false); err != nil {
return err
}
@@ -266,7 +266,7 @@ func getManagedMinIOAccessFlags(localIp string) (string, error) {
return "", errors.Wrap(err, "failed to get password of managed MinIO")
}
return fmt.Sprintf(" --storage minio --bucket http://%s:9000/%s --access-key %s --secret-key %s",
localIp, cc.OlaresDir, MinioRootUser, minioPassword), nil
localIp, cc.BeOSDir, MinioRootUser, minioPassword), nil
}
func GetRootFSType() string {

View File

@@ -129,7 +129,7 @@ func (m *RemoveStorageModule) Init() {
}
removeTerminusFiles := &task.RemoteTask{
Name: "RemoveOlaresFiles",
Name: "RemoveBeOSFiles",
Hosts: m.Runtime.GetHostsByRole(common.Master),
Prepare: &prepare.PrepareCollection{
new(common.OnlyFirstMaster),
@@ -239,10 +239,10 @@ type DeleteTerminusDataModule struct {
}
func (m *DeleteTerminusDataModule) Init() {
m.Name = "DeleteOlaresData"
m.Name = "DeleteBeOSData"
deleteTerminusData := &task.RemoteTask{
Name: "DeleteOlaresData",
Name: "DeleteBeOSData",
Hosts: m.Runtime.GetHostsByRole(common.Master),
Action: new(DeleteTerminusData),
Parallel: false,

View File

@@ -25,14 +25,14 @@ type MkStorageDir struct {
func (t *MkStorageDir) Execute(runtime connector.Runtime) error {
if utils.IsExist(StorageDataDir) {
if utils.IsExist(cc.OlaresDir) {
_, _ = runtime.GetRunner().SudoCmd(fmt.Sprintf("rm -rf %s", cc.OlaresDir), false, false)
if utils.IsExist(cc.BeOSDir) {
_, _ = runtime.GetRunner().SudoCmd(fmt.Sprintf("rm -rf %s", cc.BeOSDir), false, false)
}
if _, err := runtime.GetRunner().SudoCmd(fmt.Sprintf("mkdir -p %s", StorageDataOlaresDir), false, false); err != nil {
if _, err := runtime.GetRunner().SudoCmd(fmt.Sprintf("mkdir -p %s", StorageDataBeOSDir), false, false); err != nil {
return err
}
if _, err := runtime.GetRunner().SudoCmd(fmt.Sprintf("ln -s %s %s", StorageDataOlaresDir, cc.OlaresDir), false, false); err != nil {
if _, err := runtime.GetRunner().SudoCmd(fmt.Sprintf("ln -s %s %s", StorageDataBeOSDir, cc.BeOSDir), false, false); err != nil {
return err
}
}
@@ -229,9 +229,9 @@ func (t *StopJuiceFS) Execute(runtime connector.Runtime) error {
_, _ = runtime.GetRunner().SudoCmd(fmt.Sprintf("rm -rf /var/jfsCache %s", JuiceFsCacheDir), false, false)
_, _ = runtime.GetRunner().SudoCmd(fmt.Sprintf("umount %s", OlaresJuiceFSRootDir), false, false)
_, _ = runtime.GetRunner().SudoCmd(fmt.Sprintf("umount %s", BeOSJuiceFSRootDir), false, false)
_, _ = runtime.GetRunner().SudoCmd(fmt.Sprintf("rm -rf %s", OlaresJuiceFSRootDir), false, false)
_, _ = runtime.GetRunner().SudoCmd(fmt.Sprintf("rm -rf %s", BeOSJuiceFSRootDir), false, false)
return nil
}
@@ -331,12 +331,12 @@ type DeleteTerminusUserData struct {
func (t *DeleteTerminusUserData) Execute(runtime connector.Runtime) error {
userdataDirs := []string{
OlaresUserDataDir,
BeOSUserDataDir,
JuiceFsCacheDir,
}
if util.IsExist(RedisServiceFile) {
userdataDirs = append(userdataDirs, OlaresJuiceFSRootDir)
userdataDirs = append(userdataDirs, BeOSJuiceFSRootDir)
}
for _, d := range userdataDirs {
@@ -357,13 +357,13 @@ type DeleteTerminusData struct {
func (t *DeleteTerminusData) Execute(runtime connector.Runtime) error {
var dirs []string
var shareExists bool
filepath.WalkDir(OlaresRootDir, func(path string, d fs.DirEntry, err error) error {
if path != OlaresRootDir {
filepath.WalkDir(BeOSRootDir, func(path string, d fs.DirEntry, err error) error {
if path != BeOSRootDir {
if !d.IsDir() {
return nil
}
if strings.HasPrefix(path, OlaresSharedLibDir) {
if strings.HasPrefix(path, BeOSSharedLibDir) {
shareExists = true
} else {
dirs = append(dirs, path)
@@ -382,8 +382,8 @@ func (t *DeleteTerminusData) Execute(runtime connector.Runtime) error {
}
if !shareExists {
if err := util.RemoveDir(OlaresRootDir); err != nil {
logger.Errorf("remove %s failed %v", OlaresRootDir, err)
if err := util.RemoveDir(BeOSRootDir); err != nil {
logger.Errorf("remove %s failed %v", BeOSRootDir, err)
}
}
@@ -405,7 +405,7 @@ func (t *CreateSharedLibDir) Execute(runtime connector.Runtime) error {
if runtime.GetSystemInfo().IsDarwin() {
return nil
}
if _, err := runtime.GetRunner().SudoCmd(fmt.Sprintf("mkdir -p %s && chown 1000:1000 %s", OlaresSharedLibDir, OlaresSharedLibDir), false, false); err != nil {
if _, err := runtime.GetRunner().SudoCmd(fmt.Sprintf("mkdir -p %s && chown 1000:1000 %s", BeOSSharedLibDir, BeOSSharedLibDir), false, false); err != nil {
return errors.Wrap(errors.WithStack(err), "failed to create shared lib dir")
}
return nil

View File

@@ -39,12 +39,12 @@ func (s *GetUserInfo) Execute(runtime connector.Runtime) error {
if err != nil {
return err
}
logger.Infof("using Olares Local Name: %s", s.KubeConf.Arg.User.UserName)
logger.Infof("using beOS Pro Local Name: %s", s.KubeConf.Arg.User.UserName)
s.KubeConf.Arg.User.Email, err = s.getUserEmail()
if err != nil {
return err
}
logger.Infof("using Olares ID: %s", s.KubeConf.Arg.User.Email)
logger.Infof("using beOS ID: %s", s.KubeConf.Arg.User.Email)
s.KubeConf.Arg.User.Password, s.KubeConf.Arg.User.EncryptedPassword, err = s.getUserPassword()
if err != nil {
return err
@@ -106,7 +106,7 @@ func (s *GetUserInfo) getUserName() (string, error) {
return "", errors.Wrap(err, "failed to get terminal input reader")
}
LOOP:
fmt.Printf("\nEnter the Olares ID (which you registered in the LarePass app): ")
fmt.Printf("\nEnter your beOS ID: ")
userName, err = reader.ReadString('\n')
if err != nil && err.Error() != "EOF" {
return "", errors.Wrap(errors.WithStack(err), "read username failed")
@@ -135,7 +135,7 @@ func (s *GetUserInfo) getUserEmail() (string, error) {
}
func (s *GetUserInfo) getUserPassword() (string, string, error) {
// currently only used in the installation flow by LarePass -> Olaresd,
// currently only used by the companion-app -> beOSd installation flow,
// when this env var is passed in, it is already encrypted
// make this one priority over the password set in the arg specailly
// to ensure the larepass installation flow works as expected

View File

@@ -123,10 +123,10 @@ func (u *PrepareAppValues) Execute(runtime connector.Runtime) error {
"username": u.KubeConf.Arg.User.UserName,
},
},
"gpu": gpuType,
"fs_type": fsType,
"os": appValues,
common.HelmValuesKeyOlaresRootFSPath: storage.OlaresRootDir,
"gpu": gpuType,
"fs_type": fsType,
"os": appValues,
common.HelmValuesKeyBeOSRootFSPath: storage.BeOSRootDir,
}
u.ModuleCache.Set(common.CacheAppValues, values)

View File

@@ -61,7 +61,7 @@ func (t *InstallBFL) Execute(runtime connector.Runtime) error {
"appKey": key,
"appSecret": secret,
}
vals[common.HelmValuesKeyOlaresRootFSPath] = storage.OlaresRootDir
vals[common.HelmValuesKeyBeOSRootFSPath] = storage.BeOSRootDir
if err := utils.UpgradeCharts(ctx, actionConfig, settings, launchName, launchPath, "", ns, vals, false); err != nil {
return err

View File

@@ -259,14 +259,14 @@ func serviceExists(serviceName string) bool {
return util.IsExist(path.Join(systemdUnitDir, serviceName))
}
type StopOlaresModule struct {
type StopBeOSModule struct {
common.KubeModule
Timeout time.Duration
CheckInterval time.Duration
}
func (m *StopOlaresModule) Init() {
m.Name = "StopOlares"
func (m *StopBeOSModule) Init() {
m.Name = "StopBeOS"
newStopServiceTask := func(serviceName string) task.Interface {
return &task.LocalTask{
@@ -324,21 +324,21 @@ func (m *StopOlaresModule) Init() {
}
}
if len(m.Tasks) == 0 {
logger.Info("found no components of Olares, please install Olares first")
logger.Info("found no components of beOS Pro, please install beOS Pro first")
logger.Info("exiting ...")
os.Exit(0)
} else if !k3sServiceExists && !kubeletServiceExists {
logger.Warn("kubernetes service can not be found, it seems that Olares has not been installed yet")
logger.Warn("kubernetes service can not be found, it seems that beOS Pro has not been installed yet")
logger.Warn("will try to stop any other base components that we can find")
}
}
type StartOlaresModule struct {
type StartBeOSModule struct {
common.KubeModule
}
func (m *StartOlaresModule) Init() {
m.Name = "StartOlares"
func (m *StartBeOSModule) Init() {
m.Name = "StartBeOS"
newStartServiceTask := func(serviceName string) task.Interface {
return &task.LocalTask{
@@ -376,13 +376,13 @@ func (m *StartOlaresModule) Init() {
m.Tasks = append(m.Tasks, newStartServiceTask(kubeletServiceName))
}
if len(m.Tasks) == 0 {
logger.Info("found no components of Olares, please install Olares first")
logger.Info("found no components of beOS Pro, please install beOS Pro first")
logger.Info("exiting ...")
os.Exit(0)
} else if k3sServiceExists || kubeletServiceExists {
m.Tasks = append(m.Tasks, &task.LocalTask{
// when starting an already stopped Olares, which is the normal use case
// when starting an already stopped beOS Pro, which is the normal use case
// it's very likely for this program to outrun kubelet
// and retrieve a pod list from kube-apiserver that is a "snapshot" of the cluster state
// when the kubernetes components was killed, before. i.e. the data will say all the pods are running while they're actually not
@@ -399,7 +399,7 @@ func (m *StartOlaresModule) Init() {
Retry: 60,
})
} else {
logger.Warn("kubernetes service can not be found, it seems that Olares has not been installed yet")
logger.Warn("kubernetes service can not be found, it seems that beOS Pro has not been installed yet")
logger.Warn("will try to start any other base components that we can find")
}
@@ -414,7 +414,7 @@ func (m *ChangeIPModule) Init() {
prepared, _ := m.PipelineCache.GetMustBool(common.CachePreparedState)
if !prepared {
logger.Info("the Olares OS is not prepared, will only try to update /etc/hosts")
logger.Info("the beOS Pro is not prepared, will only try to update /etc/hosts")
}
m.Tasks = []task.Interface{
&task.LocalTask{
@@ -429,7 +429,7 @@ func (m *ChangeIPModule) Init() {
installed, _ := m.PipelineCache.GetMustBool(common.CacheInstalledState)
if !installed && prepared {
logger.Info("the Olares OS is not installed, will only try to update prepared base components")
logger.Info("the beOS Pro is not installed, will only try to update prepared base components")
}
if installed {
@@ -744,7 +744,7 @@ func (m *ChangeHostIPModule) Init() {
m.Tasks = append(m.Tasks,
&task.LocalTask{
Name: "CheckOlaresStateInHost",
Name: "CheckBeOSStateInHost",
Action: new(CheckTerminusStateInHost),
},
&task.LocalTask{

View File

@@ -43,7 +43,7 @@ func (s *GetNATGatewayIP) Execute(runtime connector.Runtime) error {
} else {
input = hostIP
}
case s.KubeConf.Arg.IsOlaresInContainer:
case s.KubeConf.Arg.IsBeOSInContainer:
if hostIP == "" {
return errors.Errorf("host ip not found")
}

View File

@@ -57,11 +57,11 @@ func (t *InstallOsSystem) Execute(runtime connector.Runtime) error {
"is_cloud_version": cloudValue(t.KubeConf.Arg.IsCloudInstance),
"sync_secret": t.KubeConf.Arg.Storage.StorageSyncSecret,
},
"gpu": getGpuType(t.KubeConf.Arg.GPU.Enable),
"s3_bucket": t.KubeConf.Arg.Storage.StorageBucket,
"fs_type": storage.GetRootFSType(),
common.HelmValuesKeyOlaresRootFSPath: storage.OlaresRootDir,
"sharedlib": storage.OlaresSharedLibDir,
"gpu": getGpuType(t.KubeConf.Arg.GPU.Enable),
"s3_bucket": t.KubeConf.Arg.Storage.StorageBucket,
"fs_type": storage.GetRootFSType(),
common.HelmValuesKeyBeOSRootFSPath: storage.BeOSRootDir,
"sharedlib": storage.BeOSSharedLibDir,
}
var platformPath = path.Join(runtime.GetInstallerDir(), "wizard", "config", "os-platform")

View File

@@ -45,10 +45,10 @@ import (
"github.com/pkg/errors"
)
type GetOlaresVersion struct {
type GetBeOSVersion struct {
}
func (t *GetOlaresVersion) Execute() (string, error) {
func (t *GetBeOSVersion) Execute() (string, error) {
var kubectlpath, err = util.GetCommand(common.CommandKubectl)
if err != nil {
return "", fmt.Errorf("kubectl not found, beOS Pro might not be installed")
@@ -159,7 +159,7 @@ type Download struct {
}
func (t *Download) Execute(runtime connector.Runtime) error {
if t.UrlOverride == "" && t.KubeConf.Arg.OlaresVersion == "" {
if t.UrlOverride == "" && t.KubeConf.Arg.BeOSVersion == "" {
return errors.New("unknown version to download")
}
@@ -234,7 +234,7 @@ type PrepareFinished struct {
func (t *PrepareFinished) Execute(runtime connector.Runtime) error {
var preparedFile = filepath.Join(runtime.GetBaseDir(), common.TerminusStateFilePrepared)
return util.WriteFile(preparedFile, []byte(t.KubeConf.Arg.OlaresVersion), cc.FileMode0644)
return util.WriteFile(preparedFile, []byte(t.KubeConf.Arg.BeOSVersion), cc.FileMode0644)
// if _, err := runtime.GetRunner().Cmd(fmt.Sprintf("touch %s", preparedFile), false, true); err != nil {
// return err
// }
@@ -247,8 +247,8 @@ type WriteReleaseFile struct {
}
func (t *WriteReleaseFile) Execute(runtime connector.Runtime) error {
if util.IsExist(common.OlaresReleaseFile) {
logger.Debugf("found existing release file: %s, overriding ...", common.OlaresReleaseFile)
if util.IsExist(common.BeOSReleaseFile) {
logger.Debugf("found existing release file: %s, overriding ...", common.BeOSReleaseFile)
}
return t.KubeConf.Arg.SaveReleaseInfo(t.WithoutName)
}
@@ -258,7 +258,7 @@ type RemoveReleaseFile struct {
}
func (t *RemoveReleaseFile) Execute(runtime connector.Runtime) error {
err := os.Remove(common.OlaresReleaseFile)
err := os.Remove(common.BeOSReleaseFile)
if err != nil && !os.IsNotExist(err) {
return err
}
@@ -304,7 +304,7 @@ type InstallFinished struct {
}
func (t *InstallFinished) Execute(runtime connector.Runtime) error {
var content = fmt.Sprintf("%s %s", t.KubeConf.Arg.OlaresVersion, t.KubeConf.Arg.Kubetype)
var content = fmt.Sprintf("%s %s", t.KubeConf.Arg.BeOSVersion, t.KubeConf.Arg.Kubetype)
var phaseState = path.Join(runtime.GetBaseDir(), common.TerminusStateFileInstalled)
if err := util.WriteFile(phaseState, []byte(content), cc.FileMode0644); err != nil {
return err
@@ -898,9 +898,9 @@ type GetMasterInfo struct {
type MasterInfo struct {
JuiceFSEnabled bool
KubernetesInstalled bool
OlaresInstalled bool
BeOSInstalled bool
KubernetesType string
OlaresVersion string
BeOSVersion string
MasterNodeName string
AllNodes []string
}
@@ -913,7 +913,7 @@ func (t *GetMasterInfo) Execute(runtime connector.Runtime) (err error) {
}
if t.Print {
logger.Infof("Got master info:\nBeOSVersion: %s\nJuiceFSEnabled: %t\nKubernetesType: %s\nMasterNodeName: %s\nAllNodes: %s\n",
masterInfo.OlaresVersion, masterInfo.JuiceFSEnabled, masterInfo.KubernetesType, masterInfo.MasterNodeName, strings.Join(masterInfo.AllNodes, ","))
masterInfo.BeOSVersion, masterInfo.JuiceFSEnabled, masterInfo.KubernetesType, masterInfo.MasterNodeName, strings.Join(masterInfo.AllNodes, ","))
}
t.PipelineCache.Set(common.MasterInfo, masterInfo)
@@ -925,7 +925,7 @@ func (t *GetMasterInfo) Execute(runtime connector.Runtime) (err error) {
if !exist {
masterInfo.JuiceFSEnabled = false
} else {
juiceFSCheckCMD := fmt.Sprintf("%s info %s", storage.JuiceFsFile, storage.OlaresJuiceFSRootDir)
juiceFSCheckCMD := fmt.Sprintf("%s info %s", storage.JuiceFsFile, storage.BeOSJuiceFSRootDir)
output, err := runtime.GetRunner().SudoCmd(juiceFSCheckCMD, false, false)
if err != nil {
return errors.Wrap(err, "failed to check JuiceFS status")
@@ -966,13 +966,13 @@ func (t *GetMasterInfo) Execute(runtime connector.Runtime) (err error) {
output, err = runtime.GetRunner().SudoCmd(olaresVersionCMD, false, false)
if err != nil {
if strings.Contains(err.Error(), "the server doesn't have a resource type") {
masterInfo.OlaresInstalled = false
masterInfo.BeOSInstalled = false
return nil
}
return errors.Wrap(err, "failed to get beOS Pro version (is it installed?)")
}
masterInfo.OlaresInstalled = true
masterInfo.OlaresVersion = strings.TrimSpace(output)
masterInfo.BeOSInstalled = true
masterInfo.BeOSVersion = strings.TrimSpace(output)
return nil
}
@@ -1004,7 +1004,7 @@ func (a *AddNodePrecheck) Execute(runtime connector.Runtime) error {
if !masterInfo.KubernetesInstalled {
errs = append(errs, errors.New("[Kubernetes] the master node has not installed Kubernetes"))
}
if !masterInfo.OlaresInstalled {
if !masterInfo.BeOSInstalled {
errs = append(errs, errors.New("[beOS Pro] the master node has not installed beOS Pro"))
}
for _, node := range masterInfo.AllNodes {

View File

@@ -46,7 +46,7 @@ func (t *WelcomeMessage) Execute(runtime connector.Runtime) error {
logger.InfoInstallationProgress("Installation wizard is complete")
logger.InfoInstallationProgress("All done")
fmt.Printf("\n\n\n\n------------------------------------------------\n\n")
logger.Info("Olares is running locally at:")
logger.Info("beOS Pro is running locally at:")
logger.Infof("http://%s:%d", localIP, port)
if len(filteredPublicIPs) > 0 {
fmt.Println()
@@ -86,7 +86,7 @@ type WelcomeModule struct {
}
func (m *WelcomeModule) Init() {
logger.InfoInstallationProgress("Starting Olares ...")
logger.InfoInstallationProgress("Starting beOS Pro ...")
m.Name = "Welcome"
waitServicesReady := &task.LocalTask{

View File

@@ -18,7 +18,7 @@ func (u upgrader_1_12_3_20251127) NeedRestart() bool {
}
// put GPU driver upgrade step at the very end right before updating the version
func (u upgrader_1_12_3_20251127) UpdateOlaresVersion() []task.Interface {
func (u upgrader_1_12_3_20251127) UpdateBeOSVersion() []task.Interface {
var tasks []task.Interface
tasks = append(tasks,
&task.LocalTask{
@@ -26,7 +26,7 @@ func (u upgrader_1_12_3_20251127) UpdateOlaresVersion() []task.Interface {
Action: new(upgradeGPUDriverIfNeeded),
},
)
tasks = append(tasks, u.upgraderBase.UpdateOlaresVersion()...)
tasks = append(tasks, u.upgraderBase.UpdateBeOSVersion()...)
tasks = append(tasks,
&task.LocalTask{
Name: "RebootIfNeeded",

View File

@@ -42,7 +42,7 @@ func (u upgrader_1_12_3_20251217) NeedRestart() bool {
return true
}
func (u upgrader_1_12_3_20251217) UpdateOlaresVersion() []task.Interface {
func (u upgrader_1_12_3_20251217) UpdateBeOSVersion() []task.Interface {
var tasks []task.Interface
tasks = append(tasks,
&task.LocalTask{
@@ -50,7 +50,7 @@ func (u upgrader_1_12_3_20251217) UpdateOlaresVersion() []task.Interface {
Action: new(upgradeGPUDriverIfNeeded),
},
)
tasks = append(tasks, u.upgraderBase.UpdateOlaresVersion()...)
tasks = append(tasks, u.upgraderBase.UpdateBeOSVersion()...)
tasks = append(tasks,
&task.LocalTask{
Name: "RebootIfNeeded",

View File

@@ -69,7 +69,7 @@ func (u upgrader_1_12_4) UpgradeSystemComponents() []task.Interface {
return append(pre, u.upgraderBase.UpgradeSystemComponents()...)
}
func (u upgrader_1_12_4) UpdateOlaresVersion() []task.Interface {
func (u upgrader_1_12_4) UpdateBeOSVersion() []task.Interface {
var tasks []task.Interface
tasks = append(tasks,
&task.LocalTask{
@@ -77,7 +77,7 @@ func (u upgrader_1_12_4) UpdateOlaresVersion() []task.Interface {
Action: new(upgradeGPUDriverIfNeeded),
},
)
tasks = append(tasks, u.upgraderBase.UpdateOlaresVersion()...)
tasks = append(tasks, u.upgraderBase.UpdateBeOSVersion()...)
tasks = append(tasks,
&task.LocalTask{
Name: "RebootIfNeeded",

View File

@@ -7,6 +7,7 @@ import (
"path"
"time"
iamv1alpha2 "github.com/beclab/api/iam/v1alpha2"
"github.com/beclab/beos/cli/pkg/common"
"github.com/beclab/beos/cli/pkg/core/connector"
"github.com/beclab/beos/cli/pkg/core/logger"
@@ -14,7 +15,6 @@ import (
"github.com/beclab/beos/cli/pkg/gpu"
"github.com/beclab/beos/cli/pkg/terminus"
"github.com/beclab/beos/cli/pkg/utils"
iamv1alpha2 "github.com/beclab/api/iam/v1alpha2"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kruntime "k8s.io/apimachinery/pkg/runtime"
@@ -143,11 +143,11 @@ func (u upgraderBase) UpgradeSystemComponents() []task.Interface {
}
}
func (u upgraderBase) UpdateOlaresVersion() []task.Interface {
func (u upgraderBase) UpdateBeOSVersion() []task.Interface {
return []task.Interface{
&task.LocalTask{
Name: "UpdateOlaresVersion",
Action: new(updateOlaresVersion),
Name: "UpdateBeOSVersion",
Action: new(updateBeOSVersion),
},
}
}
@@ -386,11 +386,11 @@ func (u *upgradeSystemComponents) Execute(runtime connector.Runtime) error {
return nil
}
type updateOlaresVersion struct {
type updateBeOSVersion struct {
common.KubeAction
}
func (u *updateOlaresVersion) Execute(runtime connector.Runtime) error {
func (u *updateBeOSVersion) Execute(runtime connector.Runtime) error {
config, err := ctrl.GetConfig()
if err != nil {
return fmt.Errorf("failed to get rest config: %s", err)
@@ -403,7 +403,7 @@ func (u *updateOlaresVersion) Execute(runtime connector.Runtime) error {
defer cancelSettings()
settingsChartPath := path.Join(runtime.GetInstallerDir(), "wizard", "config", "settings")
vals := map[string]interface{}{"version": u.KubeConf.Arg.OlaresVersion}
vals := map[string]interface{}{"version": u.KubeConf.Arg.BeOSVersion}
if err := utils.UpgradeCharts(ctx, actionConfig, settings, common.ChartNameSettings, settingsChartPath, "", common.NamespaceDefault, vals, true); err != nil {
return err
}

View File

@@ -13,7 +13,7 @@ type upgrader interface {
UpgradeUserComponents() []task.Interface
UpdateReleaseFile() []task.Interface
UpgradeSystemComponents() []task.Interface
UpdateOlaresVersion() []task.Interface
UpdateBeOSVersion() []task.Interface
PostUpgrade() []task.Interface
AddedBreakingChange() bool
NeedRestart() bool

View File

@@ -16,7 +16,7 @@ type Module struct {
}
func (m *Module) Init() {
m.Name = "UpgradeOlares"
m.Name = "UpgradeBeOS"
u := getUpgraderByVersion(m.TargetVersion)
m.Tasks = append(m.Tasks, u.PrepareForUpgrade()...)
@@ -26,7 +26,7 @@ func (m *Module) Init() {
m.Tasks = append(m.Tasks, u.UpgradeSystemComponents()...)
m.Tasks = append(m.Tasks, u.UpgradeUserComponents()...)
m.Tasks = append(m.Tasks, u.UpdateReleaseFile()...)
m.Tasks = append(m.Tasks, u.UpdateOlaresVersion()...)
m.Tasks = append(m.Tasks, u.UpdateBeOSVersion()...)
m.Tasks = append(m.Tasks, u.PostUpgrade()...)
}

View File

@@ -85,9 +85,9 @@ func Check(base *semver.Version, target *semver.Version) error {
return fmt.Errorf("base version is nil")
}
cliVersion, err := utils.ParseOlaresVersionString(version.VERSION)
cliVersion, err := utils.ParseBeOSVersionString(version.VERSION)
if err != nil {
return fmt.Errorf("invalid olares-cli version :\"%s\"", version.VERSION)
return fmt.Errorf("invalid beos-cli version :\"%s\"", version.VERSION)
}
if target != nil {

View File

@@ -15,9 +15,9 @@ const (
"report": [
{
"lv": [
{"lv_name":"data", "vg_name":"olares-vg", "lv_attr":"-wi-ao----", "lv_size":"1.76t", "pool_lv":"", "origin":"", "data_percent":"", "metadata_percent":"", "move_pv":"", "mirror_log":"", "copy_percent":"", "convert_lv":""},
{"lv_name":"root", "vg_name":"olares-vg", "lv_attr":"-wi-ao----", "lv_size":"100.00g", "pool_lv":"", "origin":"", "data_percent":"", "metadata_percent":"", "move_pv":"", "mirror_log":"", "copy_percent":"", "convert_lv":""},
{"lv_name":"swap", "vg_name":"olares-vg", "lv_attr":"-wi-ao----", "lv_size":"1.00g", "pool_lv":"", "origin":"", "data_percent":"", "metadata_percent":"", "move_pv":"", "mirror_log":"", "copy_percent":"", "convert_lv":""}
{"lv_name":"data", "vg_name":"beos-vg", "lv_attr":"-wi-ao----", "lv_size":"1.76t", "pool_lv":"", "origin":"", "data_percent":"", "metadata_percent":"", "move_pv":"", "mirror_log":"", "copy_percent":"", "convert_lv":""},
{"lv_name":"root", "vg_name":"beos-vg", "lv_attr":"-wi-ao----", "lv_size":"100.00g", "pool_lv":"", "origin":"", "data_percent":"", "metadata_percent":"", "move_pv":"", "mirror_log":"", "copy_percent":"", "convert_lv":""},
{"lv_name":"swap", "vg_name":"beos-vg", "lv_attr":"-wi-ao----", "lv_size":"1.00g", "pool_lv":"", "origin":"", "data_percent":"", "metadata_percent":"", "move_pv":"", "mirror_log":"", "copy_percent":"", "convert_lv":""}
]
}
]
@@ -67,7 +67,7 @@ func CommandLVS() *command[LvsResult] {
"report": [
{
"vg": [
{"vg_name":"olares-vg", "pv_count":"1", "lv_count":"3", "snap_count":"0", "vg_attr":"wz--n-", "vg_size":"1.86t", "vg_free":"0 "}
{"vg_name":"beos-vg", "pv_count":"1", "lv_count":"3", "snap_count":"0", "vg_attr":"wz--n-", "vg_size":"1.86t", "vg_free":"0 "}
]
}
]
@@ -110,7 +110,7 @@ func CommandVGS() *command[VgsResult] {
"report": [
{
"pv": [
{"pv_name":"/dev/nvme0n1p2", "vg_name":"olares-vg", "pv_fmt":"lvm2", "pv_attr":"a--", "pv_size":"1.86t", "pv_free":"0 "}
{"pv_name":"/dev/nvme0n1p2", "vg_name":"beos-vg", "pv_fmt":"lvm2", "pv_attr":"a--", "pv_size":"1.86t", "pv_free":"0 "}
]
}
]

View File

@@ -228,7 +228,7 @@ func GenerateEncryptedPassword(length int) (string, string, error) {
}
func EncryptPassword(plainText string) string {
return utils.MD5(plainText + "@Olares2025")
return utils.MD5(plainText + "@beOSPro2025")
}
func RemoveAnsiCodes(input string) string {

View File

@@ -2,7 +2,7 @@ package utils
import "github.com/Masterminds/semver/v3"
func ParseOlaresVersionString(versionString string) (*semver.Version, error) {
func ParseBeOSVersionString(versionString string) (*semver.Version, error) {
// todo: maybe some other custom processing only for olares
return semver.NewVersion(versionString)
}

View File

@@ -34,7 +34,7 @@ This package mostly exists to maintain parity with the structure of other web5 S
### Key Generation
the `dsa` package provides [algorithm IDs](https://github.com/beclab/Olares/cli/pkg/web5/blob/5d50ce8f24e4b47b0a8626724e8a571e9b5c847f/crypto/dsa/dsa.go#L11-L14) that can be passed to the `GenerateKey` function e.g.
the `dsa` package provides [algorithm IDs](https://github.com/beclab/beOS Pro/cli/pkg/web5/blob/5d50ce8f24e4b47b0a8626724e8a571e9b5c847f/crypto/dsa/dsa.go#L11-L14) that can be passed to the `GenerateKey` function e.g.
```go
package main
@@ -42,7 +42,7 @@ package main
import (
"fmt"
"github.com/beclab/Olares/cli/pkg/web5/crypto/dsa"
"github.com/beclab/beOS Pro/cli/pkg/web5/crypto/dsa"
)
func main() {
@@ -64,7 +64,7 @@ package main
import (
"fmt"
"github.com/beclab/Olares/cli/pkg/web5/crypto/dsa"
"github.com/beclab/beOS Pro/cli/pkg/web5/crypto/dsa"
)
func main() {
@@ -95,7 +95,7 @@ package main
import (
"fmt"
"github.com/beclab/Olares/cli/pkg/web5/crypto/dsa"
"github.com/beclab/beOS Pro/cli/pkg/web5/crypto/dsa"
)
func main() {

View File

@@ -55,7 +55,7 @@ package main
import (
"fmt"
"github.com/beclab/Olares/cli/pkg/web5/didjwk"
"github.com/beclab/beOS Pro/cli/pkg/web5/didjwk"
)
func main() {
@@ -81,7 +81,7 @@ package main
import (
"fmt"
"github.com/beclab/Olares/cli/pkg/web5/didjwk"
"github.com/beclab/beOS Pro/cli/pkg/web5/didjwk"
)
func main() {
@@ -110,8 +110,8 @@ package main
import (
"fmt"
"github.com/beclab/Olares/cli/pkg/web5/dsa"
"github.com/beclab/Olares/cli/pkg/web5/didjwk"
"github.com/beclab/beOS Pro/cli/pkg/web5/dsa"
"github.com/beclab/beOS Pro/cli/pkg/web5/didjwk"
)
func main() {
@@ -148,8 +148,8 @@ package main
import (
"fmt"
"github.com/beclab/Olares/cli/pkg/web5/dsa"
"github.com/beclab/Olares/cli/pkg/web5/dids"
"github.com/beclab/beOS Pro/cli/pkg/web5/dsa"
"github.com/beclab/beOS Pro/cli/pkg/web5/dids"
)
func main() {
@@ -180,8 +180,8 @@ package main
import (
"fmt"
"github.com/beclab/Olares/cli/pkg/web5/did"
"github.com/beclab/Olares/cli/pkg/web5/didjwk"
"github.com/beclab/beOS Pro/cli/pkg/web5/did"
"github.com/beclab/beOS Pro/cli/pkg/web5/didjwk"
)
func main() {
@@ -213,7 +213,7 @@ package main
import (
"fmt"
"github.com/beclab/Olares/cli/pkg/web5/did"
"github.com/beclab/beOS Pro/cli/pkg/web5/did"
)
func main() {

View File

@@ -24,8 +24,8 @@ package main
import (
"fmt"
"github.com/beclab/Olares/cli/pkg/web5/didjwk"
"github.com/beclab/Olares/cli/pkg/web5/jws"
"github.com/beclab/beOS Pro/cli/pkg/web5/didjwk"
"github.com/beclab/beOS Pro/cli/pkg/web5/jws"
)
func main() {
@@ -56,8 +56,8 @@ package main
import (
"fmt"
"github.com/beclab/Olares/cli/pkg/web5/didjwk"
"github.com/beclab/Olares/cli/pkg/web5/jws"
"github.com/beclab/beOS Pro/cli/pkg/web5/didjwk"
"github.com/beclab/beOS Pro/cli/pkg/web5/jws"
)
func main() {
@@ -86,8 +86,8 @@ package main
import (
"fmt"
"github.com/beclab/Olares/cli/pkg/web5/didjwk"
"github.com/beclab/Olares/cli/pkg/web5/jws"
"github.com/beclab/beOS Pro/cli/pkg/web5/didjwk"
"github.com/beclab/beOS Pro/cli/pkg/web5/jws"
)
func main() {
@@ -116,8 +116,8 @@ package main
import (
"fmt"
"github.com/beclab/Olares/cli/pkg/web5/didjwk"
"github.com/beclab/Olares/cli/pkg/web5/jws"
"github.com/beclab/beOS Pro/cli/pkg/web5/didjwk"
"github.com/beclab/beOS Pro/cli/pkg/web5/jws"
)
func main() {

View File

@@ -83,13 +83,13 @@ func initDB() {
// CheckJWSResult represents the result of checking a JWS
type CheckJWSResult struct {
OlaresID string `json:"olares_id"`
Body interface{} `json:"body"`
KID string `json:"kid"`
BeOSID string `json:"olares_id"`
Body interface{} `json:"body"`
KID string `json:"kid"`
}
// resolveDID resolves a DID either from cache or from the DID gate
func ResolveOlaresName(gateUrl, olares_id string) (*didcore.ResolutionResult, error) {
func ResolveBeOSName(gateUrl, olares_id string) (*didcore.ResolutionResult, error) {
name := strings.Replace(olares_id, "@", ".", -1)
// Try to get from cache first
cached, err := getDB().Get([]byte(name), nil)
@@ -197,7 +197,7 @@ func CheckJWS(gateUrl, jws string, duration int64) (*CheckJWSResult, error) {
}
// Resolve DID
resolutionResult, err := ResolveOlaresName(gateUrl, name)
resolutionResult, err := ResolveBeOSName(gateUrl, name)
if err != nil {
return nil, fmt.Errorf("failed to resolve DID: %w", err)
}
@@ -230,9 +230,9 @@ func CheckJWS(gateUrl, jws string, duration int64) (*CheckJWSResult, error) {
}
result := CheckJWSResult{
OlaresID: name,
Body: payload,
KID: kid,
BeOSID: name,
Body: payload,
KID: kid,
}
return &result, nil

View File

@@ -19,8 +19,8 @@ package main
import (
"fmt"
"github.com/beclab/Olares/cli/pkg/web5/didjwk"
"github.com/beclab/Olares/cli/pkg/web5/jwt"
"github.com/beclab/beOS Pro/cli/pkg/web5/didjwk"
"github.com/beclab/beOS Pro/cli/pkg/web5/jwt"
)
func main() {
@@ -48,8 +48,8 @@ package main
import (
"fmt"
"github.com/beclab/Olares/cli/pkg/web5/dids"
"github.com/beclab/Olares/cli/pkg/web5/jwt"
"github.com/beclab/beOS Pro/cli/pkg/web5/dids"
"github.com/beclab/beOS Pro/cli/pkg/web5/jwt"
)
func main() {

View File

@@ -128,16 +128,16 @@ func (i *InstallTerminusModule) Init() {
}
}
type UninstallOlaresModule struct {
type UninstallBeOSModule struct {
common.KubeModule
}
func (u *UninstallOlaresModule) Init() {
func (u *UninstallBeOSModule) Init() {
u.Name = "UninstallBeOS"
u.Tasks = []task.Interface{
&task.LocalTask{
Name: "UninstallBeOS",
Action: &UninstallOlares{},
Action: &UninstallBeOS{},
},
&task.LocalTask{
Name: "RemoveFirewallRule",

View File

@@ -28,7 +28,7 @@ const (
ubuntuTool = "ubuntu.exe"
distro = "Ubuntu"
OLARES_WINDOWS_FIREWALL_RULE_NAME = "OlaresRule"
OLARES_WINDOWS_FIREWALL_RULE_NAME = "BeOSRule"
)
type DownloadAppxPackage struct {
@@ -37,7 +37,7 @@ type DownloadAppxPackage struct {
func (d *DownloadAppxPackage) Execute(runtime connector.Runtime) error {
var systemInfo = runtime.GetSystemInfo()
var cdnService = getCDNService(d.KubeConf.Arg.OlaresCDNService)
var cdnService = getCDNService(d.KubeConf.Arg.BeOSCDNService)
appx := files.NewKubeBinary("wsl", systemInfo.GetOsArch(), systemInfo.GetOsType(), systemInfo.GetOsVersion(), systemInfo.GetOsPlatformFamily(), "2204", fmt.Sprintf("%s\\%s\\%s\\%s", systemInfo.GetHomeDir(), cc.DefaultBaseDir, "pkg", "components"), cdnService)
@@ -95,7 +95,7 @@ type DownloadWSLInstallPackage struct {
func (d *DownloadWSLInstallPackage) Execute(runtime connector.Runtime) error {
var systemInfo = runtime.GetSystemInfo()
var cdnService = getCDNService(d.KubeConf.Arg.OlaresCDNService)
var cdnService = getCDNService(d.KubeConf.Arg.BeOSCDNService)
var osArch = systemInfo.GetOsArch()
var osType = systemInfo.GetOsType()
var osVersion = systemInfo.GetOsVersion()
@@ -437,7 +437,7 @@ func (c *ConfigWindowsFirewallRule) Execute(runtime connector.Runtime) error {
scanner := bufio.NewScanner(os.Stdin)
for {
fmt.Print("\nAccessing Olares requires setting up firewall rules, specifically adding TCP inbound rules for ports 80, 443, and 30180.\nDo you want to set up the firewall rules? (yes/no): ")
fmt.Print("\nAccessing beOS Pro requires setting up firewall rules, specifically adding TCP inbound rules for ports 80, 443, and 30180.\nDo you want to set up the firewall rules? (yes/no): ")
scanner.Scan()
confirmation := scanner.Text()
confirmation = strings.TrimSpace(confirmation)
@@ -457,7 +457,7 @@ func (c *ConfigWindowsFirewallRule) Execute(runtime connector.Runtime) error {
}
if !setFirewallRule {
fmt.Printf("\nFirewall settings have been skipped. \nIf you want to access the Olares application, please go to the Windows Defender Firewall rules and add an inbound rule for TCP protocol with port numbers 80, 443, and 30180.\n\n\n")
fmt.Printf("\nFirewall settings have been skipped. \nIf you want to access the beOS Pro application, please go to the Windows Defender Firewall rules and add an inbound rule for TCP protocol with port numbers 80, 443, and 30180.\n\n\n")
return nil
}
@@ -491,7 +491,7 @@ func (i *InstallTerminus) Execute(runtime connector.Runtime) error {
fmt.Sprintf("export %s=%s", common.ENV_PREINSTALL, os.Getenv(common.ENV_PREINSTALL)),
fmt.Sprintf("export %s=%s", common.ENV_HOST_IP, systemInfo.GetLocalIp()),
fmt.Sprintf("export %s=%s", common.ENV_DISABLE_HOST_IP_PROMPT, os.Getenv(common.ENV_DISABLE_HOST_IP_PROMPT)),
fmt.Sprintf("export %s=%s", common.ENV_OLARES_CDN_SERVICE, i.KubeConf.Arg.OlaresCDNService),
fmt.Sprintf("export %s=%s", common.ENV_OLARES_CDN_SERVICE, i.KubeConf.Arg.BeOSCDNService),
}
var bashUrl = fmt.Sprintf("https://%s", cc.DefaultBashUrl)
@@ -504,13 +504,13 @@ func (i *InstallTerminus) Execute(runtime connector.Runtime) error {
bashUrl = fmt.Sprintf("https://%s", defaultDomainName)
}
var cdnService = i.KubeConf.Arg.OlaresCDNService
var cdnService = i.KubeConf.Arg.BeOSCDNService
if cdnService == "" {
cdnService = cc.DefaultOlaresCDNService
cdnService = cc.DefaultBeOSCDNService
}
var installScript = fmt.Sprintf("curl -fsSL %s | bash -", bashUrl)
if i.KubeConf.Arg.OlaresVersion != "" {
var installFile = fmt.Sprintf("install-wizard-v%s.tar.gz", i.KubeConf.Arg.OlaresVersion)
if i.KubeConf.Arg.BeOSVersion != "" {
var installFile = fmt.Sprintf("install-wizard-v%s.tar.gz", i.KubeConf.Arg.BeOSVersion)
installScript = fmt.Sprintf("curl -fsSLO %s/%s && tar -xf %s -C ./ ./install.sh && rm -rf %s && bash ./install.sh",
cdnService, installFile, installFile, installFile)
}
@@ -523,7 +523,7 @@ func (i *InstallTerminus) Execute(runtime connector.Runtime) error {
}
if _, err := cmd.Exec(); err != nil {
return errors.Wrap(errors.WithStack(err), fmt.Sprintf("install Olares %s failed", distro))
return errors.Wrap(errors.WithStack(err), fmt.Sprintf("install beOS Pro %s failed", distro))
}
exec.Command("cmd", "/C", "wsl", "-d", distro, "--exec", "dbus-launch", "true").Run()
@@ -541,11 +541,11 @@ func convertPath(windowsPath string) string {
return linuxPath
}
type UninstallOlares struct {
type UninstallBeOS struct {
common.KubeAction
}
func (u *UninstallOlares) Execute(runtime connector.Runtime) error {
func (u *UninstallBeOS) Execute(runtime connector.Runtime) error {
var cmd = &utils.DefaultCommandExecutor{
Commands: []string{"--unregister", "Ubuntu"},
}
@@ -602,7 +602,7 @@ func (g *GetDiskPartition) Execute(runtime connector.Runtime) error {
if len(partitions) == 0 {
return fmt.Errorf("Unable to retrieve disk space information")
}
fmt.Printf("\nInstalling Olares will create a WSL Ubuntu Distro and occupy at least 80 GB of disk space. \nPlease select the drive where you want to install it. \nAvailable drives and free space:\n")
fmt.Printf("\nInstalling beOS Pro will create a WSL Ubuntu Distro and occupy at least 80 GB of disk space. \nPlease select the drive where you want to install it. \nAvailable drives and free space:\n")
for _, v := range partitions {
var tmp = strings.Split(v, "_")
fmt.Printf("%s Free Disk: %s\n", tmp[0], tmp[1])
@@ -657,7 +657,7 @@ func (g *GetDiskPartition) checkEnter(enterPath string, partitions []string) boo
func getCDNService(cdnServiceFromEnv string) string {
cdnService := strings.TrimSuffix(cdnServiceFromEnv, "/")
if cdnService == "" {
cdnService = cc.DefaultOlaresCDNService
cdnService = cc.DefaultBeOSCDNService
}
return cdnService
}
@@ -667,11 +667,11 @@ func showUbuntuErrorMsg(msg string, err error) error {
fmt.Printf(`
Stop Installation !!!!!!!
Installing Windows Olares will use the Ubuntu Distro. It has been detected that there is already an existing Ubuntu Distro in the system.
Installing Windows beOS Pro will use the Ubuntu Distro. It has been detected that there is already an existing Ubuntu Distro in the system.
You can use the 'wsl -l --all' command to view the list of WSL Distros.
To proceed with the installation of Olares, you need to unregister the existing Ubuntu Distro. If your Ubuntu Distro contains important information, please back it up first, then unregister the Ubuntu Distro.
To proceed with the installation of beOS Pro, you need to unregister the existing Ubuntu Distro. If your Ubuntu Distro contains important information, please back it up first, then unregister the Ubuntu Distro.
Uninstallation command: 'wsl --unregister Ubuntu'
After the unregister Ubuntu Distro is complete, please reinstall Olares.
After the unregister Ubuntu Distro is complete, please reinstall beOS Pro.
Error message: %v
`, err)

View File

@@ -26,52 +26,52 @@ func NewClient(state ClientState, sender Sender) *Client {
func (c *Client) StartAuthRequest(params StartAuthRequestParams) (*StartAuthRequestResponse, error) {
// Build request parameters
requestParams := []interface{}{params}
// Send request
response, err := c.call("startAuthRequest", requestParams)
if err != nil {
return nil, err
}
// Parse response
var result StartAuthRequestResponse
if err := c.parseResponse(response.Result, &result); err != nil {
return nil, fmt.Errorf("failed to parse StartAuthRequest response: %v", err)
}
return &result, nil
}
func (c *Client) CompleteAuthRequest(params CompleteAuthRequestParams) (*CompleteAuthRequestResponse, error) {
// Build request parameters
requestParams := []interface{}{params}
// Send request
response, err := c.call("completeAuthRequest", requestParams)
if err != nil {
return nil, err
}
// Parse response
var result CompleteAuthRequestResponse
if err := c.parseResponse(response.Result, &result); err != nil {
return nil, fmt.Errorf("failed to parse CompleteAuthRequest response: %v", err)
}
return &result, nil
}
// Generic RPC call method
func (c *Client) call(method string, params []interface{}) (*Response, error) {
session := c.State.GetSession()
// Build request
req := &Request{
Method: method,
Params: params,
Device: c.State.GetDevice(),
}
// If session exists, add authentication info
if session != nil {
auth, err := c.authenticateRequest(req, session)
@@ -79,19 +79,19 @@ func (c *Client) call(method string, params []interface{}) (*Response, error) {
return nil, fmt.Errorf("failed to authenticate request: %v", err)
}
req.Auth = auth
// Temporary debug: print full request JSON
if reqJSON, err := json.Marshal(req); err == nil {
log.Printf("Full request JSON: %s", string(reqJSON))
}
}
// Send request
response, err := c.Sender.Send(req)
if err != nil {
return nil, fmt.Errorf("failed to send request: %v", err)
}
// Check response error
if response.Error != nil {
return nil, NewAuthError(
@@ -100,14 +100,14 @@ func (c *Client) call(method string, params []interface{}) (*Response, error) {
nil,
)
}
// If session exists, verify response
if session != nil {
if err := c.verifyResponse(response, session); err != nil {
return nil, fmt.Errorf("failed to verify response: %v", err)
}
}
return response, nil
}
@@ -116,18 +116,18 @@ func (c *Client) authenticateRequest(req *Request, session *Session) (*RequestAu
if session.Key == nil {
return nil, fmt.Errorf("session key is nil")
}
// 1. Build timestamp
now := time.Now()
// 2. Serialize request data (ref: session.ts line 158: data = req.params)
data := req.Params // Use entire params array directly, not just first element
dataJSON, err := json.Marshal(data)
if err != nil {
return nil, fmt.Errorf("failed to marshal request data: %v", err)
}
// 3. Build signature message (ref: session.ts line 179)
// Format: ${session}_${time.toISOString()}_${marshal(data)}
// Use same format as ISOTime.MarshalJSON to ensure consistency
@@ -137,22 +137,22 @@ func (c *Client) authenticateRequest(req *Request, session *Session) (*RequestAu
utcTime.Hour(), utcTime.Minute(), utcTime.Second(),
utcTime.Nanosecond()/1000000)
message := fmt.Sprintf("%s_%s_%s", session.ID, timeStr, string(dataJSON))
// 4. Use HMAC-SHA256 signing (ref: HMACParams in crypto.ts)
mac := hmac.New(sha256.New, session.Key)
mac.Write([]byte(message))
signature := mac.Sum(nil)
log.Printf("Session signing: sessionId=%s, message_len=%d", session.ID, len(message))
log.Printf("Signing message: %s", message)
log.Printf("Data JSON: %s", string(dataJSON))
log.Printf("Session key for signing: %x", session.Key)
log.Printf("Signature (hex): %x", signature)
return &RequestAuth{
Session: session.ID,
Time: ISOTime(now), // Convert to ISOTime type
Signature: Base64Bytes(signature), // Convert to Base64Bytes type
Time: ISOTime(now), // Convert to ISOTime type
Signature: Base64Bytes(signature), // Convert to Base64Bytes type
}, nil
}
@@ -171,10 +171,10 @@ func (c *Client) parseResponse(result interface{}, target interface{}) error {
if err != nil {
return fmt.Errorf("failed to marshal result: %v", err)
}
if err := json.Unmarshal(jsonData, target); err != nil {
return fmt.Errorf("failed to unmarshal to target: %v", err)
}
return nil
}

View File

@@ -29,48 +29,48 @@ func NewHTTPSender(baseURL string) *HTTPSender {
func (h *HTTPSender) Send(req *Request) (*Response, error) {
// Build request URL
url := fmt.Sprintf("%s/api/rpc", h.BaseURL)
// Serialize request
reqBody, err := json.Marshal(req)
if err != nil {
return nil, fmt.Errorf("failed to marshal request: %w", err)
}
// Create HTTP request
httpReq, err := http.NewRequest("POST", url, bytes.NewReader(reqBody))
if err != nil {
return nil, fmt.Errorf("failed to create HTTP request: %w", err)
}
// Set request headers
httpReq.Header.Set("Content-Type", "application/json")
httpReq.Header.Set("Accept", "application/json")
// Authentication info already included in JSON request body's auth field, no extra HTTP headers needed
// Send request
httpResp, err := h.Client.Do(httpReq)
if err != nil {
return nil, fmt.Errorf("HTTP request failed: %w", err)
}
defer httpResp.Body.Close()
// Read response
respBody, err := io.ReadAll(httpResp.Body)
if err != nil {
return nil, fmt.Errorf("failed to read response body: %w", err)
}
// Check HTTP status code
if httpResp.StatusCode != 200 {
return nil, fmt.Errorf("HTTP error %d: %s", httpResp.StatusCode, string(respBody))
}
// Parse response
var response Response
if err := json.Unmarshal(respBody, &response); err != nil {
return nil, fmt.Errorf("failed to unmarshal response: %w", err)
}
return &response, nil
}

View File

@@ -17,41 +17,41 @@ import (
// LoginTerminus implements Terminus login functionality (ref: BindTerminusBusiness.ts loginTerminus)
func LoginTerminus(bflUrl, terminusName, localName, password string, needTwoFactor bool) (*Token, error) {
log.Printf("Starting loginTerminus for user: %s", terminusName)
// 1. Call onFirstFactor to get initial token (ref: loginTerminus line 364-372)
token, err := OnFirstFactor(bflUrl, terminusName, localName, password, true, needTwoFactor)
if err != nil {
return nil, fmt.Errorf("first factor authentication failed: %v", err)
}
log.Printf("First factor completed, session_id: %s, FA2 required: %t", token.SessionID, token.FA2 || needTwoFactor)
// 2. If second factor authentication is required (ref: loginTerminus line 379-446)
if token.FA2 || needTwoFactor {
log.Printf("Second factor authentication required")
// Get TOTP value
totpValue, err := getTOTPFromMFA()
if err != nil {
return nil, fmt.Errorf("failed to get TOTP: %v", err)
}
log.Printf("Generated TOTP: %s", totpValue)
// Perform second factor authentication
secondToken, err := performSecondFactor(bflUrl, terminusName, totpValue)
if err != nil {
return nil, fmt.Errorf("second factor authentication failed: %v", err)
}
// Update token information
token.AccessToken = secondToken.AccessToken
token.RefreshToken = secondToken.RefreshToken
token.SessionID = secondToken.SessionID
log.Printf("Second factor completed, updated session_id: %s", token.SessionID)
}
log.Printf("LoginTerminus completed successfully")
return token, nil
}
@@ -63,19 +63,19 @@ func getTOTPFromMFA() (string, error) {
if err != nil {
return "", fmt.Errorf("MFA token not found: %v", err)
}
log.Printf("Using MFA token for TOTP generation: %s", mfa)
// Generate TOTP (ref: TypeScript hotp function)
currentTime := time.Now().Unix()
interval := int64(30) // 30 second interval
counter := currentTime / interval
totp, err := generateHOTP(mfa, counter)
if err != nil {
return "", fmt.Errorf("failed to generate TOTP: %v", err)
}
return totp, nil
}
@@ -83,107 +83,107 @@ func getTOTPFromMFA() (string, error) {
func generateHOTP(secret string, counter int64) (string, error) {
// Process base32 string: remove spaces, convert to uppercase, handle padding
cleanSecret := strings.ToUpper(strings.ReplaceAll(secret, " ", ""))
// Add padding characters if needed
padding := len(cleanSecret) % 8
if padding != 0 {
cleanSecret += strings.Repeat("=", 8-padding)
}
// Decode base32 encoded secret to bytes
secretBytes, err := base32.StdEncoding.DecodeString(cleanSecret)
if err != nil {
return "", fmt.Errorf("failed to decode base32 secret: %v", err)
}
// Convert counter to 8-byte big-endian
counterBytes := make([]byte, 8)
for i := 7; i >= 0; i-- {
counterBytes[i] = byte(counter & 0xff)
counter >>= 8
}
// Use HMAC-SHA1 to calculate hash (consistent with TypeScript version)
h := hmac.New(sha1.New, secretBytes)
h.Write(counterBytes)
hash := h.Sum(nil)
// Dynamic truncation (consistent with TypeScript getToken function)
offset := hash[len(hash)-1] & 0xf
code := ((int(hash[offset]) & 0x7f) << 24) |
((int(hash[offset+1]) & 0xff) << 16) |
((int(hash[offset+2]) & 0xff) << 8) |
(int(hash[offset+3]) & 0xff)
// Generate 6-digit number
otp := code % int(math.Pow10(6))
return fmt.Sprintf("%06d", otp), nil
}
// performSecondFactor performs second factor authentication (ref: loginTerminus line 419-446)
func performSecondFactor(baseURL, terminusName, totpValue string) (*Token, error) {
log.Printf("Performing second factor authentication")
// Build target URL
targetURL := fmt.Sprintf("https://desktop.%s/", strings.ReplaceAll(terminusName, "@", "."))
// Build request data
reqData := map[string]interface{}{
"targetUrl": targetURL,
"token": totpValue,
}
jsonData, err := json.Marshal(reqData)
if err != nil {
return nil, fmt.Errorf("failed to marshal request: %v", err)
}
// Send HTTP request
client := &http.Client{
Timeout: 10 * time.Second,
}
url := fmt.Sprintf("%s/api/secondfactor/totp", baseURL)
req, err := http.NewRequest("POST", url, strings.NewReader(string(jsonData)))
if err != nil {
return nil, fmt.Errorf("failed to create request: %v", err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Access-Control-Allow-Origin", "*")
req.Header.Set("X-Unauth-Error", "Non-Redirect")
log.Printf("Sending second factor request to: %s", url)
resp, err := client.Do(req)
if err != nil {
return nil, fmt.Errorf("request failed: %v", err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("failed to read response: %v", err)
}
if resp.StatusCode != 200 {
return nil, fmt.Errorf("HTTP error %d: %s", resp.StatusCode, string(body))
}
var response struct {
Status string `json:"status"`
Data Token `json:"data"`
}
if err := json.Unmarshal(body, &response); err != nil {
return nil, fmt.Errorf("failed to unmarshal response: %v", err)
}
if response.Status != "OK" {
return nil, fmt.Errorf("second factor authentication failed: %s", response.Status)
}
log.Printf("Second factor authentication successful")
return &response.Data, nil
}
@@ -191,69 +191,69 @@ func performSecondFactor(baseURL, terminusName, totpValue string) (*Token, error
// ResetPassword implements password reset functionality (ref: account.ts reset_password)
func ResetPassword(baseURL, localName, currentPassword, newPassword, accessToken string) error {
log.Printf("Starting reset password for user: %s", localName)
// Process passwords (salted MD5)
processedCurrentPassword := passwordAddSort(currentPassword)
processedNewPassword := passwordAddSort(newPassword)
// Build request data (ref: account.ts line 138-141)
reqData := map[string]interface{}{
"current_password": processedCurrentPassword,
"password": processedNewPassword,
}
jsonData, err := json.Marshal(reqData)
if err != nil {
return fmt.Errorf("failed to marshal request: %v", err)
}
// Create HTTP client (ref: account.ts line 128-135)
client := &http.Client{
Timeout: 10 * time.Second,
}
// Build request URL (ref: account.ts line 136-137)
url := fmt.Sprintf("%s/bfl/iam/v1alpha1/users/%s/password", baseURL, localName)
req, err := http.NewRequest("PUT", url, strings.NewReader(string(jsonData)))
if err != nil {
return fmt.Errorf("failed to create request: %v", err)
}
// Set request headers (ref: account.ts line 131-134)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Authorization", accessToken)
log.Printf("Sending reset password request to: %s", url)
// Send request
resp, err := client.Do(req)
if err != nil {
return fmt.Errorf("request failed: %v", err)
}
defer resp.Body.Close()
// Read response
body, err := io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("failed to read response: %v", err)
}
// Check HTTP status code (ref: account.ts line 144-146)
if resp.StatusCode != 200 {
return fmt.Errorf("HTTP error %d: %s", resp.StatusCode, string(body))
}
// Parse response
var response struct {
Code int `json:"code"`
Message string `json:"message"`
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data"`
}
if err := json.Unmarshal(body, &response); err != nil {
return fmt.Errorf("failed to unmarshal response: %v", err)
}
// Check response status (ref: account.ts line 148-155)
if response.Code != 0 {
if response.Message != "" {
@@ -261,7 +261,7 @@ func ResetPassword(baseURL, localName, currentPassword, newPassword, accessToken
}
return fmt.Errorf("password reset failed: network error")
}
log.Printf("Password reset completed successfully")
return nil
}

Some files were not shown because too many files have changed in this diff Show More