Skip to content

Commit

Permalink
CI pipeline to run deploy on localhost
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Chua<[email protected]>
  • Loading branch information
jchua99 committed Dec 1, 2023
1 parent 5e29798 commit 7d8bc2f
Show file tree
Hide file tree
Showing 20 changed files with 316 additions and 124 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/build_openyurt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build and Test OpenYurt Deployer

on:
push:
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support ]
paths-ignore:
- 'docs/**'
- '**.md'
pull_request:
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support, openyurt ]
paths-ignore:
- 'docs/**'
- '**.md'
workflow_dispatch:

env:
GOOS: linux
GO111MODULE: on

jobs:
build_openyurt:
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.19
uses: actions/setup-go@v4
with:
go-version: '1.19'

- name: Check out the code
uses: actions/checkout@v4

- name: modify JSON conf
uses: restackio/[email protected]
with:
file: scripts/openyurt-deployer/conf.json
fields: "{\"master\": \"[email protected]\", \"workers\": {\"cloud\": [], \"edge\": [] }}"

- name: Build scripts
run:
pushd scripts/openyurt-deployer && go build -o oy_deploy && popd

- name: Show scripts help info
run:
./scripts/openyurt-deployer/oy_deploy help

- name: Allow root login
run: |
echo "PermitRootLogin=yes" | sudo tee -a /etc/ssh/sshd_config
- name: Set up SSH and run deploy
run: |
echo $USER
sudo apt-get update
sudo apt-get install -y openssh-server
sudo service ssh start
eval "$(ssh-agent -s)"
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N ""
cat > ~/.ssh/config <<EOF
Host host.example
User $USER
HostName 127.0.0.1
IdentityFile ~/.ssh/id_rsa
EOF
echo -n '' | cat - ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys
sudo service ssh restart
service ssh status
ssh-add ~/.ssh/id_rsa

cat ~/.ssh/authorized_keys
chmod og-rw ~/.ssh

cd scripts/openyurt-deployer
./oy_deploy kube
./oy_deploy knative
3 changes: 3 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww=
10 changes: 10 additions & 0 deletions scripts/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
module github.com/vhive-serverless/vHive/scripts

go 1.19

require github.com/sfreiberg/simplessh v0.0.0-20220719182921-185eafd40485

require (
github.com/davidmz/go-pageant v1.0.2 // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/pkg/sftp v1.13.4 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
)
26 changes: 26 additions & 0 deletions scripts/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davidmz/go-pageant v1.0.2 h1:bPblRCh5jGU+Uptpz6LgMZGD5hJoOt7otgT454WvHn0=
github.com/davidmz/go-pageant v1.0.2/go.mod h1:P2EDDnMqIwG5Rrp05dTRITj9z2zpGcD9efWSkTNKLIE=
github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/pkg/sftp v1.13.4 h1:Lb0RYJCmgUcBgZosfoi9Y9sbl6+LJgOIgk/2Y4YjMFg=
github.com/pkg/sftp v1.13.4/go.mod h1:LzqnAvaD5TWeNBsZpfKxSYn1MbjWwOsCIAFFJbpIsK8=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sfreiberg/simplessh v0.0.0-20220719182921-185eafd40485 h1:ZMBZ2DKX1sScUSo9ZUwGI7jCMukslPNQNfZaw9vVyfY=
github.com/sfreiberg/simplessh v0.0.0-20220719182921-185eafd40485/go.mod h1:9qeq2P58+4+LyuncL3waJDG+giOfXgowfrRZZF9XdWk=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA=
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
6 changes: 5 additions & 1 deletion scripts/openyurt-deployer/configs/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
module github.com/vhive-serverless/vhive/scripts/openyurt_deployer/configs

go 1.20
go 1.20

require github.com/vhive-serverless/vHive/scripts/utils v0.0.0-20231018022901-6a0c478d2c9f

