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
9a415f96
Commit
9a415f96
authored
Aug 10, 2015
by
Karl Isenberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[mesos/docker] Dump logs on kube-up error
- Extracted compose_file var to avoid pushd/popd
parent
e13b00ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
.gitignore
cluster/mesos/docker/.gitignore
+1
-0
util.sh
cluster/mesos/docker/util.sh
+17
-9
No files found.
cluster/mesos/docker/.gitignore
View file @
9a415f96
certs
certs
logs
cluster/mesos/docker/util.sh
View file @
9a415f96
...
@@ -26,6 +26,7 @@ set -o pipefail
...
@@ -26,6 +26,7 @@ set -o pipefail
KUBE_ROOT
=
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
}
"
)
/../../.."
&&
pwd
)
KUBE_ROOT
=
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
}
"
)
/../../.."
&&
pwd
)
provider_root
=
"
${
KUBE_ROOT
}
/cluster/
${
KUBERNETES_PROVIDER
}
"
provider_root
=
"
${
KUBE_ROOT
}
/cluster/
${
KUBERNETES_PROVIDER
}
"
compose_file
=
"
${
provider_root
}
/docker-compose.yml"
source
"
${
provider_root
}
/
${
KUBE_CONFIG_FILE
-
"config-default.sh"
}
"
source
"
${
provider_root
}
/
${
KUBE_CONFIG_FILE
-
"config-default.sh"
}
"
source
"
${
KUBE_ROOT
}
/cluster/common.sh"
source
"
${
KUBE_ROOT
}
/cluster/common.sh"
...
@@ -184,10 +185,11 @@ function kube-up {
...
@@ -184,10 +185,11 @@ function kube-up {
echo
"Creating admin basic auth user"
1>&2
echo
"Creating admin basic auth user"
1>&2
cluster::mesos::docker::create_basic_user
"admin"
"admin"
>
"
${
apiserver_certs_dir
}
/basic-users"
cluster::mesos::docker::create_basic_user
"admin"
"admin"
>
"
${
apiserver_certs_dir
}
/basic-users"
# log dump on failure
trap
'cluster::mesos::docker::dump_logs'
ERR
echo
"Starting
${
KUBERNETES_PROVIDER
}
cluster"
1>&2
echo
"Starting
${
KUBERNETES_PROVIDER
}
cluster"
1>&2
pushd
"
${
provider_root
}
"
>
/dev/null
docker-compose
-f
"
${
compose_file
}
"
up
-d
docker-compose up
-d
popd
>
/dev/null
detect-master
detect-master
detect-minions
detect-minions
...
@@ -228,11 +230,9 @@ function validate-cluster {
...
@@ -228,11 +230,9 @@ function validate-cluster {
# Delete a kubernetes cluster
# Delete a kubernetes cluster
function
kube-down
{
function
kube-down
{
echo
"Stopping
${
KUBERNETES_PROVIDER
}
cluster"
1>&2
echo
"Stopping
${
KUBERNETES_PROVIDER
}
cluster"
1>&2
pushd
"
${
provider_root
}
"
>
/dev/null
# Since restoring a stopped cluster is not yet supported, use the nuclear option
# Since restoring a stopped cluster is not yet supported, use the nuclear option
docker-compose
kill
docker-compose
-f
"
${
compose_file
}
"
kill
docker-compose
rm
-f
docker-compose
-f
"
${
compose_file
}
"
rm
-f
popd
>
/dev/null
}
}
function
test-setup
{
function
test-setup
{
...
@@ -292,4 +292,13 @@ function cluster::mesos::docker::addon_status {
...
@@ -292,4 +292,13 @@ function cluster::mesos::docker::addon_status {
local
phase
=
$(
"
${
kubectl
}
"
get pods
--namespace
=
kube-system
-l
k8s-app
=
${
pod_name
}
-o
template
--template
=
"{{(index .items 0).status.phase}}"
2>/dev/null
)
local
phase
=
$(
"
${
kubectl
}
"
get pods
--namespace
=
kube-system
-l
k8s-app
=
${
pod_name
}
-o
template
--template
=
"{{(index .items 0).status.phase}}"
2>/dev/null
)
phase
=
"
${
phase
:-
Unknown
}
"
phase
=
"
${
phase
:-
Unknown
}
"
echo
"
${
phase
}
"
echo
"
${
phase
}
"
}
}
\ No newline at end of file
function
cluster::mesos::docker::dump_logs
{
local
log_dir
=
"
${
provider_root
}
/logs"
echo
"Dumping logs to '
${
log_dir
}
'"
1>&2
mkdir
-p
"
${
log_dir
}
"
while
read
name
;
do
docker logs
"
${
name
}
"
&>
"
${
log_dir
}
/
${
name
}
.log"
done
< <
(
docker-compose
-f
"
${
compose_file
}
"
ps
-q
| xargs docker inspect
--format
'{{.Name}}'
)
}
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