Skip to content

Commit dae8f8c

Browse files
WIP - e2e
1 parent cecae82 commit dae8f8c

16 files changed

+1858
-1
lines changed

.github/actions/kind/action.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: "Set up KinD"
2+
description: "Step to start and configure KinD cluster"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Init directories
8+
shell: bash
9+
run: |
10+
TEMP_DIR="$(pwd)/tmp"
11+
mkdir -p "${TEMP_DIR}"
12+
echo "TEMP_DIR=${TEMP_DIR}" >> $GITHUB_ENV
13+
14+
mkdir -p "$(pwd)/bin"
15+
echo "$(pwd)/bin" >> $GITHUB_PATH
16+
17+
- name: Container image registry
18+
shell: bash
19+
run: |
20+
podman run -d -p 5000:5000 --name registry registry:2.8.1
21+
22+
export REGISTRY_ADDRESS=$(hostname -i):5000
23+
echo "REGISTRY_ADDRESS=${REGISTRY_ADDRESS}" >> $GITHUB_ENV
24+
echo "Container image registry started at ${REGISTRY_ADDRESS}"
25+
26+
KIND_CONFIG_FILE=${{ env.TEMP_DIR }}/kind.yaml
27+
echo "KIND_CONFIG_FILE=${KIND_CONFIG_FILE}" >> $GITHUB_ENV
28+
envsubst < .github/resources-kind/kind.yaml > ${KIND_CONFIG_FILE}
29+
30+
sudo --preserve-env=REGISTRY_ADDRESS sh -c 'cat > /etc/containers/registries.conf.d/local.conf <<EOF
31+
[[registry]]
32+
prefix = "$REGISTRY_ADDRESS"
33+
insecure = true
34+
location = "$REGISTRY_ADDRESS"
35+
EOF'
36+
37+
- name: Setup KinD cluster
38+
uses: helm/[email protected]
39+
with:
40+
cluster_name: cluster
41+
version: v0.17.0
42+
config: ${{ env.KIND_CONFIG_FILE }}
43+
44+
- name: Print cluster info
45+
shell: bash
46+
run: |
47+
echo "KinD cluster:"
48+
kubectl cluster-info
49+
kubectl describe nodes
50+
51+
- name: Install Ingress controller
52+
shell: bash
53+
run: |
54+
VERSION=controller-v1.6.4
55+
echo "Deploying Ingress controller into KinD cluster"
56+
curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/"${VERSION}"/deploy/static/provider/kind/deploy.yaml | sed "s/--publish-status-address=localhost/--report-node-internal-ip-address\\n - --status-update-interval=10/g" | kubectl apply -f -
57+
kubectl annotate ingressclass nginx "ingressclass.kubernetes.io/is-default-class=true"
58+
kubectl -n ingress-nginx wait --timeout=300s --for=condition=Available deployments --all

.github/resources-kind/kind.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# ---------------------------------------------------------------------------
2+
# Copyright 2023.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# ---------------------------------------------------------------------------
16+
17+
kind: Cluster
18+
apiVersion: kind.x-k8s.io/v1alpha4
19+
nodes:
20+
- role: control-plane
21+
image: kindest/node:v1.25.3@sha256:f52781bc0d7a19fb6c405c2af83abfeb311f130707a0e219175677e366cc45d1
22+
kubeadmConfigPatches:
23+
- |
24+
kind: InitConfiguration
25+
nodeRegistration:
26+
kubeletExtraArgs:
27+
node-labels: "ingress-ready=true"
28+
containerdConfigPatches:
29+
- |-
30+
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."${REGISTRY_ADDRESS}"]
31+
endpoint = ["http://${REGISTRY_ADDRESS}"]