require github.com/vhive-serverless/vHive/scripts/configs v0.0.0-20231018022901-6a0c478d2c9f // indirect
2 changes: 2 additions & 0 deletions scripts/openyurt-deployer/configs/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/vhive-serverless/vHive/scripts/configs v0.0.0-20231018022901-6a0c478d2c9f h1:2Cyd5RJaZ0Pdyk7Az338/PKeofj7RLZjD5rSAO+wqvk=
github.com/vhive-serverless/vHive/scripts/utils v0.0.0-20231018022901-6a0c478d2c9f h1:3KArl/h4PpkhAhlpPAMarh9hrj6AWYfnhkoXZCS2AWw=
9 changes: 6 additions & 3 deletions scripts/openyurt-deployer/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ module github.com/vhive-serverless/vhive/scripts/openyurt_deployer

go 1.20

require (
github.com/sfreiberg/simplessh v0.0.0-20220719182921-185eafd40485
github.com/sirupsen/logrus v1.9.3
github.com/vhive-serverless/vHive/scripts/utils v0.0.0-20231018022901-6a0c478d2c9f
)

require (
github.com/davidmz/go-pageant v1.0.2 // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/pkg/sftp v1.13.4 // indirect
github.com/sfreiberg/simplessh v0.0.0-20220719182921-185eafd40485 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/vhive-serverless/vHive/scripts/configs v0.0.0-20231018022901-6a0c478d2c9f // indirect
github.com/vhive-serverless/vHive/scripts/utils v0.0.0-20231018022901-6a0c478d2c9f // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
)
7 changes: 5 additions & 2 deletions scripts/openyurt-deployer/go.sum
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davidmz/go-pageant v1.0.2 h1:bPblRCh5jGU+Uptpz6LgMZGD5hJoOt7otgT454WvHn0=
github.com/davidmz/go-pageant v1.0.2/go.mod h1:P2EDDnMqIwG5Rrp05dTRITj9z2zpGcD9efWSkTNKLIE=
github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/pkg/sftp v1.13.4 h1:Lb0RYJCmgUcBgZosfoi9Y9sbl6+LJgOIgk/2Y4YjMFg=
github.com/pkg/sftp v1.13.4/go.mod h1:LzqnAvaD5TWeNBsZpfKxSYn1MbjWwOsCIAFFJbpIsK8=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sfreiberg/simplessh v0.0.0-20220719182921-185eafd40485 h1:ZMBZ2DKX1sScUSo9ZUwGI7jCMukslPNQNfZaw9vVyfY=
github.com/sfreiberg/simplessh v0.0.0-20220719182921-185eafd40485/go.mod h1:9qeq2P58+4+LyuncL3waJDG+giOfXgowfrRZZF9XdWk=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/vhive-serverless/vHive/scripts/configs v0.0.0-20231018022901-6a0c478d2c9f h1:2Cyd5RJaZ0Pdyk7Az338/PKeofj7RLZjD5rSAO+wqvk=
github.com/vhive-serverless/vHive/scripts/configs v0.0.0-20231018022901-6a0c478d2c9f/go.mod h1:nJSon4Eng7PdZ4HJX9dnZ7H4qxVm/r5zseFPfom7Jto=
Expand All @@ -24,12 +27,12 @@ golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
15 changes: 8 additions & 7 deletions scripts/openyurt-deployer/go.work
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
go 1.19
go 1.20

use(
.
./configs
./node
./template
)
use (
.
./configs
./helper
./node
./template
)
7 changes: 7 additions & 0 deletions scripts/openyurt-deployer/helper/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module github.com/vhive-serverless/vhive/scripts/openyurt_deployer/helper

go 1.20

require github.com/vhive-serverless/vHive/scripts/utils v0.0.0-20231018022901-6a0c478d2c9f

