rook toolbox entrypoint to automatically setup ceph config that ceph tools expect
This commit is contained in:
1 parent
42c1ec9a09
commit
fb70cb9f33
3 files changed
+51
-6
No files matched your search
+2
-1
@@ -29,4 +29,5 @@ RUN apt-get update && \
|
||||
vim \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
COPY entrypoint.sh /toolbox/
|
||||
ENTRYPOINT [ "/toolbox/entrypoint.sh" ]
|
||||
+16
-5
@@ -16,13 +16,24 @@ toolbox
|
||||
```
|
||||
|
||||
### Ceph Tools
|
||||
To use the ceph tools from a rook host, launch the toolbox and run the following command:
|
||||
To use the ceph tools from a rook host, launch the toolbox with the following options:
|
||||
```
|
||||
toolbox --bind=/var/lib/rook:/var/lib/rook
|
||||
ROOK_CONFIG=`find /var/lib/rook -regex '.*mon[0-9]+/.*\.config' | head -1`
|
||||
toolbox --bind=/var/lib/rook:/var/lib/rook /toolbox/entrypoint.sh
|
||||
```
|
||||
Then you can run `ceph` and `rados` commands like usual:
|
||||
```
|
||||
ceph -c ${ROOK_CONFIG} df
|
||||
rados -c ${ROOK_CONFIG} df
|
||||
ceph df
|
||||
rados df
|
||||
```
|
||||
|
||||
## Other Linux Distros
|
||||
The rook toolbox container can simply be run directly with `docker` on other Linux distros:
|
||||
```
|
||||
docker run -it quay.io/rook/toolbox
|
||||
```
|
||||
|
||||
### Ceph Tools
|
||||
To run ceph tools such as `ceph` and `rados`, run the container with the following options:
|
||||
```
|
||||
docker run -it --network=host -v /var/lib/rook:/var/lib/rook quay.io/rook/toolbox
|
||||
```
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# Copyright 2016 The Rook Authors. 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.
|
||||
|
||||
ARGS="$@"
|
||||
if [ $# -eq 0 ]; then
|
||||
ARGS=/bin/bash
|
||||
fi
|
||||
|
||||
# find one of rook's ceph config files and copy it to the default location so ceph/rados tools
|
||||
# can be used without specifying a config file path
|
||||
ROOK_DIR="/var/lib/rook"
|
||||
if [[ -d ${ROOK_DIR} ]]; then
|
||||
ROOK_CONFIG=`find ${ROOK_DIR} -regex '.*mon[0-9]+/.*\.config' | head -1`
|
||||
if [[ ! -z ${ROOK_CONFIG} ]]; then
|
||||
mkdir -p /etc/ceph
|
||||
cp ${ROOK_CONFIG} /etc/ceph/ceph.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
exec ${ARGS}
|
||||
Reference in new issue
Block a user