Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 61 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,68 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build and run tests
run: ./make.sh -i -N -F fslink
run: ./make.sh -i -N -F fslink
- name: Tear down
run: |
./unmake.sh -N -F fslink
./unmake.sh -N -F fslink
sudo rm -fr ./CHRIS_REMOTE_FS
test-pfcon-k8s:
name: tests (pfcon on kubernetes)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Start local Docker registry
run: |
docker run -d --restart=always \
-p 127.0.0.1:5005:5000 \
--name pfcon-k8s-registry registry:2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why registry:2? Latest version is 3.1.0. https://hub.docker.com/_/registry

- name: Write kind config
run: |
# extraMounts exposes the workspace on the kind node at the same
# path, so the pfcon deployment's hostPath mounts of pfcon/ and
# tests/ (resolved from $SOURCEDIR by envsubst) work on the node.
cat > /tmp/kind-config.yaml <<EOF
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraMounts:
- hostPath: ${{ github.workspace }}
containerPath: ${{ github.workspace }}
EOF
- name: Create kind cluster
uses: helm/kind-action@v1
with:
cluster_name: pfcon-k8s
config: /tmp/kind-config.yaml
- name: Connect registry to kind network
run: |
docker network connect kind pfcon-k8s-registry
# Configure containerd on kind nodes to resolve localhost:5005
# to the registry container on the kind docker network.
for node in $(kind get nodes --name pfcon-k8s); do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a roundabout solution. Instead of (1) running registry in docker-compose, (2) configuring KinD nodes to pull from the registry, (3) restarting KinD's containerd, you could simply run the registry inside of the k8s and everything will work as expected.

docker exec "$node" mkdir -p /etc/containerd/certs.d/localhost:5005
docker exec "$node" sh -c 'cat > /etc/containerd/certs.d/localhost:5005/hosts.toml <<TOML
[host."http://pfcon-k8s-registry:5000"]
capabilities = ["pull", "resolve"]
TOML'
docker exec "$node" systemctl restart containerd
done
# Wait for containerd and kubelet to recover after restart.
sleep 5
kubectl wait --for=condition=Ready nodes --all --timeout=120s
- name: Build and push opjob image
run: |
docker build -f opjob.Dockerfile -t localhost:5005/fnndsc/pfconopjob:dev .
docker push localhost:5005/fnndsc/pfconopjob:dev
- name: Build and run tests
env:
PFCON_OP_IMAGE: localhost:5005/fnndsc/pfconopjob:dev
run: ./make.sh -i -N -F fslink -O kubernetes
- name: Tear down
if: always()
run: |
./unmake.sh -N -F fslink -O kubernetes
sudo rm -fr ./CHRIS_REMOTE_FS
test-cube:
name: tests (CUBE)
Expand All @@ -35,7 +93,7 @@ jobs:
PFCON_IMAGE: localhost/fnndsc/pfcon

build:
needs: [test-pfcon, test-cube]
needs: [test-pfcon, test-pfcon-k8s, test-cube]
runs-on: ubuntu-24.04
env:
PIXI_COLOR: always
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/pfcon_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
env: development
spec:
containers:
- image: localhost:5000/fnndsc/pfcon:dev
- image: localhost:5005/fnndsc/pfcon:dev
name: pfcon
stdin: true
tty: true
Expand Down
5 changes: 2 additions & 3 deletions kubernetes/pfcon_dev_innetwork.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ metadata:
spec:
accessModes:
- ReadWriteOnce
storageClassName: hostpath
resources:
requests:
storage: 2Gi
Expand Down Expand Up @@ -111,7 +110,7 @@ spec:
image: busybox:1.32
command: ["sh", "-c", "until wget --spider -S -T 2 http://swift:8080/info 2>&1 | grep '200 OK'; do echo waiting for Swift storage; sleep 2; done"]
containers:
- image: localhost:5000/fnndsc/pfcon:dev
- image: localhost:5005/fnndsc/pfcon:dev
name: pfcon
stdin: true
tty: true
Expand All @@ -133,7 +132,7 @@ spec:
- name: CONTAINER_ENV
value: kubernetes
- name: PFCON_OP_IMAGE
value: ghcr.io/fnndsc/pfconopjob-swift
value: ${PFCON_OP_IMAGE}
- name: SWIFT_AUTH_URL
value: http://swift:8080/auth/v1.0
command: ["pixi"]
Expand Down
5 changes: 2 additions & 3 deletions kubernetes/pfcon_dev_innetwork_fs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ metadata:
spec:
accessModes:
- ReadWriteOnce
storageClassName: hostpath
resources:
requests:
storage: 2Gi
Expand Down Expand Up @@ -107,7 +106,7 @@ spec:
spec:
serviceAccountName: pfcon
containers:
- image: localhost:5000/fnndsc/pfcon:dev
- image: localhost:5005/fnndsc/pfcon:dev
name: pfcon
stdin: true
tty: true
Expand All @@ -129,7 +128,7 @@ spec:
- name: CONTAINER_ENV
value: kubernetes
- name: PFCON_OP_IMAGE
value: ghcr.io/fnndsc/pfconopjob
value: ${PFCON_OP_IMAGE}
command: ["pixi"]
args: ["run", "python", "-m", "pfcon"]
volumeMounts:
Expand Down
5 changes: 2 additions & 3 deletions kubernetes/pfcon_dev_innetwork_s3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ metadata:
spec:
accessModes:
- ReadWriteOnce
storageClassName: hostpath
resources:
requests:
storage: 2Gi
Expand Down Expand Up @@ -111,7 +110,7 @@ spec:
image: busybox:1.32
command: ["sh", "-c", "until wget --spider -S -T 2 http://s3-service:9000/minio/health/live 2>&1 | grep '200 OK'; do echo waiting for S3 storage; sleep 2; done"]
containers:
- image: localhost:5000/fnndsc/pfcon:dev
- image: localhost:5005/fnndsc/pfcon:dev
name: pfcon
stdin: true
tty: true
Expand All @@ -133,7 +132,7 @@ spec:
- name: CONTAINER_ENV
value: kubernetes
- name: PFCON_OP_IMAGE
value: ghcr.io/fnndsc/pfconopjob-s3
value: ${PFCON_OP_IMAGE}
- name: S3_ENDPOINT_URL
value: http://s3-service:9000
command: ["pixi"]
Expand Down
27 changes: 27 additions & 0 deletions make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,19 @@ title -d 1 "Setting global exports..."
export COMPUTE_VOLUME_TYPE=$COMPUTE_VOLUME_TYPE
echo -e "exporting VOLUME_NAME=$VOLUME_NAME " | ./boxes.sh
export SVOLUME_NAME=$VOLUME_NAME

