summaryrefslogtreecommitdiffstats
path: root/src/script/kubejacker
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/script/kubejacker
parentInitial commit. (diff)
downloadceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz
ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/script/kubejacker')
-rw-r--r--src/script/kubejacker/Dockerfile15
-rw-r--r--src/script/kubejacker/README.rst11
-rwxr-xr-xsrc/script/kubejacker/kubejacker.sh88
3 files changed, 114 insertions, 0 deletions
diff --git a/src/script/kubejacker/Dockerfile b/src/script/kubejacker/Dockerfile
new file mode 100644
index 000000000..2b111be76
--- /dev/null
+++ b/src/script/kubejacker/Dockerfile
@@ -0,0 +1,15 @@
+FROM ceph/daemon-base:latest-master
+# for openSUSE, use:
+# FROM registry.opensuse.org/home/ssebastianwagner/rook-ceph/images/opensuse/leap:latest
+
+
+#ADD bin.tar.gz /usr/bin/
+#ADD lib.tar.gz /usr/lib64/
+
+# Assume developer is using default paths (i.e. /usr/local), so
+# build binaries will be looking for libs there.
+#ADD eclib.tar.gz /usr/local/lib64/ceph/erasure-code/
+#ADD clslib.tar.gz /usr/local/lib64/rados-classes/
+
+ADD python_common.tar.gz /usr/share/ceph/python_common
+ADD mgr_plugins.tar.gz /usr/share/ceph/mgr
diff --git a/src/script/kubejacker/README.rst b/src/script/kubejacker/README.rst
new file mode 100644
index 000000000..07e948a5e
--- /dev/null
+++ b/src/script/kubejacker/README.rst
@@ -0,0 +1,11 @@
+
+This tool is for developers who want to run their WIP Ceph code
+inside a Rook/kubernetes cluster without waiting for packages
+to build.
+
+It simply takes a Rook image, overlays all the binaries from your
+built Ceph tree into it, and spits out a new Rook image. This will
+only work as long as your build environment is sufficiently similar
+(in terms of dependencies etc) to the version of Ceph that was
+originally in the images you're injecting into.
+
diff --git a/src/script/kubejacker/kubejacker.sh b/src/script/kubejacker/kubejacker.sh
new file mode 100755
index 000000000..e013669e9
--- /dev/null
+++ b/src/script/kubejacker/kubejacker.sh
@@ -0,0 +1,88 @@
+#!/bin/bash
+
+set -x
+set -e
+SCRIPT=$(readlink -f "$0")
+SCRIPTPATH=$(dirname "$SCRIPT")
+
+# Run me from your build dir! I look for binaries in bin/, lib/ etc.
+BUILDPATH=$(pwd)
+
+
+# PREREQUISITE: a repo that you can push to. You are probably running
+# a local docker registry that your kubelet nodes also have access to.
+REPO=${REPO:-"$1"}
+
+if [ -z "$REPO" ]
+then
+ echo "ERROR: no \$REPO set!"
+ echo "Run a docker repository and set REPO to <hostname>:<port>"
+ exit -1
+fi
+
+# The output image name: this should match whatever is configured as
+# the image name in your Rook cluster CRD object.
+IMAGE=ceph/ceph
+TAG=latest
+
+# The namespace where ceph containers are running in your
+# test cluster: used for bouncing the containers.
+NAMESPACE=rook-ceph
+
+mkdir -p kubejacker
+cp $SCRIPTPATH/Dockerfile kubejacker
+
+# TODO: let user specify which daemon they're interested
+# in -- doing all bins all the time is too slow and bloaty
+#BINS="ceph-mgr ceph-mon ceph-mds ceph-osd rados radosgw-admin radosgw"
+#pushd bin
+#strip $BINS #TODO: make stripping optional
+#tar czf $BUILDPATH/kubejacker/bin.tar.gz $BINS
+#popd
+
+# We need ceph-common to support the binaries
+# We need librados/rbd to support mgr modules
+# that import the python bindings
+#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"
+#pushd lib
+#strip $LIBS #TODO: make stripping optional
+#tar czf $BUILDPATH/kubejacker/lib.tar.gz $LIBS
+#popd
+
+pushd ../src/python-common/ceph
+tar --exclude=__pycache__ --exclude=tests -czf $BUILDPATH/kubejacker/python_common.tar.gz *
+popd
+
+pushd ../src/pybind/mgr
+find ./ -name "*.pyc" -exec rm -f {} \;
+# Exclude node_modules because it's the huge sources in dashboard/frontend
+tar --exclude=node_modules --exclude=tests --exclude-backups -czf $BUILDPATH/kubejacker/mgr_plugins.tar.gz *
+popd
+
+#ECLIBS="libec_*.so*"
+#pushd lib
+#strip $ECLIBS #TODO: make stripping optional
+#tar czf $BUILDPATH/kubejacker/eclib.tar.gz $ECLIBS
+#popd
+
+#CLSLIBS="libcls_*.so*"
+#pushd lib
+#strip $CLSLIBS #TODO: make stripping optional
+#tar czf $BUILDPATH/kubejacker/clslib.tar.gz $CLSLIBS
+#popd
+
+pushd kubejacker
+docker build -t $REPO/ceph/ceph:latest .
+popd
+
+# Push the image to the repository
+#docker tag $REPO/$IMAGE:$TAG $REPO/$IMAGE:latest
+docker push $REPO/ceph/ceph:latest
+#docker push $REPO/$IMAGE:$TAG
+# With a plain HTTP registry
+#podman push $REPO/ceph/ceph:latest --tls-verify=false
+
+# Finally, bounce the containers to pick up the new image
+kubectl -n $NAMESPACE delete pod -l app=rook-ceph-mds
+kubectl -n $NAMESPACE delete pod -l app=rook-ceph-mgr
+kubectl -n $NAMESPACE delete pod -l app=rook-ceph-mon