This repository has been archived by the owner on Nov 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support fixed ip for container without label (#3)
Co-authored-by: nyanpassu <nyanpassu@outlook.com>
- Loading branch information
雾雨
and
nyanpassu
authored
Jul 24, 2020
1 parent
38787c8
commit bee196f
Showing
5 changed files
with
134 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,51 @@ | ||
cp --parents /eru/minions.conf /etc/ | ||
cp eru-minions.service /usr/lib/systemd/system/ | ||
#!/bin/bash | ||
declare -a FILES=( | ||
"minions.conf" "/etc/eru/" | ||
"eru-minions" "/usr/bin/" | ||
"eru-minions.service" "/usr/lib/systemd/system/" | ||
) | ||
|
||
clear_file () { | ||
if [ -e "$1" ]; | ||
then | ||
echo "remove $1" | ||
rm $1 | ||
else | ||
echo "$1 not exists" | ||
fi | ||
} | ||
|
||
copy_file () { | ||
echo "copy $1 to $2" | ||
cp $1 $2 | ||
} | ||
|
||
if [ -d "/etc/eru" ]; | ||
then | ||
echo "/etc/eru exists" | ||
else | ||
echo "create /etc/eru" | ||
mkdir -p /etc/eru | ||
fi | ||
|
||
echo "===stop service===" | ||
systemctl stop eru-minions.service | ||
systemctl disable eru-minions.service | ||
|
||
echo "===remove old files===" | ||
for i in $(eval echo "{0..$((${#FILES[@]} - 1))..2}") | ||
do | ||
clear_file "${FILES[$((i + 1))]}${FILES[${i}]}" | ||
done | ||
|
||
echo "===copy new files===" | ||
for i in $(eval echo "{0..$((${#FILES[@]} - 1))..2}") | ||
do | ||
copy_file "${FILES[${i}]}" "${FILES[$((i + 1))]}" | ||
done | ||
|
||
echo "===start service===" | ||
systemctl enable eru-minions.service | ||
systemctl start eru-minions.service | ||
systemctl start eru-minions.service | ||
|
||
echo "===minions install success===" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package lib | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
|
||
"github.com/coreos/etcd/mvcc/mvccpb" | ||
) | ||
|
||
// ReserveRequest . | ||
type ReserveRequest struct { | ||
Address string | ||
version int64 | ||
} | ||
|
||
// Key . | ||
func (req *ReserveRequest) Key() string { | ||
if req.Address == "" { | ||
return "" | ||
} | ||
return fmt.Sprintf("/barrel/reservereq/%s", req.Address) | ||
} | ||
|
||
// Read . | ||
func (req *ReserveRequest) Read(ekv *mvccpb.KeyValue) error { | ||
req.version = ekv.Version | ||
return json.Unmarshal(ekv.Value, req) | ||
} | ||
|
||
// JSON . | ||
func (req *ReserveRequest) JSON() string { | ||
return fmt.Sprintf(`{"Address":"%s"}`, req.Address) | ||
} | ||
|
||
// Version . | ||
func (req *ReserveRequest) Version() int64 { | ||
return req.version | ||
} |