Skip to content

Commit f982f82

Browse files
committed
feat: migrate PVCViewer Controller CI workflows to notebooks repo
- Add integration test workflow with Kind cluster setup - Add multi-arch build test for AMD64, ARM64, PPC64LE platforms - Add unit test workflow with Go test coverage - Include testing infrastructure scripts for cert-manager and Istio This migration enables unified CI/CD for PVCViewer Controller within the notebooks repository structure. Signed-off-by: noa limoy <[email protected]>
1 parent 5f191bc commit f982f82

File tree

10 files changed

+220
-1
lines changed

10 files changed

+220
-1
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: PVCViewer Controller Integration Test
2+
on:
3+
pull_request:
4+
paths:
5+
- components/pvcviewer-controller/**
6+
- releasing/version/VERSION
7+
branches:
8+
- master
9+
- notebooks-v1
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }}
13+
cancel-in-progress: true
14+
15+
env:
16+
IMG: ghcr.io/kubeflow/notebooks/pvcviewer-controller
17+
TAG: integration-test
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-22.04
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Build PVCViewer Controller Image
30+
run: |
31+
cd components/pvcviewer-controller
32+
make docker-build-multi-arch
33+
34+
- name: Install KinD
35+
run: ./components/testing/gh-actions/install_kind.sh
36+
37+
- name: Create KinD Cluster
38+
run: kind create cluster --config components/testing/gh-actions/kind-1-25.yaml
39+
40+
- name: Load Images into KinD Cluster
41+
run: |
42+
kind load docker-image "${IMG}:${TAG}"
43+
44+
- name: Install kustomize
45+
run: ./components/testing/gh-actions/install_kustomize.sh
46+
47+
- name: Install Istio
48+
run: ./components/testing/gh-actions/install_istio.sh
49+
50+
- name: Install cert-manager
51+
run: ./components/testing/gh-actions/install_cert_manager.sh
52+
53+
- name: Build & Apply manifests
54+
run: |
55+
cd components/pvcviewer-controller/config
56+
kubectl create ns kubeflow
57+
58+
export CURRENT_IMAGE="${IMG}"
59+
export PR_IMAGE="${IMG}:${TAG}"
60+
61+
# escape "." in the image names, as it is a special characters in sed
62+
export CURRENT_IMAGE=$(echo "$CURRENT_IMAGE" | sed 's|\.|\\.|g')
63+
export PR_IMAGE=$(echo "$PR_IMAGE" | sed 's|\.|\\.|g')
64+
65+
kustomize build base \
66+
| sed "s|${CURRENT_IMAGE}:[a-zA-Z0-9_.-]*|${PR_IMAGE}|g" \
67+
| kubectl apply -f -
68+
69+
kubectl wait pods -n kubeflow -l app=pvcviewer --for=condition=Ready --timeout=300s
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: PVCViewer Controller Multi-Arch Build Test
2+
on:
3+
pull_request:
4+
paths:
5+
- components/pvcviewer-controller/**
6+
- releasing/version/VERSION
7+
branches:
8+
- master
9+
- notebooks-v1
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }}
13+
cancel-in-progress: true
14+
15+
env:
16+
IMG: ghcr.io/kubeflow/notebooks/pvcviewer-controller
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-22.04
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup QEMU
26+
uses: docker/setup-qemu-action@v3
27+
28+
- name: Setup Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Build multi-arch Image
32+
run: |
33+
cd components/pvcviewer-controller
34+
ARCH=linux/amd64 make docker-build-multi-arch
35+
ARCH=linux/ppc64le make docker-build-multi-arch
36+
ARCH=linux/arm64/v8 make docker-build-multi-arch
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Run PVCViewer Controller unit tests
2+
on:
3+
pull_request:
4+
paths:
5+
- components/pvcviewer-controller/**
6+
- releasing/version/VERSION
7+
branches:
8+
- master
9+
- notebooks-v1
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-22.04
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Install Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: "1.22.2"
22+
check-latest: true
23+
24+
- name: Run unit tests
25+
run: |
26+
cd components/pvcviewer-controller
27+
make test

components/pvcviewer-controller/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# PVCViewer
22

3-
Using this component, PVCViewers can easily be created. PVCViewers enable users to open a filebrowser on arbitrary persistent volume claims, letting them inspect, download, upload and manipulate data.
3+
Using this component, PVCViewers can easily be created. PVCViewers enable users to open a filebrowser on arbitrary persistent volume claims, letting them inspect, download, upload and manipulate data.
4+
5+
This component now includes comprehensive CI/CD workflows for automated testing and multi-architecture builds.
46

57
The PVCViewer API is meant to be extensible and can easily be user for other use-cases, such as launching user-tailored apps (e.g. tensorboards or notebooks).
68

components/pvcviewer-controller/controllers/pvcviewer_controller_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ var _ = Describe("PVCViewer controller", func() {
3535
// However, while EnvTest supports creating namespaces, it can't tear them down.
3636
// It is recommended to simply use a different namespace for each test.
3737
// See: https://book.kubebuilder.io/reference/envtest.html#namespace-usage-limitation
38+
39+
3840
testCount++
3941
testHelper = &TestHelper{
4042
namespace: "test-" + fmt.Sprint(testCount),
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
CERT_MANAGER_VERSION="1.12.10"
6+
CERT_MANAGER_URL="https://github.com/cert-manager/cert-manager/releases/download/v${CERT_MANAGER_VERSION}/cert-manager.yaml"
7+
8+
echo "Fetching cert-manager ${CERT_MANAGER_VERSION} manifests..."
9+
curl -sL -o cert-manager.yaml "$CERT_MANAGER_URL"
10+
11+
echo "Applying cert-manager manifests..."
12+
kubectl apply -f cert-manager.yaml
13+
14+
echo "Waiting for cert-manager to be ready..."
15+
kubectl wait --for=condition=ready pod -l 'app in (cert-manager,webhook)' --timeout=180s -n cert-manager
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
ISTIO_VERSION="1.17.8"
6+
ISTIO_URL="https://istio.io/downloadIstio"
7+
8+
echo "Installing Istio ${ISTIO_VERSION} ..."
9+
mkdir istio_tmp
10+
pushd istio_tmp >/dev/null
11+
curl -sL "$ISTIO_URL" | ISTIO_VERSION=${ISTIO_VERSION} sh -
12+
cd istio-${ISTIO_VERSION}
13+
export PATH=$PWD/bin:$PATH
14+
istioctl install -y
15+
popd
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
KIND_VERSION="0.22.0"
6+
KIND_URL="https://kind.sigs.k8s.io/dl/v${KIND_VERSION}/kind-linux-amd64"
7+
8+
echo "Setting up kind environment..."
9+
sudo swapoff -a
10+
sudo rm -f /swapfile
11+
sudo mkdir -p /tmp/etcd
12+
sudo mount -t tmpfs tmpfs /tmp/etcd
13+
14+
echo "Installing kind ${KIND_VERSION} ..."
15+
curl -sL -o kind "$KIND_URL"
16+
chmod +x ./kind
17+
sudo mv kind /usr/local/bin
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
KUSTOMIZE_VERSION="5.4.1"
6+
KUSTOMIZE_URL="https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz"
7+
8+
echo "Installing kustomize ${KUSTOMIZE_VERSION} ..."
9+
curl -sL -o kustomize.tar.gz "$KUSTOMIZE_URL"
10+
tar -xzf kustomize.tar.gz
11+
chmod +x kustomize
12+
sudo mv kustomize /usr/local/bin
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: kind.x-k8s.io/v1alpha4
2+
kind: Cluster
3+
# Configure registry for KinD.
4+
containerdConfigPatches:
5+
- |-
6+
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."$REGISTRY_NAME:$REGISTRY_PORT"]
7+
endpoint = ["http://$REGISTRY_NAME:$REGISTRY_PORT"]
8+
# This is needed in order to support projected volumes with service account tokens.
9+
# See: https://kubernetes.slack.com/archives/CEKK1KTN2/p1600268272383600
10+
kubeadmConfigPatches:
11+
- |
12+
apiVersion: kubeadm.k8s.io/v1beta2
13+
kind: ClusterConfiguration
14+
metadata:
15+
name: config
16+
apiServer:
17+
extraArgs:
18+
"service-account-issuer": "kubernetes.default.svc"
19+
"service-account-signing-key-file": "/etc/kubernetes/pki/sa.key"
20+
nodes:
21+
- role: control-plane
22+
image: kindest/node:v1.25.3@sha256:f52781bc0d7a19fb6c405c2af83abfeb311f130707a0e219175677e366cc45d1
23+
- role: worker
24+
image: kindest/node:v1.25.3@sha256:f52781bc0d7a19fb6c405c2af83abfeb311f130707a0e219175677e366cc45d1

0 commit comments

Comments
 (0)