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
21 changes: 19 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: lint
run: helm lint charts/*

test_primary_site:
test_query_optimized_primary_site:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -30,7 +30,24 @@ jobs:
env:
FOXGLOVE_API_URL: ${{ vars.TEST_PRIMARY_SITE_API_URL }}
FOXGLOVE_SITE_TOKEN: ${{ secrets.TEST_PRIMARY_SITE_TOKEN }}
run: ./tests/test-primary-site-chart.sh ./charts/primary-site
run: ./tests/test-query-optimized-primary-site-chart.sh ./charts/primary-site
test_index_in_place_primary_site:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Start minio
run: docker compose up minio -d
working-directory: tests
- name: Create minio buckets
run: docker compose up createbuckets
working-directory: tests
- uses: medyagh/setup-minikube@v0.0.20
- name: Test primary site chart install
timeout-minutes: 5
env:
FOXGLOVE_API_URL: ${{ vars.TEST_PRIMARY_SITE_API_URL }}
FOXGLOVE_SITE_TOKEN: ${{ secrets.TEST_INDEX_IN_PLACE_PRIMARY_SITE_TOKEN }}
run: ./tests/test-index-in-place-primary-site-chart.sh ./charts/primary-site

test_remote_data_loader:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion charts/primary-site/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ type: application
# 1.0.0-alpha.0
# 1.0.0-alpha.1
# 1.0.0
version: "0.0.92"
version: "0.0.93"

appVersion: "d89547eb138c8c2eb0ddb07f2cc89284c822ecdc"
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{{- $indexingStrategy := include "primary-site.indexingStrategy" . }}
{{- if eq $indexingStrategy "split-files" }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -112,4 +110,3 @@ spec:
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end}}
{{- end }}
3 changes: 0 additions & 3 deletions charts/primary-site/templates/services/site-controller.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{{- $indexingStrategy := include "primary-site.indexingStrategy" . }}
{{- if eq $indexingStrategy "split-files" }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -17,4 +15,3 @@ spec:
targetPort: 6001
selector:
app: site-controller
{{- end }}
1 change: 0 additions & 1 deletion charts/primary-site/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ queryService:
## annotations:
## eks.amazonaws.com/role-arn: arn:aws:iam::xxxxxxxxxxxx:role/foxglove-query-service-sa-role

# The site-controller is only deployed if `indexingStrategy` is `split-files`.
siteController:
service:
annotations: {}
Expand Down
1 change: 1 addition & 0 deletions tests/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ services:
/usr/bin/mc alias set minio http://minio:9000 root password;
/usr/bin/mc mb minio/foxglove-lake/;
/usr/bin/mc mb minio/foxglove-inbox/;
/usr/bin/mc mb minio/foxglove-index-in-place/;
/usr/bin/mc mb minio/foxglove-cache/;
exit 0;
"
93 changes: 93 additions & 0 deletions tests/test-index-in-place-primary-site-chart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/usr/bin/env bash

# Install the primary site helm chart into a fresh minikube instance and validate that all the pods were created correctly.
#
# The host environment needs to have the following variables set:
# - FOXGLOVE_API_URL: the URL to the API version being used
# - FOXGLOVE_SITE_TOKEN: a site token for a primary site created with the above API
#
# The host also needs to have minio with an index-in-place bucket created. It can be started with the following:
# ```
# docker compose up -d
# ```
#
# When everything is ready, run the tests with `./test-index-in-place-primary-site-chart.sh ./charts/primary-site`.

set -euo pipefail

chart="${1:-""}"

if [ -z "$chart" ]; then
echo "usage: ./test-index-in-place-primary-site-chart.sh <path to primary site chart>"
exit 1
fi

context="$(kubectl config current-context)";

if [ "$context" != "minikube" ]; then
echo "Tests can only be run against minikube. Tried to run against: $context."
exit 1
fi

api_url="${FOXGLOVE_API_URL}"
site_token="${FOXGLOVE_SITE_TOKEN}"

cloud_credentials_file="$(mktemp --suffix .yaml)"

cat >>"$cloud_credentials_file" <<EOF
apiVersion: v1
kind: Secret
metadata:
name: cloud-credentials
type: Opaque
stringData:
S3_COMPATIBLE_ACCESS_KEY_ID: root
S3_COMPATIBLE_SECRET_ACCESS_KEY: password
S3_COMPATIBLE_SERVICE_REGION: default
S3_COMPATIBLE_SERVICE_URL: http://host.minikube.internal:9000
EOF

trap "rm $cloud_credentials_file" EXIT

set -x

kubectl create namespace foxglove

kubectl create secret generic foxglove-site-token \
--from-literal="FOXGLOVE_SITE_TOKEN=$site_token" \
--namespace foxglove

kubectl apply -f "$cloud_credentials_file" --namespace foxglove

helm upgrade --install foxglove-primary-site "$chart" \
--namespace foxglove \
--set globals.foxgloveApiUrl="$api_url" \
--set globals.indexingStrategy="index-in-place" \
--set globals.indexInPlace.storageProvider="s3_compatible"

log_and_exit() {
kubectl get pods -n foxglove
kubectl get events -n foxglove
kubectl logs -n foxglove deployment/indexer
kubectl logs -n foxglove deployment/query-service
kubectl logs -n foxglove deployment/site-controller
exit 1
}

wait_for_deployment() {
kubectl wait --for=condition=available deployment "$1" --namespace foxglove --timeout=90s || log_and_exit
}

wait_for_pod() {
kubectl wait --for=condition=ready pod -l "app=$1" --namespace foxglove --timeout=90s || log_and_exit
}

# Wait for each of the deployments to complete to make sure pods are created
wait_for_deployment site-controller
wait_for_deployment indexer
wait_for_deployment query-service

# Wait for each of the pods to complete to make sure they didn't fail
wait_for_pod site-controller
wait_for_pod indexer
wait_for_pod query-service
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
# docker compose up -d
# ```
#
# When everything is ready, run the tests with `./test-primary-site-chart.sh ./charts/primary-site`.
# When everything is ready, run the tests with `./test-query-optimized-primary-site-chart.sh ./charts/primary-site`.

set -euo pipefail

chart="${1:-""}"

if [ -z "$chart" ]; then
echo "usage: ./test-primary-site-chart.sh <path to primary site chart>"
echo "usage: ./test-query-optimized-primary-site-chart.sh <path to primary site chart>"
exit 1
fi

Expand Down