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
12add3bc
Commit
12add3bc
authored
Nov 25, 2014
by
Joe Beda
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2579 from brendandburns/e2e
Add an e2e test for gce pd.
parents
c5e9f60f
e1764e2e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
1 deletion
+109
-1
config-test.sh
cluster/gce/config-test.sh
+1
-1
testpd.yaml
examples/gce-pd/testpd.yaml
+22
-0
pd.sh
hack/e2e-suite/pd.sh
+83
-0
mounter_linux.go
pkg/volume/mounter_linux.go
+3
-0
No files found.
cluster/gce/config-test.sh
View file @
12add3bc
...
...
@@ -31,7 +31,7 @@ MASTER_TAG="${INSTANCE_PREFIX}-master"
MINION_TAG
=
"
${
INSTANCE_PREFIX
}
-minion"
MINION_NAMES
=(
$(
eval echo
${
INSTANCE_PREFIX
}
-minion-
{
1..
${
NUM_MINIONS
}
}
)
)
MINION_IP_RANGES
=(
$(
eval echo
"10.245.{1..
${
NUM_MINIONS
}
}.0/24"
)
)
MINION_SCOPES
=
""
MINION_SCOPES
=
"
storage-ro,compute-rw
"
# Increase the sleep interval value if concerned about API rate limits. 3, in seconds, is the default.
POLL_SLEEP_INTERVAL
=
3
PORTAL_NET
=
"10.0.0.0/16"
...
...
examples/gce-pd/testpd.yaml
0 → 100644
View file @
12add3bc
apiVersion
:
v1beta1
desiredState
:
manifest
:
containers
:
-
image
:
kubernetes/pause
name
:
testpd
volumeMounts
:
-
mountPath
:
"
/testpd"
name
:
"
testpd"
id
:
testpd
version
:
v1beta1
volumes
:
-
name
:
testpd
source
:
persistentDisk
:
# This GCE PD must already exist and be formatted ext4
pdName
:
"
%insert_pd_name_here%"
fsType
:
ext4
id
:
testpd
kind
:
Pod
labels
:
test
:
testpd
hack/e2e-suite/pd.sh
0 → 100755
View file @
12add3bc
#!/bin/bash
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Launches a container and verifies it can be reached. Assumes that
# we're being called by hack/e2e-test.sh (we use some env vars it sets up).
# TODO: Convert uses of gcutil to gcloud
set
-o
errexit
set
-o
nounset
set
-o
pipefail
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
}
"
)
/../..
source
"
${
KUBE_ROOT
}
/cluster/kube-env.sh"
source
"
${
KUBE_ROOT
}
/cluster/
$KUBERNETES_PROVIDER
/util.sh"
if
[[
"
$KUBERNETES_PROVIDER
"
!=
"gce"
]]
;
then
echo
"PD test is only run for GCE"
return
0
fi
disk_name
=
"e2e-
$(
date
+%H-%M-%s
)
"
config
=
"/tmp/
${
disk_name
}
.yaml"
function
teardown
()
{
echo
"Cleaning up test artifacts"
${
KUBECFG
}
delete pods/testpd
rm
-rf
${
config
}
echo
"Waiting for disk to become unmounted"
sleep
20
gcutil deletedisk
-f
--zone
=
${
ZONE
}
${
disk_name
}
}
trap
"teardown"
EXIT
perl
-p
-e
"s/%.*%/
${
disk_name
}
/g"
${
KUBE_ROOT
}
/examples/gce-pd/testpd.yaml
>
${
config
}
# Create and mount the disk.
gcutil adddisk
--size_gb
=
10
--zone
=
${
ZONE
}
${
disk_name
}
gcutil attachdisk
--disk
${
disk_name
}
${
MASTER_NAME
}
gcutil ssh
${
MASTER_NAME
}
sudo rm
-rf
/mnt/tmp
gcutil ssh
${
MASTER_NAME
}
sudo mkdir
/mnt/tmp
gcutil ssh
${
MASTER_NAME
}
sudo
/usr/share/google/safe_format_and_mount /dev/disk/by-id/google-
${
disk_name
}
/mnt/tmp
gcutil ssh
${
MASTER_NAME
}
sudo
umount /mnt/tmp
gcloud compute instances detach-disk
--disk
${
disk_name
}
--zone
${
ZONE
}
${
MASTER_NAME
}
${
KUBECFG
}
-c
${
config
}
create pods
pod_id_list
=
$(
$KUBECFG
'-template={{range.items}}{{.id}} {{end}}'
-l
test
=
testpd list pods
)
# Pod turn up on a clean cluster can take a while for the docker image pull.
all_running
=
0
for
i
in
$(
seq
1 24
)
;
do
echo
"Waiting for pods to come up."
sleep
5
all_running
=
1
for
id
in
$pod_id_list
;
do
current_status
=
$(
$KUBECFG
-template
'{{.currentState.status}}'
get pods/
$id
)
||
true
if
[[
"
$current_status
"
!=
"Running"
]]
;
then
all_running
=
0
break
fi
done
if
[[
"
${
all_running
}
"
==
1
]]
;
then
break
fi
done
if
[[
"
${
all_running
}
"
==
0
]]
;
then
echo
"Pods did not come up in time"
exit
1
fi
pkg/volume/mounter_linux.go
View file @
12add3bc
...
...
@@ -23,6 +23,8 @@ import (
"regexp"
"strings"
"syscall"
"github.com/golang/glog"
)
const
MOUNT_MS_BIND
=
syscall
.
MS_BIND
...
...
@@ -32,6 +34,7 @@ type DiskMounter struct{}
// Wraps syscall.Mount()
func
(
mounter
*
DiskMounter
)
Mount
(
source
string
,
target
string
,
fstype
string
,
flags
uintptr
,
data
string
)
error
{
glog
.
V
(
5
)
.
Infof
(
"Mounting %s %s %s %d %s"
,
source
,
target
,
fstype
,
flags
,
data
)
return
syscall
.
Mount
(
source
,
target
,
fstype
,
flags
,
data
)
}
...
...
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