Skip to content

Commit

Permalink
Start k3d in ci-container and execute e2e test to k8s cluster (#2554)
Browse files Browse the repository at this point in the history
* feat: start k3d in ci container and execute e2e test to k8s cluster

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

fix: verify for e2e

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

fix: deleted sudo

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

fix: use trimPrefix insted of TrimLeft

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

fix: e2e host

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

fix: update host

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

fix: use bash

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix: deleted unnecessary deps

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* fix: refactor k3d option settings

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* Update .github/actions/setup-k3d/action.yaml

Signed-off-by: Yusuke Kato <kpango@vdaas.org>

---------

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: Yusuke Kato <kpango@vdaas.org>
Co-authored-by: Yusuke Kato <kpango@vdaas.org>
  • Loading branch information
hlts2 and kpango authored Jul 31, 2024
1 parent 005135c commit 2c9d013
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/actions/setup-e2e/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ runs:
if: ${{ inputs.require_libhdf5 == 'true' }}
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y libhdf5-dev
apt-get update
apt-get install -y libhdf5-dev
- name: Setup Go environment
if: ${{ inputs.require_go == 'true' }}
uses: ./.github/actions/setup-go
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-k3d/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ runs:
k3d cluster create ${{ inputs.name }} ${{ steps.k3d_options.outputs.options }} \
--image docker.io/rancher/k3s:latest \
--k3s-arg "--disable=traefik@server:*" \
--api-port 0.0.0.0:6443 \
--api-port host.docker.internal:6550 \
--wait
k3d cluster start ${{ inputs.name }}
k3d kubeconfig merge ${{ inputs.name }} --kubeconfig-switch-context
Expand Down
2 changes: 1 addition & 1 deletion .github/helm/values/values-chaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ gateway:
enabled: true
ingress:
enabled: true
host: "localhost"
host: "host.docker.internal"
service:
# NOTE: https://doc.traefik.io/traefik/routing/providers/kubernetes-ingress/#on-service
annotations:
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/e2e-chaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ env:
INGRESS_PORT: 8081
jobs:
dump-contexts-to-log:
if: startsWith( github.ref, 'refs/tags/') || github.event.action == 'labeled' && github.event.label.name == 'actions/e2e-chaos'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/dump-context
detect-ci-container:
if: startsWith( github.ref, 'refs/tags/') || github.event.action == 'labeled' && github.event.label.name == 'actions/e2e-deploy'
uses: ./.github/workflows/_detect-ci-container.yml
agent-failure:
name: "E2E chaos test (Agent failure: to test insert/search works even if one of the agents is failing)"
Expand All @@ -44,6 +44,7 @@ jobs:
timeout-minutes: 60
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG }}
options: "--add-host host.docker.internal:host-gateway"
steps:
- uses: actions/checkout@v4
- name: Set Git config
Expand All @@ -68,7 +69,7 @@ jobs:
- name: Run Insert and Search operations
run: |
make hack/benchmark/assets/dataset/${{ env.DATASET }}
make E2E_BIND_HOST=localhost \
make E2E_BIND_HOST=host.docker.internal \
E2E_BIND_PORT=8081 \
E2E_PORTFORWARD_ENABLED=false \
E2E_DATASET_NAME=${{ env.DATASET }} \
Expand All @@ -84,6 +85,7 @@ jobs:
timeout-minutes: 60
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG }}
options: "--add-host host.docker.internal:host-gateway"
steps:
- uses: actions/checkout@v4
- name: Set Git config
Expand All @@ -108,7 +110,7 @@ jobs:
- name: Run Insert and Search operations
run: |
make hack/benchmark/assets/dataset/${{ env.DATASET }}
make E2E_BIND_HOST=localhost \
make E2E_BIND_HOST=host.docker.internal \
E2E_BIND_PORT=8081 \
E2E_PORTFORWARD_ENABLED=false \
E2E_DATASET_NAME=${{ env.DATASET }} \
Expand All @@ -124,6 +126,7 @@ jobs:
timeout-minutes: 60
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG }}
options: "--add-host host.docker.internal:host-gateway"
steps:
- uses: actions/checkout@v4
- name: Set Git config
Expand All @@ -148,7 +151,7 @@ jobs:
- name: Run Insert and Search operations
run: |
make hack/benchmark/assets/dataset/${{ env.DATASET }}
make E2E_BIND_HOST=localhost \
make E2E_BIND_HOST=host.docker.internal \
E2E_BIND_PORT=8081 \
E2E_PORTFORWARD_ENABLED=false \
E2E_DATASET_NAME=${{ env.DATASET }} \
Expand All @@ -164,6 +167,7 @@ jobs:
timeout-minutes: 60
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG }}
options: "--add-host host.docker.internal:host-gateway"
steps:
- uses: actions/checkout@v4
- name: Set Git config
Expand All @@ -188,7 +192,7 @@ jobs:
- name: Run Insert and Search operations
run: |
make hack/benchmark/assets/dataset/${{ env.DATASET }}
make E2E_BIND_HOST=localhost \
make E2E_BIND_HOST=host.docker.internal \
E2E_BIND_PORT=8081 \
E2E_PORTFORWARD_ENABLED=false \
E2E_DATASET_NAME=${{ env.DATASET }} \
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/e2e-code-bench-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
needs: [detect-ci-container]
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG }}
options: "--add-host host.docker.internal:host-gateway"
steps:
- uses: actions/checkout@v4
- name: Set Git config
Expand Down Expand Up @@ -85,6 +86,7 @@ jobs:
needs: [detect-ci-container]
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG }}
options: "--add-host host.docker.internal:host-gateway"
steps:
- uses: actions/checkout@v4
- name: Set Git config
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/e2e-max-dim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ on:
- "labeled"
jobs:
dump-contexts-to-log:
if: startsWith( github.ref, 'refs/tags/') || github.event.action == 'labeled' && github.event.label.name == 'actions/e2e-max-dim'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/dump-context
detect-ci-container:
if: startsWith( github.ref, 'refs/tags/') || github.event.action == 'labeled' && github.event.label.name == 'actions/e2e-deploy'
uses: ./.github/workflows/_detect-ci-container.yml
e2e-max-dimension-insert:
name: "E2E test (Max Dimension Insert: skip strict exist check)"
Expand All @@ -41,6 +41,7 @@ jobs:
timeout-minutes: 60
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG }}
options: "--add-host host.docker.internal:host-gateway"
steps:
- uses: actions/checkout@v4
- name: Set Git config
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/e2e-profiling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ env:
DATASET: fashion-mnist-784-euclidean.hdf5
jobs:
dump-contexts-to-log:
if: startsWith( github.ref, 'refs/tags/') || github.event.action == 'labeled' && github.event.label.name == 'actions/e2e-profiling'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/dump-context
detect-ci-container:
if: startsWith( github.ref, 'refs/tags/') || github.event.action == 'labeled' && github.event.label.name == 'actions/e2e-deploy'
uses: ./.github/workflows/_detect-ci-container.yml
e2e-profiling:
name: "E2E profiling"
Expand All @@ -42,6 +42,7 @@ jobs:
timeout-minutes: 60
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG }}
options: "--add-host host.docker.internal:host-gateway"
steps:
- uses: actions/checkout@v4
- name: Set Git config
Expand Down Expand Up @@ -104,10 +105,6 @@ jobs:
path: ./profiles-main
key: ${{ runner.os }}-profiles-main-${{ github.sha }}
restore-keys: ${{ runner.os }}-profiles-main-
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y graphviz
- name: Generate graphs
run: |
tag=$(cat profiles-main/VALD_VERSION || echo "unknown")
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ env:
DATASET: fashion-mnist-784-euclidean.hdf5
jobs:
dump-contexts-to-log:
if: startsWith( github.ref, 'refs/tags/') || github.event.action == 'labeled' && github.event.label.name == 'actions/e2e-deploy'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/dump-context
detect-ci-container:
if: startsWith( github.ref, 'refs/tags/') || github.event.action == 'labeled' && github.event.label.name == 'actions/e2e-deploy'
uses: ./.github/workflows/_detect-ci-container.yml
e2e-stream-crud:
name: "E2E test (Stream CRUD)"
Expand All @@ -42,6 +42,7 @@ jobs:
timeout-minutes: 60
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG }}
options: "--add-host host.docker.internal:host-gateway"
steps:
- uses: actions/checkout@v4
- name: Set Git config
Expand Down Expand Up @@ -82,6 +83,7 @@ jobs:
timeout-minutes: 60
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG }}
options: "--add-host host.docker.internal:host-gateway"
steps:
- uses: actions/checkout@v4
- name: Set Git config
Expand All @@ -100,6 +102,7 @@ jobs:
require_helm: false
require_k3d: false
- name: Merge Docker image tag
shell: bash
run: |
IMAGE_TAGS=(${{ steps.setup_e2e.outputs.IMAGE_TAGS }})
Expand Down Expand Up @@ -144,6 +147,7 @@ jobs:
timeout-minutes: 60
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG }}
options: "--add-host host.docker.internal:host-gateway"
steps:
- uses: actions/checkout@v4
- name: Set Git config
Expand Down Expand Up @@ -188,6 +192,7 @@ jobs:
timeout-minutes: 60
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG }}
options: "--add-host host.docker.internal:host-gateway"
steps:
- uses: actions/checkout@v4
- name: Set Git config
Expand Down Expand Up @@ -228,6 +233,7 @@ jobs:
timeout-minutes: 60
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG }}
options: "--add-host host.docker.internal:host-gateway"
steps:
- uses: actions/checkout@v4
- name: Set Git config
Expand Down Expand Up @@ -264,6 +270,7 @@ jobs:
timeout-minutes: 60
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG }}
options: "--add-host host.docker.internal:host-gateway"
steps:
- uses: actions/checkout@v4
- name: Set Git config
Expand Down Expand Up @@ -297,6 +304,7 @@ jobs:
timeout-minutes: 60
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG }}
options: "--add-host host.docker.internal:host-gateway"
steps:
- uses: actions/checkout@v4
- name: Set Git config
Expand Down Expand Up @@ -347,6 +355,7 @@ jobs:
timeout-minutes: 60
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG }}
options: "--add-host host.docker.internal:host-gateway"
steps:
- uses: actions/checkout@v4
- name: Set Git config
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/kubernetes/portforward/portforward.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (p *Portforward) Start() error {
path := fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/portforward",
p.namespace, p.podName)

hostIP := strings.TrimLeft(p.restConfig.Host, "https:/")
hostIP := strings.TrimPrefix(strings.TrimPrefix(p.restConfig.Host, "http://"), "https://")

transport, upgrader, err := spdy.RoundTripperFor(p.restConfig)
if err != nil {
Expand Down

0 comments on commit 2c9d013

Please sign in to comment.