Skip to content

Commit

Permalink
Moved docker registry to inside LXD vm
Browse files Browse the repository at this point in the history
  • Loading branch information
UtkarshBhatthere committed Nov 18, 2024
1 parent ad1eabb commit a94a88d
Showing 2 changed files with 37 additions and 22 deletions.
31 changes: 12 additions & 19 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
@@ -77,19 +77,6 @@ jobs:
- name: install dependencies
run: ./scripts/deploy-helper.sh install_custom_runner_dependencies

- name: Load image to registry
run: |
ls
rock_file=$(ls *.rock | head -1)
docker run -d -p 5000:5000 --restart=always --name registry registry:2
sleep 10
skopeo --insecure-policy copy oci-archive:$rock_file docker-daemon:canonical/ceph:latest
docker image ls -a
docker image tag canonical/ceph:latest localhost:5000/canonical/ceph:latest
sleep 10
docker push localhost:5000/canonical/ceph
echo $'[registries.insecure]\nregistries = ["localhost:5000"]' | sudo tee -a /etc/containers/registries.conf
- name: Setup LXD
uses: canonical/setup-lxd@v0.1.1
with:
@@ -115,15 +102,21 @@ jobs:
lxc storage volume attach default osd_two cephadm
lxc storage volume attach default osd_three cephadm
- name: Copy helper scripts to LXD vm
- name: Copy necessary assets to LXD vm
run: |
lxc file push ./scripts/*.sh cephadm/root/ -r
rock_file=$(ls *.rock | head -1)
lxc file push ./test/scripts/cephadm_helper.sh cephadm/root/ -r
lxc file push $rock_file cephadm/root/
- name: Prepare the docker registry
run: |
lxc exec cephadm -- sh -c "~/cephadm_helper.sh install_dependencies"
lxc exec cephadm -- sh -c "~/cephadm_helper.sh prep_registry
- name: Install cephadm with local image
run: |
reg_addr=$(lxc exec cephadm -- sh -c "~/cephadm_helper.sh get_ip)
lxc exec cephadm -- sh -c "~/cephadm_helper.sh deploy_cephadm $reg_addr:5000/canonical/ceph:latest"
sleep 2m
lxc exec cephadm -- sh -c "~/cephadm_helper.sh deploy_cephadm"
sleep 3m
- name: Check health
run: |
@@ -137,7 +130,7 @@ jobs:
sleep 2m
lxc exec cephadm --sh -c "ceph -s"
- name: check healthy
- name: check health
run: lxc exec cephadm -- sh -c "~/cephadm_helper.sh poll_obj_count osd 3"

RookTest:
28 changes: 25 additions & 3 deletions test/scripts/cephadm_helper.sh
Original file line number Diff line number Diff line change
@@ -14,6 +14,27 @@ function prep_docker() {
docker push localhost:5000/canonical/ceph:latest
}

function install_dependencies() {
sudo apt-get -y update
sudo apt-get -y install skopeo
sudo python -m pip install --upgrade pip
sudo snap install docker
sleep 10
}

function prep_registry() {
ls
rock_file=$(ls *.rock | head -1)
docker run -d -p 5000:5000 --restart=always --name registry registry:2
sleep 10
skopeo --insecure-policy copy oci-archive:$rock_file docker-daemon:canonical/ceph:latest
docker image ls -a
docker image tag canonical/ceph:latest localhost:5000/canonical/ceph:latest
sleep 10
docker push localhost:5000/canonical/ceph
echo $'[registries.insecure]\nregistries = ["localhost:5000"]' | sudo tee -a /etc/containers/registries.conf
}

function use_local_disk() {
sudo lsblk -f
datadisk=$(sudo lsblk --paths | awk '/14G/ || /64G/ {print $1}' | head -1)
@@ -60,9 +81,10 @@ function get_ip() {
}

function deploy_cephadm() {
local image=${1:?missing}
local ip=$( get_ip )

install_apt
bootstrap $image $( get_ip )
bootstrap $ip:5000/canonical/ceph:latest $ip
test_num_objs mon 1
}

@@ -112,4 +134,4 @@ function poll_obj_count() {

FUNCTION="$1"
shift
$FUNCTION "$@"
$FUNCTION "$@"

0 comments on commit a94a88d

Please sign in to comment.