]> git.proxmox.com Git - ceph.git/blame - ceph/src/script/kubejacker/kubejacker.sh
import 15.2.0 Octopus source
[ceph.git] / ceph / src / script / kubejacker / kubejacker.sh
CommitLineData
11fdf7f2
TL
1#!/bin/bash
2
3set -x
4set -e
5SCRIPT=$(readlink -f "$0")
6SCRIPTPATH=$(dirname "$SCRIPT")
7
8# Run me from your build dir! I look for binaries in bin/, lib/ etc.
9BUILDPATH=$(pwd)
10
11fdf7f2
TL
11
12# PREREQUISITE: a repo that you can push to. You are probably running
13# a local docker registry that your kubelet nodes also have access to.
9f95a23c
TL
14REPO=${REPO:-"$1"}
15
11fdf7f2
TL
16if [ -z "$REPO" ]
17then
18 echo "ERROR: no \$REPO set!"
19 echo "Run a docker repository and set REPO to <hostname>:<port>"
20 exit -1
21fi
22
23# The output image name: this should match whatever is configured as
24# the image name in your Rook cluster CRD object.
9f95a23c
TL
25IMAGE=ceph/ceph
26TAG=latest
11fdf7f2
TL
27
28# The namespace where ceph containers are running in your
29# test cluster: used for bouncing the containers.
30NAMESPACE=rook-ceph
31
32mkdir -p kubejacker
33cp $SCRIPTPATH/Dockerfile kubejacker
11fdf7f2
TL
34
35# TODO: let user specify which daemon they're interested
36# in -- doing all bins all the time is too slow and bloaty
9f95a23c
TL
37#BINS="ceph-mgr ceph-mon ceph-mds ceph-osd rados radosgw-admin radosgw"
38#pushd bin
39#strip $BINS #TODO: make stripping optional
40#tar czf $BUILDPATH/kubejacker/bin.tar.gz $BINS
41#popd
11fdf7f2
TL
42
43# We need ceph-common to support the binaries
44# We need librados/rbd to support mgr modules
45# that import the python bindings
9f95a23c
TL
46#LIBS="libceph-common.so.0 libceph-common.so librados.so.2 librados.so librados.so.2.0.0 librbd.so librbd.so.1 librbd.so.1.12.0"
47#pushd lib
48#strip $LIBS #TODO: make stripping optional
49#tar czf $BUILDPATH/kubejacker/lib.tar.gz $LIBS
50#popd
11fdf7f2
TL
51
52pushd ../src/pybind/mgr
53find ./ -name "*.pyc" -exec rm -f {} \;
54# Exclude node_modules because it's the huge sources in dashboard/frontend
55tar --exclude=node_modules --exclude=tests --exclude-backups -czf $BUILDPATH/kubejacker/mgr_plugins.tar.gz *
56popd
57
9f95a23c
TL
58#ECLIBS="libec_*.so*"
59#pushd lib
60#strip $ECLIBS #TODO: make stripping optional
61#tar czf $BUILDPATH/kubejacker/eclib.tar.gz $ECLIBS
62#popd
11fdf7f2 63
9f95a23c
TL
64#CLSLIBS="libcls_*.so*"
65#pushd lib
66#strip $CLSLIBS #TODO: make stripping optional
67#tar czf $BUILDPATH/kubejacker/clslib.tar.gz $CLSLIBS
68#popd
11fdf7f2
TL
69
70pushd kubejacker
9f95a23c 71docker build -t $REPO/ceph/ceph:latest .
11fdf7f2
TL
72popd
73
74# Push the image to the repository
9f95a23c
TL
75#docker tag $REPO/$IMAGE:$TAG $REPO/$IMAGE:latest
76docker push $REPO/ceph/ceph:latest
77#docker push $REPO/$IMAGE:$TAG
11fdf7f2
TL
78
79# Finally, bounce the containers to pick up the new image
80kubectl -n $NAMESPACE delete pod -l app=rook-ceph-mds
81kubectl -n $NAMESPACE delete pod -l app=rook-ceph-mgr
82kubectl -n $NAMESPACE delete pod -l app=rook-ceph-mon