# Add Makefile rule:
# async:
# rsync -av -i ../bacula/src/ build/src/
- # Change directory to: /mnt/regress/
+ # Change bacula directory in config file to: /mnt/regress/
# Execute:
# make async && -C build/src/plugins/fd install-kubernetes && make -C build/src/plugins/fd/kubernetes-backend clean && make -C build/src/plugins/fd/kubernetes-backend install-kubernetes
# Binary in: ~/regress/bin/k8s_backend
\ No newline at end of file
# Target
+## Ubuntu/Debian
+
This docker image is to compile k8s plugin independent of ubuntu/debian platform. I had problems with libc library, so to isolate this problem, we create this docker image.
If you want change this version, modify the image tag and dockerfile FROM.
+For example: `FROM debian:bullseye` to `FROM ubuntu:jammy`
+
**Note:** The difference between Ubuntu and Debian in this compilation is that `rm` binary is allocated in other place:
- Ubuntu: `/usr/bin/rm`
- Debian: `/bin/rm`
So, the Makefile will be modified to avoid errors.
+## RHEL (Rocky 9)
+
+This docker image is to compile k8s plugin independent of RHEL platforms.
+
# Create the Docker image
We need copy the requirements to docker context folder. For this reason, we do:
cp -a ../requirements.txt .
```
+```bash
+docker build -t k8s_compilation:bullseye .
+```
+
```bash
docker build -t k8s_compilation:jammy .
```
+```bash
+docker build -t k8s_compilation:rocky9 -f Dockerfile-rpm .
+```
+
# Pre-Run docker container
To compile in docker container, we need modify the `regress config file` to adapt.
```
# Run docker container
-In root project (bacula-bee folder), execute:
+In root project (bacula-bee folder), execute (Depend on platform):
+
+```bash
+docker run --rm -it -v $(pwd):/mnt k8s_compilation:bullseye /bin/bash
+```
```bash
docker run --rm -it -v $(pwd):/mnt k8s_compilation:jammy /bin/bash
```
+```bash
+docker run --rm -it -v $(pwd):/mnt k8s_compilation:rocky9 /bin/bash
+```
+
# Compile k8s plugin
Execute:
```bash
make async
+
+./k8s_compile
```
+This `./k8s_compile` binary will do:
+
```bash
make -C build/src/plugins/fd install-kubernetes
```
make -C build/src/plugins/fd/kubernetes-backend install-kubernetes
```
-Or in one command:
-```bash
-make async; make -C build/src/plugins/fd install-kubernetes; make -C build/src/plugins/fd/kubernetes-backend clean; make -C build/src/plugins/fd/kubernetes-backend install-kubernetes
-```
# Get the k8s_backend binary
if [ ! -d "$TMP_DIR" ]; then
make setup
+ cat <<EOF >/mnt/regress/k8s_compile
+#!/bin/bash
+make async
+printf "\n%s\n" "Make async done."
+make -C build/src/plugins/fd install-kubernetes
+printf "\n%s\n" "Compiled k8s fd."
+make -C build/src/plugins/fd/kubernetes-backend clean
+printf "\n%s\n" "Cleaned k8s binary."
+make -C build/src/plugins/fd/kubernetes-backend install-kubernetes
+printf "\n%s\n" "Compiled k8s binary."
+EOF
+chmod +x /mnt/regress/k8s_compile
else
echo "The directory /mnt/regress/tmp already exists. So, we do not make setup"
fi