.github/workflows/e2e_tests.yaml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: e2e
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- 'release-*'
8+
paths-ignore:
9+
- 'docs/**'
10+
- '**.adoc'
11+
- '**.md'
12+
- 'LICENSE'
13+
push:
14+
branches:
15+
- main
16+
- 'release-*'
17+
paths-ignore:
18+
- 'docs/**'
19+
- '**.adoc'
20+
- '**.md'
21+
- 'LICENSE'
22+
23+
concurrency:
24+
group: ${{ github.head_ref }}-${{ github.workflow }}
25+
cancel-in-progress: true
26+
27+
jobs:
28+
kubernetes:
29+
30+
runs-on: ubuntu-20.04
31+
32+
steps:
33+
- name: Cleanup
34+
run: |
35+
ls -lart
36+
echo "Initial status:"
37+
df -h
38+
39+
echo "Cleaning up resources:"
40+
sudo swapoff -a
41+
sudo rm -f /swapfile
42+
sudo apt clean
43+
sudo rm -rf /usr/share/dotnet
44+
sudo rm -rf /opt/ghc
45+
sudo rm -rf "/usr/local/share/boost"
46+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
47+
docker rmi $(docker image ls -aq)
48+
49+
echo "Final status:"
50+
df -h
51+
52+
- name: Checkout code
53+
uses: actions/checkout@v2
54+
with:
55+
submodules: recursive
56+
57+
- name: Checkout CodeFlare operator repository
58+
uses: actions/checkout@v3
59+
with:
60+
repository: project-codeflare/codeflare-operator
61+
path: codeflare-operator
62+
63+
- name: Set Go
64+
uses: actions/setup-go@v3
65+
with:
66+
go-version: v1.19
67+
68+
- name: Set up gotestfmt
69+
uses: gotesttools/gotestfmt-action@v2
70+
with:
71+
token: ${{ secrets.GITHUB_TOKEN }}
72+
73+
- name: Setup and start KinD cluster
74+
uses: ./.github/actions/kind
75+
76+
- name: Deploy CodeFlare stack
77+
id: deploy
78+
run: |
79+
cd codeflare-operator
80+
echo Deploying CodeFlare operator
81+
IMG="${REGISTRY_ADDRESS}"/codeflare-operator
82+
make image-push -e IMG="${IMG}"
83+
make deploy -e IMG="${IMG}"
84+
kubectl wait --timeout=120s --for=condition=Available=true deployment -n openshift-operators codeflare-operator-manager
85+
86+
echo Setting up CodeFlare stack
87+
make setup-e2e
88+
89+
cd ..
90+
91+
- name: Run e2e tests
92+
run: |
93+
export CODEFLARE_TEST_TIMEOUT_SHORT=1m
94+
export CODEFLARE_TEST_TIMEOUT_MEDIUM=5m
95+
export CODEFLARE_TEST_TIMEOUT_LONG=10m
96+
97+
export CODEFLARE_TEST_OUTPUT_DIR=${{ env.TEMP_DIR }}
98+
echo "CODEFLARE_TEST_OUTPUT_DIR=${CODEFLARE_TEST_OUTPUT_DIR}" >> $GITHUB_ENV
99+
100+
set -euo pipefail
101+
go test -timeout 30m -v ./tests/e2e -json 2>&1 | tee ${CODEFLARE_TEST_OUTPUT_DIR}/gotest.log | gotestfmt
102+
103+
- name: Print CodeFlare operator logs
104+
if: always() && steps.deploy.outcome == 'success'
105+
run: |
106+
echo "Printing CodeFlare operator logs"
107+
kubectl logs -n openshift-operators --tail -1 -l app.kubernetes.io/name=codeflare-operator | tee ${CODEFLARE_TEST_OUTPUT_DIR}/codeflare-operator.log
108+
109+
- name: Print MCAD controller logs
110+
if: always() && steps.deploy.outcome == 'success'
111+
run: |
112+
echo "Printing MCAD controller logs"
113+
kubectl logs -n codeflare-system --tail -1 -l component=multi-cluster-application-dispatcher | tee ${CODEFLARE_TEST_OUTPUT_DIR}/mcad.log
114+
115+
- name: Print KubeRay operator logs
116+
if: always() && steps.deploy.outcome == 'success'
117+
run: |
118+
echo "Printing KubeRay operator logs"
119+
kubectl logs -n ray-system --tail -1 -l app.kubernetes.io/name=kuberay | tee ${CODEFLARE_TEST_OUTPUT_DIR}/kuberay.log
120+
121+
- name: Upload logs
122+
uses: actions/upload-artifact@v3
123+
if: always() && steps.deploy.outcome == 'success'
124+
with:
125+
name: logs
126+
retention-days: 10
127+
path: |
128+
${{ env.CODEFLARE_TEST_OUTPUT_DIR }}/**/*.log

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Build the manager binary
2+
FROM registry.access.redhat.com/ubi8/go-toolset:1.19.10-10 as builder
3+
4+
WORKDIR /workspace
5+
# Copy the Go Modules manifests
6+
COPY go.mod go.mod
7+
COPY go.sum go.sum
8+
RUN go mod download
9+
10+
# Copy the go source
11+
COPY main.go main.go
12+
COPY api/ api/
13+
COPY controllers/ controllers/
14+
15+
# Build
16+
USER root
17+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
18+
19+
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7
20+
WORKDIR /
21+
COPY --from=builder /workspace/manager .
22+
COPY config/internal config/internal
23+
24+
USER 65532:65532
25+
ENTRYPOINT ["/manager"]

0 commit comments

Comments
 (0)