Skip to content

allow scraping prom metrics on port 8001 for workers #1508

allow scraping prom metrics on port 8001 for workers

allow scraping prom metrics on port 8001 for workers #1508

Workflow file for this run

name: e2e - k6 ingestion test
on:
workflow_dispatch:
pull_request:
paths:
- ci/**
- charts/**
- .github/workflows/test-k6.yaml
push:
branches:
- main
jobs:
test-chart:
runs-on: ubuntu-20.04
timeout-minutes: 60
strategy:
# Keep running even if one variation of the job fail
fail-fast: false
matrix:
# We run this job multiple times with different parameterization
# specified below, these parameters have no meaning on their own and
# gain meaning on how job steps use them.
include:
- k3s-channel: v1.26
test: install
values: ci/values/k3s.yaml
- k3s-channel: v1.25
test: install
values: ci/values/k3s.yaml
- k3s-channel: v1.24
test: install
values: ci/values/k3s.yaml
# We run an upgrade test where we first install an already released
# Helm chart version and then upgrade to the version we are now
# testing. We test upgrading from the latest main version.
#
# It can be very useful to see the "Helm diff" step's output from the
# latest dev version.
- k3s-channel: v1.26
test: upgrade
values: ci/values/k3s.yaml
# We run one install test with split plugin-server ingestion/async
- k3s-channel: v1.26
test: install
values: ci/values/k3s-plugin-server-ingestion-async-split.yaml
# We run one install test with split plugin-server ingestion/exports/jobs/scheduler
- k3s-channel: v1.26
test: install
values: ci/values/k3s-plugin-server-split.yaml
steps:
- uses: actions/checkout@v3
- name: Setup k3s
run: |
curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=${{ matrix.k3s-channel }} INSTALL_K3S_EXEC="--disable=traefik --disable=metrics-server" sh -
mkdir ~/.kube
sudo k3s kubectl config view --raw > ~/.kube/config
- uses: actions/checkout@v3
if: matrix.test == 'upgrade'
with:
ref: main
path: main
- name: (Upgrade) Install our helm chart from main branch
if: matrix.test == 'upgrade'
run: |
helm upgrade --install -f ${{ matrix.values }} --timeout 30m --create-namespace --namespace posthog posthog ./main/charts/posthog --wait --wait-for-jobs --debug
- name: "(Upgrade) Install helm diff"
if: matrix.test == 'upgrade'
run: |
helm plugin install https://github.com/databus23/helm-diff --version 3.1.3
- name: "(Upgrade) Helm diff - 'main' branch VS local version"
if: matrix.test == 'upgrade'
run: |
helm diff upgrade --install -f ${{ matrix.values }} --namespace posthog posthog ./charts/posthog --debug
- name: "(Upgrade) Await chart install"
if: matrix.test == 'upgrade'
uses: jupyterhub/action-k8s-await-workloads@main
with:
namespace: "posthog"
timeout: 300
max-restarts: 10
- name: Install our helm chart
run: |
helm upgrade --debug --install -f ${{ matrix.values }} --timeout 30m --create-namespace --namespace posthog posthog ./charts/posthog --wait --wait-for-jobs --debug
#
# Wait for all k8s resources to be ready.
#
# Despite the --wait flag used in the command above
# there is no guarantee that all the resources will be deployed
# when the command returns.
#
#
# Why can't we directly use the 'action-k8s-await-workloads' step below?
# Because it's not working for this use case
#
# ref: https://github.com/jupyterhub/action-k8s-await-workloads/issues/38
#
- name: Workaround - wait for all the PostHog resources in k8s to be ready
timeout-minutes: 15
run: ./ci/wait_for_all_the_posthog_resources_to_be_ready.sh
- name: Wait until all the resources are fully deployed in k8s
uses: jupyterhub/action-k8s-await-workloads@main
with:
namespace: "posthog"
timeout: 300
max-restarts: 10
- name: Setup PostHog for the ingestion test
run: ./ci/setup_ingestion_test.sh
- name: Set PostHog endpoints to use for the ingestion test
run: |
POSTHOG_INGRESS=$(kubectl get --namespace posthog ingress posthog -o jsonpath="{.status.loadBalancer.ingress[0].ip}")
echo "POSTHOG_API_ENDPOINT=http://${POSTHOG_INGRESS}" | tee -a "$GITHUB_ENV"
echo "POSTHOG_EVENT_ENDPOINT=http://${POSTHOG_INGRESS}" | tee -a "$GITHUB_ENV"
# Skip the source ip address check in ingestion-test.js
echo "SKIP_SOURCE_IP_ADDRESS_CHECK=true" | tee -a "$GITHUB_ENV"
- name: Run ingestion test using k6
uses: k6io/[email protected]
with:
filename: ci/k6/ingestion-test.js
- name: Emit namespace report
uses: jupyterhub/action-k8s-namespace-report@v1
if: always()
with:
namespace: posthog
important-workloads: deployments/posthog-plugins