# Default PFCON_OP_IMAGE per storage env. Override by exporting
# PFCON_OP_IMAGE before invoking this script (e.g. to point at a
# locally-built image in a local registry during CI).
if [ -z ${PFCON_OP_IMAGE+x} ]; then
case $STORAGE_ENV in
swift) PFCON_OP_IMAGE=ghcr.io/fnndsc/pfconopjob-swift ;;
s3) PFCON_OP_IMAGE=ghcr.io/fnndsc/pfconopjob-s3 ;;
*) PFCON_OP_IMAGE=ghcr.io/fnndsc/pfconopjob ;;
esac
fi
echo -e "exporting PFCON_OP_IMAGE=$PFCON_OP_IMAGE " | ./boxes.sh
export PFCON_OP_IMAGE
fi

echo -e "exporting STOREBASE=$STOREBASE " | ./boxes.sh
Expand Down Expand Up @@ -247,6 +260,20 @@ title -d 1 "Building :dev"
echo $CMD | sh | ./boxes.sh -c
windowBottom

if [[ $CONTAINER_ENV == kubernetes ]]; then
title -d 1 "Pushing pfcon :dev image to localhost:5005"
# Only push if a registry is actually listening. On Docker Desktop
# Kubernetes the k8s nodes share the host's image store, so a push
# isn't needed; on kind (CI) it is.
if curl -fsS -o /dev/null --connect-timeout 2 http://localhost:5005/v2/ 2>/dev/null; then
echo "docker push --quiet localhost:5005/fnndsc/pfcon:dev" | ./boxes.sh
docker push --quiet localhost:5005/fnndsc/pfcon:dev | ./boxes.sh -c
else
echo "No registry at localhost:5005 — skipping push." | ./boxes.sh
fi
windowBottom
fi

title -d 1 "Changing permissions to 755 on" "$HERE"
cd $HERE
echo "chmod -R 755 $HERE" | ./boxes.sh
Expand Down
2 changes: 1 addition & 1 deletion swarm/docker-compose_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

services:
pfcon:
image: localhost:5000/fnndsc/pfcon:dev
image: localhost:5005/fnndsc/pfcon:dev
container_name: pfcon
build:
context: ..
Expand Down
2 changes: 1 addition & 1 deletion swarm/docker-compose_dev_innetwork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
STORAGE_ENV: swift

pfcon:
image: localhost:5000/fnndsc/pfcon:dev
image: localhost:5005/fnndsc/pfcon:dev
container_name: pfcon
build:
context: ..
Expand Down
2 changes: 1 addition & 1 deletion swarm/docker-compose_dev_innetwork_fs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
dockerfile: opjob.Dockerfile

pfcon:
image: localhost:5000/fnndsc/pfcon:dev
image: localhost:5005/fnndsc/pfcon:dev
container_name: pfcon
build:
context: ..
Expand Down
2 changes: 1 addition & 1 deletion swarm/docker-compose_dev_innetwork_s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
STORAGE_ENV: s3

pfcon:
image: localhost:5000/fnndsc/pfcon:dev
image: localhost:5005/fnndsc/pfcon:dev
container_name: pfcon
build:
context: ..
Expand Down
Loading