[ Cmii ] [ Octopus ] - project a lot
This commit is contained in:
@@ -244,9 +244,12 @@ func UniformAgentServerInfo(agentServerInfo *register.AgentServerInfo) {
|
||||
func BuildAgentOsOperator(agentInfo *status.AgentInfo, agentServerInfo *register.AgentServerInfo) {
|
||||
|
||||
// 2023年8月4日 pass through some key information
|
||||
ossOfflinePrefix := g.G.AgentConfig.GetString("octopus.agent.executor.ossOfflinePrefix")
|
||||
if !strings.HasSuffix(ossOfflinePrefix, "/") {
|
||||
ossOfflinePrefix += "/"
|
||||
ossOfflinePrefix := "http://bastion.io"
|
||||
if g.G.AgentConfig != nil {
|
||||
ossOfflinePrefix := g.G.AgentConfig.GetString("octopus.agent.executor.ossOfflinePrefix")
|
||||
if !strings.HasSuffix(ossOfflinePrefix, "/") {
|
||||
ossOfflinePrefix += "/"
|
||||
}
|
||||
}
|
||||
|
||||
// call the init exec function
|
||||
|
||||
55
agent-go/BastionInitializaion.go
Normal file
55
agent-go/BastionInitializaion.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"wdd.io/agent-go/executor"
|
||||
"wdd.io/agent-go/register"
|
||||
"wdd.io/agent-go/status"
|
||||
)
|
||||
|
||||
func BastionModeInit() {
|
||||
|
||||
// Build For Operator
|
||||
agentServerInfo := ®ister.AgentServerInfo{
|
||||
ServerName: "BastionSingle",
|
||||
ServerIPPbV4: "127.0.0.1",
|
||||
ServerIPInV4: "127.0.0.1",
|
||||
ServerIPPbV6: "",
|
||||
ServerIPInV6: "",
|
||||
Location: "Bastion",
|
||||
Provider: "Bastion",
|
||||
ManagePort: "22",
|
||||
CPUCore: "",
|
||||
CPUBrand: "",
|
||||
OSInfo: "",
|
||||
OSKernelInfo: "",
|
||||
TCPControl: "",
|
||||
Virtualization: "",
|
||||
Platform: "",
|
||||
PlatformFamily: "",
|
||||
PlatformVersion: "",
|
||||
KernelVersion: "",
|
||||
KernelArch: "",
|
||||
IoSpeed: "",
|
||||
MemoryTotal: "",
|
||||
DiskTotal: "",
|
||||
DiskUsage: "",
|
||||
Comment: "",
|
||||
MachineID: "",
|
||||
AgentVersion: "",
|
||||
TopicName: "BastionNode",
|
||||
}
|
||||
|
||||
// re-get agentInfo from status module
|
||||
agentInfo := status.ReportAgentInfo()
|
||||
refreshAgentInfoByStatusInfo(agentInfo, agentServerInfo)
|
||||
BuildAgentOsOperator(agentInfo, agentServerInfo)
|
||||
|
||||
// install docker
|
||||
agentOsOperator := executor.AgentOsOperatorCache
|
||||
// boot up minio & rabbitmq
|
||||
agentOsOperator.InstallDockerFromLocalExec(nil)
|
||||
agentOsOperator.InstallDockerComposeFromLocalExec()
|
||||
|
||||
// build for socks server
|
||||
|
||||
}
|
||||
BIN
agent-go/bastion_mode_init/amd64/socks5_linux_amd64
Normal file
BIN
agent-go/bastion_mode_init/amd64/socks5_linux_amd64
Normal file
Binary file not shown.
BIN
agent-go/bastion_mode_init/arm64/socks5_linux_arm64
Normal file
BIN
agent-go/bastion_mode_init/arm64/socks5_linux_arm64
Normal file
Binary file not shown.
15
agent-go/bastion_mode_init/bastion_mode.sh
Normal file
15
agent-go/bastion_mode_init/bastion_mode.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 需要修改的部分
|
||||
# 需要修改的部分
|
||||
|
||||
# Socks5
|
||||
install_socks5() {
|
||||
|
||||
}
|
||||
# MINIO 安装
|
||||
install_minio_server() {
|
||||
|
||||
}
|
||||
##
|
||||
# RabbitMQ 安装 初始化
|
||||
@@ -796,7 +796,7 @@ func (op *AgentOsOperator) deployIngress(funcArgs []string) (bool, []string) {
|
||||
}
|
||||
parseIP = net.ParseIP(funcArgs[3])
|
||||
if parseIP == nil {
|
||||
return false, append(result, "ip args error !")
|
||||
return false, append(result, "替换A1C1IP信息 ip args error !")
|
||||
}
|
||||
if !BasicReplace(k8sIngressYamlFile, "A1C1IP", funcArgs[3]) {
|
||||
result = append(result, "替换A1C1IP信息")
|
||||
|
||||
@@ -935,6 +935,12 @@ func (op *AgentOsOperator) installDockerOfflineExec(args []string) (bool, []stri
|
||||
"[installDockerOfflineExec] - docker offline installation success!",
|
||||
}
|
||||
}
|
||||
func (op *AgentOsOperator) InstallDockerFromLocalExec(args []string) (bool, []string) {
|
||||
|
||||
return true, []string{
|
||||
"[installDockerFromLocalExec] - docker offline installation from local success!",
|
||||
}
|
||||
}
|
||||
|
||||
func (op *AgentOsOperator) removeDockerCompose() [][]string {
|
||||
|
||||
@@ -1021,6 +1027,13 @@ func (op *AgentOsOperator) installDockerComposeExec() (bool, []string) {
|
||||
log.Info("docker-compose安装成功!")
|
||||
return true, []string{"docker-compose安装成功!"}
|
||||
}
|
||||
|
||||
func (op *AgentOsOperator) InstallDockerComposeFromLocalExec() (bool, []string) {
|
||||
return true, []string{
|
||||
"[installDockerComposeFromLocalExec] - docker-compose offline installation from local success!",
|
||||
}
|
||||
}
|
||||
|
||||
func (op *AgentOsOperator) installHelm() [][]string {
|
||||
installHelmFunc := [][]string{
|
||||
{
|
||||
@@ -1067,31 +1080,31 @@ func (op *AgentOsOperator) installHelm() [][]string {
|
||||
}
|
||||
|
||||
/*if op.IsOsTypeUbuntu {
|
||||
installHelmFunc = [][]string{
|
||||
{
|
||||
"curl",
|
||||
"-o",
|
||||
"/etc/apt/keyrings/helm.gpg",
|
||||
"https://baltocdn.com/helm/signing.asc",
|
||||
},
|
||||
{
|
||||
"apt-key",
|
||||
"add",
|
||||
"/etc/apt/keyrings/helm.gpg",
|
||||
},
|
||||
{
|
||||
"add-apt-repository",
|
||||
"https://baltocdn.com/helm/stable/debian/ all main",
|
||||
},
|
||||
{
|
||||
"apt-get",
|
||||
"update",
|
||||
},
|
||||
append(op.InstallCommandPrefix, "helm"),
|
||||
}
|
||||
} else {
|
||||
log.ErrorF("Operation OS is CentOS, Helm not installed!")
|
||||
}*/
|
||||
installHelmFunc = [][]string{
|
||||
{
|
||||
"curl",
|
||||
"-o",
|
||||
"/etc/apt/keyrings/helm.gpg",
|
||||
"https://baltocdn.com/helm/signing.asc",
|
||||
},
|
||||
{
|
||||
"apt-key",
|
||||
"add",
|
||||
"/etc/apt/keyrings/helm.gpg",
|
||||
},
|
||||
{
|
||||
"add-apt-repository",
|
||||
"https://baltocdn.com/helm/stable/debian/ all main",
|
||||
},
|
||||
{
|
||||
"apt-get",
|
||||
"update",
|
||||
},
|
||||
append(op.InstallCommandPrefix, "helm"),
|
||||
}
|
||||
} else {
|
||||
log.ErrorF("Operation OS is CentOS, Helm not installed!")
|
||||
}*/
|
||||
|
||||
return installHelmFunc
|
||||
}
|
||||
|
||||
@@ -15,9 +15,15 @@ func main() {
|
||||
// 解析命令行参数
|
||||
var version string
|
||||
var agentServerInfoConf string
|
||||
var mode string
|
||||
flag.StringVar(&version, "version", "", "config file version")
|
||||
flag.StringVar(&mode, "mode", "agent", "agent run mode")
|
||||
flag.StringVar(&agentServerInfoConf, "agentServerInfoConf", "", "agent server info conf file")
|
||||
flag.Parse()
|
||||
if mode == "bastion" {
|
||||
BastionModeInit()
|
||||
return
|
||||
}
|
||||
// 读取对应版本的配置文件
|
||||
filename := fmt.Sprintf("octopus-agent-%s.yaml", version)
|
||||
println("config file name is => " + filename)
|
||||
|
||||
Reference in New Issue
Block a user