Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
3fc177ff
Commit
3fc177ff
authored
Nov 18, 2016
by
gmarek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow storing events on a separate disk
parent
3b43ce8e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
25 deletions
+47
-25
start-kubemark-master.sh
test/kubemark/start-kubemark-master.sh
+31
-24
start-kubemark.sh
test/kubemark/start-kubemark.sh
+13
-1
stop-kubemark.sh
test/kubemark/stop-kubemark.sh
+3
-0
No files found.
test/kubemark/start-kubemark-master.sh
View file @
3fc177ff
...
@@ -19,7 +19,9 @@
...
@@ -19,7 +19,9 @@
EVENT_STORE_IP
=
$1
EVENT_STORE_IP
=
$1
EVENT_STORE_URL
=
"http://
${
EVENT_STORE_IP
}
:4002"
EVENT_STORE_URL
=
"http://
${
EVENT_STORE_IP
}
:4002"
NUM_NODES
=
$2
NUM_NODES
=
$2
KUBEMARK_ETCD_IMAGE
=
$3
EVENT_PD
=
$3
# KUBEMARK_ETCD_IMAGE may be empty so it has to be kept as a last argument
KUBEMARK_ETCD_IMAGE
=
$4
if
[[
-z
"
${
KUBEMARK_ETCD_IMAGE
}
"
]]
;
then
if
[[
-z
"
${
KUBEMARK_ETCD_IMAGE
}
"
]]
;
then
# Default etcd version.
# Default etcd version.
KUBEMARK_ETCD_IMAGE
=
"2.2.1"
KUBEMARK_ETCD_IMAGE
=
"2.2.1"
...
@@ -33,17 +35,18 @@ function retry() {
...
@@ -33,17 +35,18 @@ function retry() {
}
}
function
mount-master-pd
()
{
function
mount-master-pd
()
{
if
[[
!
-e
/dev/disk/by-id/google-master-pd
]]
;
then
local
-r
pd_name
=
$1
echo
"Can't find master-pd. Skipping mount."
local
-r
mount_point
=
$2
if
[[
!
-e
"/dev/disk/by-id/
${
pd_name
}
"
]]
;
then
echo
"Can't find
${
pd_name
}
. Skipping mount."
return
return
fi
fi
device_info
=
$(
ls
-l
"/dev/disk/by-id/
google-master-pd
"
)
device_info
=
$(
ls
-l
"/dev/disk/by-id/
${
pd_name
}
"
)
relative_path
=
${
device_info
##*
}
local
relative_path
=
${
device_info
##*
}
pd_device
=
"/dev/disk/by-id/
${
relative_path
}
"
pd_device
=
"/dev/disk/by-id/
${
relative_path
}
"
echo
"Mounting master-pd"
echo
"Mounting master-pd"
local
-r
pd_path
=
"/dev/disk/by-id/google-master-pd"
local
-r
pd_path
=
"/dev/disk/by-id/
${
pd_name
}
"
local
-r
mount_point
=
"/mnt/disks/master-pd"
# Format and mount the disk, create directories on it for all of the master's
# Format and mount the disk, create directories on it for all of the master's
# persistent data, and link them to where they're used.
# persistent data, and link them to where they're used.
mkdir
-p
"
${
mount_point
}
"
mkdir
-p
"
${
mount_point
}
"
...
@@ -57,24 +60,28 @@ function mount-master-pd() {
...
@@ -57,24 +60,28 @@ function mount-master-pd() {
echo
"Mounting '
${
pd_path
}
' at '
${
mount_point
}
'"
echo
"Mounting '
${
pd_path
}
' at '
${
mount_point
}
'"
mount
-o
discard,defaults
"
${
pd_path
}
"
"
${
mount_point
}
"
mount
-o
discard,defaults
"
${
pd_path
}
"
"
${
mount_point
}
"
echo
"Mounted master-pd '
${
pd_path
}
' at '
${
mount_point
}
'"
echo
"Mounted master-pd '
${
pd_path
}
' at '
${
mount_point
}
'"
# Contains all the data stored in etcd.
mkdir
-m
700
-p
"
${
mount_point
}
/var/etcd"
ln
-s
-f
"
${
mount_point
}
/var/etcd"
/var/etcd
mkdir
-p
/etc/srv
# Contains the dynamically generated apiserver auth certs and keys.
mkdir
-p
"
${
mount_point
}
/srv/kubernetes"
ln
-s
-f
"
${
mount_point
}
/srv/kubernetes"
/etc/srv/kubernetes
# Directory for kube-apiserver to store SSH key (if necessary).
mkdir
-p
"
${
mount_point
}
/srv/sshproxy"
ln
-s
-f
"
${
mount_point
}
/srv/sshproxy"
/etc/srv/sshproxy
if
!
id
etcd &>/dev/null
;
then
useradd
-s
/sbin/nologin
-d
/var/etcd etcd
fi
}
}
mount-master-pd
main_etcd_mount_point
=
"/mnt/disks/master-pd"
mount-master-pd
"google-master-pd"
"
${
main_etcd_mount_point
}
"
# Contains all the data stored in etcd.
mkdir
-m
700
-p
"
${
main_etcd_mount_point
}
/var/etcd"
ln
-s
-f
"
${
main_etcd_mount_point
}
/var/etcd"
/var/etcd
mkdir
-p
/etc/srv
# Contains the dynamically generated apiserver auth certs and keys.
mkdir
-p
"
${
main_etcd_mount_point
}
/srv/kubernetes"
ln
-s
-f
"
${
main_etcd_mount_point
}
/srv/kubernetes"
/etc/srv/kubernetes
# Directory for kube-apiserver to store SSH key (if necessary).
mkdir
-p
"
${
main_etcd_mount_point
}
/srv/sshproxy"
ln
-s
-f
"
${
main_etcd_mount_point
}
/srv/sshproxy"
/etc/srv/sshproxy
if
[
"
${
EVENT_PD
:-
false
}
"
==
"true"
]
;
then
event_etcd_mount_point
=
"/mnt/disks/master-event-pd"
mount-master-pd
"google-master-event-pd"
"
${
event_etcd_mount_point
}
"
# Contains all the data stored in event etcd.
mkdir
-m
700
-p
"
${
event_etcd_mount_point
}
/var/etcd/events"
ln
-s
-f
"
${
event_etcd_mount_point
}
/var/etcd/events"
/var/etcd/events
fi
ETCD_QUOTA_BYTES
=
""
ETCD_QUOTA_BYTES
=
""
if
[
"
${
KUBEMARK_ETCD_VERSION
:0:2
}
"
==
"3."
]
;
then
if
[
"
${
KUBEMARK_ETCD_VERSION
:0:2
}
"
==
"3."
]
;
then
...
@@ -87,7 +94,7 @@ fi
...
@@ -87,7 +94,7 @@ fi
if
[
"
${
EVENT_STORE_IP
}
"
==
"127.0.0.1"
]
;
then
if
[
"
${
EVENT_STORE_IP
}
"
==
"127.0.0.1"
]
;
then
# Retry starting etcd to avoid pulling image errors.
# Retry starting etcd to avoid pulling image errors.
retry
sudo
docker run
--net
=
host
\
retry
sudo
docker run
--net
=
host
\
-v
/var/etcd/
data-events
:/var/etcd/data
-v
/var/log:/var/log
-d
\
-v
/var/etcd/
events/data
:/var/etcd/data
-v
/var/log:/var/log
-d
\
gcr.io/google_containers/etcd:
${
KUBEMARK_ETCD_IMAGE
}
/bin/sh
-c
"/usr/local/bin/etcd
\
gcr.io/google_containers/etcd:
${
KUBEMARK_ETCD_IMAGE
}
/bin/sh
-c
"/usr/local/bin/etcd
\
--listen-peer-urls http://127.0.0.1:2381
\
--listen-peer-urls http://127.0.0.1:2381
\
--advertise-client-urls=http://127.0.0.1:4002
\
--advertise-client-urls=http://127.0.0.1:4002
\
...
...
test/kubemark/start-kubemark.sh
View file @
3fc177ff
...
@@ -90,6 +90,13 @@ run-gcloud-compute-with-retries disks create "${MASTER_NAME}-pd" \
...
@@ -90,6 +90,13 @@ run-gcloud-compute-with-retries disks create "${MASTER_NAME}-pd" \
--type
"
${
MASTER_DISK_TYPE
}
"
\
--type
"
${
MASTER_DISK_TYPE
}
"
\
--size
"
${
MASTER_DISK_SIZE
}
"
--size
"
${
MASTER_DISK_SIZE
}
"
if
[
"
${
EVENT_PD
:-
false
}
"
==
"true"
]
;
then
run-gcloud-compute-with-retries disks create
"
${
MASTER_NAME
}
-event-pd"
\
${
GCLOUD_COMMON_ARGS
}
\
--type
"
${
MASTER_DISK_TYPE
}
"
\
--size
"
${
MASTER_DISK_SIZE
}
"
fi
run-gcloud-compute-with-retries addresses create
"
${
MASTER_NAME
}
-ip"
\
run-gcloud-compute-with-retries addresses create
"
${
MASTER_NAME
}
-ip"
\
--project
"
${
PROJECT
}
"
\
--project
"
${
PROJECT
}
"
\
--region
"
${
REGION
}
"
-q
--region
"
${
REGION
}
"
-q
...
@@ -109,6 +116,11 @@ run-gcloud-compute-with-retries instances create "${MASTER_NAME}" \
...
@@ -109,6 +116,11 @@ run-gcloud-compute-with-retries instances create "${MASTER_NAME}" \
--boot-disk-size
"
${
MASTER_ROOT_DISK_SIZE
}
"
\
--boot-disk-size
"
${
MASTER_ROOT_DISK_SIZE
}
"
\
--disk
"name=
${
MASTER_NAME
}
-pd,device-name=master-pd,mode=rw,boot=no,auto-delete=no"
--disk
"name=
${
MASTER_NAME
}
-pd,device-name=master-pd,mode=rw,boot=no,auto-delete=no"
if
[
"
${
EVENT_PD
:-
false
}
"
==
"true"
]
;
then
echo
"Attaching
${
MASTER_NAME
}
-event-pd to
${
MASTER_NAME
}
"
run-gcloud-compute-with-retries instances attach-disk
"
${
MASTER_NAME
}
"
--disk
"
${
MASTER_NAME
}
-event-pd"
--device-name
=
"master-event-pd"
fi
run-gcloud-compute-with-retries firewall-rules create
"
${
INSTANCE_PREFIX
}
-kubemark-master-https"
\
run-gcloud-compute-with-retries firewall-rules create
"
${
INSTANCE_PREFIX
}
-kubemark-master-https"
\
--project
"
${
PROJECT
}
"
\
--project
"
${
PROJECT
}
"
\
--network
"
${
NETWORK
}
"
\
--network
"
${
NETWORK
}
"
\
...
@@ -157,7 +169,7 @@ gcloud compute copy-files --zone="${ZONE}" --project="${PROJECT}" \
...
@@ -157,7 +169,7 @@ gcloud compute copy-files --zone="${ZONE}" --project="${PROJECT}" \
gcloud compute ssh
"
${
MASTER_NAME
}
"
--zone
=
"
${
ZONE
}
"
--project
=
"
${
PROJECT
}
"
\
gcloud compute ssh
"
${
MASTER_NAME
}
"
--zone
=
"
${
ZONE
}
"
--project
=
"
${
PROJECT
}
"
\
--command
=
"chmod a+x configure-kubectl.sh && chmod a+x start-kubemark-master.sh &&
\
--command
=
"chmod a+x configure-kubectl.sh && chmod a+x start-kubemark-master.sh &&
\
sudo ./start-kubemark-master.sh
${
EVENT_STORE_IP
:-
127
.0.0.1
}
${
NUM_NODES
:-
0
}
${
ETCD_IMAGE
:-}
"
sudo ./start-kubemark-master.sh
${
EVENT_STORE_IP
:-
127
.0.0.1
}
${
NUM_NODES
:-
0
}
${
E
VENT_PD
:-
false
}
${
E
TCD_IMAGE
:-}
"
# create kubeconfig for Kubelet:
# create kubeconfig for Kubelet:
KUBECONFIG_CONTENTS
=
$(
echo
"apiVersion: v1
KUBECONFIG_CONTENTS
=
$(
echo
"apiVersion: v1
...
...
test/kubemark/stop-kubemark.sh
View file @
3fc177ff
...
@@ -32,6 +32,9 @@ gcloud compute instances delete "${MASTER_NAME}" \
...
@@ -32,6 +32,9 @@ gcloud compute instances delete "${MASTER_NAME}" \
gcloud compute disks delete
"
${
MASTER_NAME
}
-pd"
\
gcloud compute disks delete
"
${
MASTER_NAME
}
-pd"
\
${
GCLOUD_COMMON_ARGS
}
||
true
${
GCLOUD_COMMON_ARGS
}
||
true
gcloud compute disks delete
"
${
MASTER_NAME
}
-event-pd"
\
${
GCLOUD_COMMON_ARGS
}
&> /dev/null
||
true
gcloud compute addresses delete
"
${
MASTER_NAME
}
-ip"
\
gcloud compute addresses delete
"
${
MASTER_NAME
}
-ip"
\
--project
"
${
PROJECT
}
"
\
--project
"
${
PROJECT
}
"
\
--region
"
${
REGION
}
"
\
--region
"
${
REGION
}
"
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment