mirror of
https://github.com/beclab/Olares
synced 2026-04-21 13:37:46 +00:00
* feat(connector): add functions to detect Mthreads AI Book and RockChip models * feat(gpu): add MThreads GPU support and related modules * fix(cli): remove redundant import of amdgpu package * chore(cli): remove unnecessary tasks when adding node --------- Co-authored-by: dkeven <dkvvven@gmail.com>
116 lines
3.1 KiB
Go
116 lines
3.1 KiB
Go
package cluster
|
|
|
|
import (
|
|
"github.com/beclab/Olares/cli/pkg/common"
|
|
"github.com/beclab/Olares/cli/pkg/core/module"
|
|
"github.com/beclab/Olares/cli/pkg/gpu"
|
|
"github.com/beclab/Olares/cli/pkg/gpu/amdgpu"
|
|
"github.com/beclab/Olares/cli/pkg/gpu/mtgpu"
|
|
"github.com/beclab/Olares/cli/pkg/kubesphere/plugins"
|
|
"github.com/beclab/Olares/cli/pkg/manifest"
|
|
"github.com/beclab/Olares/cli/pkg/storage"
|
|
"github.com/beclab/Olares/cli/pkg/terminus"
|
|
)
|
|
|
|
type linuxInstallPhaseBuilder struct {
|
|
runtime *common.KubeRuntime
|
|
manifestMap manifest.InstallationManifest
|
|
}
|
|
|
|
func (l *linuxInstallPhaseBuilder) base() phase {
|
|
m := []module.Module{
|
|
&plugins.CopyEmbed{},
|
|
&terminus.CheckPreparedModule{Force: true},
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
func (l *linuxInstallPhaseBuilder) storage() phase {
|
|
return []module.Module{
|
|
&storage.InstallRedisModule{
|
|
ManifestModule: manifest.ManifestModule{
|
|
Manifest: l.manifestMap,
|
|
BaseDir: l.runtime.GetBaseDir(),
|
|
},
|
|
},
|
|
&storage.InstallJuiceFsModule{
|
|
ManifestModule: manifest.ManifestModule{
|
|
Manifest: l.manifestMap,
|
|
BaseDir: l.runtime.GetBaseDir(),
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
func (l *linuxInstallPhaseBuilder) installCluster() phase {
|
|
kubeType := l.runtime.Arg.Kubetype
|
|
if kubeType == common.K3s {
|
|
return NewK3sCreateClusterPhase(l.runtime, l.manifestMap)
|
|
} else {
|
|
return NewCreateClusterPhase(l.runtime, l.manifestMap)
|
|
}
|
|
}
|
|
|
|
func (l *linuxInstallPhaseBuilder) installGpuPlugin() phase {
|
|
var skipGpuPlugin = !l.runtime.Arg.GPU.Enable
|
|
if l.runtime.GetSystemInfo().IsWsl() {
|
|
skipGpuPlugin = false
|
|
}
|
|
return []module.Module{
|
|
&gpu.RestartK3sServiceModule{Skip: !(l.runtime.Arg.Kubetype == common.K3s)},
|
|
&gpu.InstallPluginModule{Skip: skipGpuPlugin},
|
|
&amdgpu.InstallAmdPluginModule{Skip: func() bool {
|
|
if l.runtime.GetSystemInfo().IsAmdGPUOrAPU() {
|
|
return false
|
|
}
|
|
return true
|
|
}()},
|
|
&mtgpu.InstallMThreadsPluginModule{Skip: func() bool {
|
|
if l.runtime.GetSystemInfo().IsMThreadsM1000() {
|
|
return false
|
|
}
|
|
return true
|
|
}()},
|
|
}
|
|
}
|
|
|
|
func (l *linuxInstallPhaseBuilder) installTerminus() phase {
|
|
return []module.Module{
|
|
&terminus.GetNATGatewayIPModule{},
|
|
&terminus.InstallAccountModule{},
|
|
&terminus.InstallSettingsModule{},
|
|
&terminus.InstallOsSystemModule{},
|
|
&terminus.InstallLauncherModule{},
|
|
&terminus.InstallAppsModule{},
|
|
}
|
|
}
|
|
|
|
func (l *linuxInstallPhaseBuilder) installBackup() phase {
|
|
return []module.Module{
|
|
&terminus.InstallVeleroModule{
|
|
ManifestModule: manifest.ManifestModule{
|
|
Manifest: l.manifestMap,
|
|
BaseDir: l.runtime.GetBaseDir(),
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
func (l *linuxInstallPhaseBuilder) build() []module.Module {
|
|
return l.base().
|
|
addModule(fsModuleBuilder(func() []module.Module {
|
|
return l.storage()
|
|
}).withJuiceFS(l.runtime)...).
|
|
addModule(l.installCluster()...).
|
|
addModule(gpuModuleBuilder(func() []module.Module {
|
|
return l.installGpuPlugin()
|
|
}).withGPU(l.runtime)...).
|
|
addModule(l.installTerminus()...).
|
|
addModule(backupModuleBuilder(func() []module.Module {
|
|
return l.installBackup()
|
|
}).withBackup(l.runtime)...).
|
|
addModule(&terminus.InstalledModule{}).
|
|
addModule(&terminus.WriteReleaseFileModule{}).
|
|
addModule(&terminus.WelcomeModule{})
|
|
}
|