require github.com/vhive-serverless/vHive/scripts/configs v0.0.0-20231018022901-6a0c478d2c9f // indirect
2 changes: 2 additions & 0 deletions scripts/openyurt-deployer/helper/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/vhive-serverless/vHive/scripts/configs v0.0.0-20231018022901-6a0c478d2c9f h1:2Cyd5RJaZ0Pdyk7Az338/PKeofj7RLZjD5rSAO+wqvk=
github.com/vhive-serverless/vHive/scripts/utils v0.0.0-20231018022901-6a0c478d2c9f h1:3KArl/h4PpkhAhlpPAMarh9hrj6AWYfnhkoXZCS2AWw=
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
package main
package helper

import (
"fmt"
"os"
"strings"

"github.com/sfreiberg/simplessh"
"github.com/vhive-serverless/vHive/scripts/utils"
)

func SetupSSHConn(nodeName string) *simplessh.Client {
utils.InfoPrintf("Connecting to %s\n", nodeName)
splits := strings.Split(nodeName, "@")
username := splits[0]
host := splits[1]
client, err := simplessh.ConnectWithAgent(host, username)
func CheckErrorExit(err error, format string, pars ...any) {
if err != nil {
utils.FatalPrintf("Failed to connect to: %s:%s\n", nodeName, err)
utils.ErrorPrintf("%v\n", err)
utils.FatalPrintf(format, pars...)
os.Exit(1)
}
return client
}

type ShellError struct {
Expand All @@ -28,3 +25,15 @@ type ShellError struct {
func (err *ShellError) Error() string {
return fmt.Sprintf("[exit %d] -> %s", err.exitCode, err.msg)
}

func SetupSSHConn(nodeName string) *simplessh.Client {
utils.InfoPrintf("Connecting to %s\n", nodeName)
splits := strings.Split(nodeName, "@")
username := splits[0]
host := splits[1]
client, err := simplessh.ConnectWithAgent(host, username)
if err != nil {
utils.FatalPrintf("Failed to connect to: %s:%s\n", nodeName, err)
}
return client
}
30 changes: 20 additions & 10 deletions scripts/openyurt-deployer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

log "github.com/sirupsen/logrus"
"github.com/vhive-serverless/vhive/scripts/openyurt_deployer/configs"
helper "github.com/vhive-serverless/vhive/scripts/openyurt_deployer/helper"
"github.com/vhive-serverless/vhive/scripts/openyurt_deployer/node"
)

Expand Down Expand Up @@ -59,8 +60,10 @@ func main() {
}
operation := os.Args[1]
switch operation {
case "deploy":
case "kube":
deployNodes(*deployerConf)
case "knative":
deployKnative(*deployerConf)
// case "clean":
// cleanNodes(*deployerConf)
// case "demo-e":
Expand All @@ -73,6 +76,8 @@ func main() {
// printDemo(*deployerConf)
case "deploy-yurt":
deployOpenYurt(*deployerConf)
case "help":
utils.InfoPrintf("Usage: %s <operation: deploy | clean | demo-c | demo-e | demo-clear | demo-print> [Parameters...]\n", os.Args[0])
default:
utils.InfoPrintf("Usage: %s <operation: deploy | clean | demo-c | demo-e | demo-clear | demo-print> [Parameters...]\n", os.Args[0])
os.Exit(-1)
Expand Down Expand Up @@ -107,15 +112,15 @@ func parseNodeInfo(nodesInfo NodesInfo) []node.Node {
configs.Knative.LoadConfig()
configs.Kube.LoadConfig()

masterNode := node.Node{Name: masterName, Client: SetupSSHConn(masterName), NodeRole: "master", Configs: &node.NodeConfig{
masterNode := node.Node{Name: masterName, Client: helper.SetupSSHConn(masterName), NodeRole: "master", Configs: &node.NodeConfig{
System: configs.System,
Kube: configs.Kube,
Knative: configs.Knative,
Yurt: configs.Yurt,
Demo: configs.Demo}}
nodeList = append(nodeList, masterNode)
for _, name := range cloudNames {
nodeList = append(nodeList, node.Node{Name: name, Client: SetupSSHConn(name), NodeRole: "cloud", Configs: &node.NodeConfig{
nodeList = append(nodeList, node.Node{Name: name, Client: helper.SetupSSHConn(name), NodeRole: "cloud", Configs: &node.NodeConfig{
System: configs.System,
Kube: configs.Kube,
Knative: configs.Knative,
Expand All @@ -124,7 +129,7 @@ func parseNodeInfo(nodesInfo NodesInfo) []node.Node {
}

for _, name := range edgeNames {
nodeList = append(nodeList, node.Node{Name: name, Client: SetupSSHConn(name), NodeRole: "edge", Configs: &node.NodeConfig{
nodeList = append(nodeList, node.Node{Name: name, Client: helper.SetupSSHConn(name), NodeRole: "edge", Configs: &node.NodeConfig{
System: configs.System,
Kube: configs.Kube,
Knative: configs.Knative,
Expand Down Expand Up @@ -154,7 +159,7 @@ func initializeNodes(nodesInfo NodesInfo) []node.Node {
func deployNodes(deployerConfFile string) {

nodesInfo, err := readAndUnMarshall(deployerConfFile)
utils.CheckErrorWithMsg(err, "Failed to read and unmarshal deployer configuration JSON")
helper.CheckErrorExit(err, "Failed to read and unmarshal deployer configuration JSON")
nodeList := initializeNodes(nodesInfo)
masterNode := nodeList[0]
workerNodes := nodeList[1:]
Expand All @@ -174,21 +179,26 @@ func deployNodes(deployerConfFile string) {
utils.InfoPrintf(name)
}
utils.InfoPrintf("]\n")
}

func deployKnative(deployerConfFile string) {

nodesInfo, err := readAndUnMarshall(deployerConfFile)
helper.CheckErrorExit(err, "Failed to read and unmarshal deployer configuration JSON")
nodeList := parseNodeInfo(nodesInfo)
masterNode := nodeList[0]

// init knative
utils.SuccessPrintf("Start to init knative\n")
masterNode.InstallKnativeServing()
masterNode.InstallKnativeEventing()
utils.SuccessPrintf("Knative has been installed!\n")

// init demo environment
masterNode.BuildDemo(workerNodes)
}

func deployOpenYurt(deployerConfFile string) {

nodesInfo, err := readAndUnMarshall(deployerConfFile)
utils.CheckErrorWithMsg(err, "Failed to read and unmarshal deployer configuration JSON")
helper.CheckErrorExit(err, "Failed to read and unmarshal deployer configuration JSON")
nodeList := initializeNodes(nodesInfo)
masterNode := nodeList[0]
workerNodes := nodeList[1:]
Expand All @@ -199,7 +209,7 @@ func deployOpenYurt(deployerConfFile string) {

utils.WaitPrintf("Extracting master node information from logs")
output, err := masterNode.ExecShellCmd("sed -n '1p;2p;3p;4p' %s/masterNodeValues", masterNode.Configs.System.TmpDir)
utils.CheckErrorWithMsg(err, "Failed to extract master node information from logs!\n")
helper.CheckErrorExit(err, "Failed to extract master node information from logs!\n")

// Process the content and assign it to variables
lines := strings.Split(strings.TrimSpace(output), "\n")
Expand Down
15 changes: 15 additions & 0 deletions scripts/openyurt-deployer/node/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
module github.com/vhive-serverless/vhive/scripts/openyurt_deployer/node

go 1.20

require (
github.com/sfreiberg/simplessh v0.0.0-20220719182921-185eafd40485
github.com/vhive-serverless/vHive/scripts/utils v0.0.0-20231018022901-6a0c478d2c9f
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davidmz/go-pageant v1.0.2 // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/pkg/sftp v1.13.4 // indirect
github.com/vhive-serverless/vHive/scripts/configs v0.0.0-20231018022901-6a0c478d2c9f // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
)
Loading

0 comments on commit 7d8bc2f

Please sign in to comment.