Skip to content

[Docs] add place holder docs #69

[Docs] add place holder docs

[Docs] add place holder docs #69

Workflow file for this run

name: Test Deployment
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Install k3d
run: curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
- name: Create k3d cluster
run: k3d cluster create test --wait
- name: Install Helm
run: |
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- name: Update Helm dependencies
run: helm dependency update chart
- name: Stage stub OTel DaemonSet (mimics NIC's collector in the cluster)
run: |
set -e
kubectl create namespace monitoring
# Stub DaemonSet so the post-install Job's `rollout restart` and
# `rollout status` have something to act on. Uses pause image (tiny,
# always available). We do NOT stub NIC's ConfigMap anymore — this
# chart no longer touches it; it just renders its own override CM.
cat <<'EOF' | kubectl apply -f -
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: opentelemetry-collector-agent
namespace: monitoring
spec:
selector:
matchLabels:
app: stub-otel
template:
metadata:
labels:
app: stub-otel
spec:
containers:
- name: pause
image: registry.k8s.io/pause:3.9
EOF
kubectl -n monitoring rollout status daemonset/opentelemetry-collector-agent --timeout=2m
- name: Deploy chart
run: |
helm install lgtm-pack chart --namespace default \
--set nebariapp.enabled=false \
--set grafana.envFromConfigMaps=null \
--set grafana.envValueFrom=null \
--set otelCollectorOverrides.enabled=true \
--timeout 10m
- name: Verify override ConfigMap rendered with correct content
run: |
set -e
echo "=== Override ConfigMap ==="
kubectl -n monitoring get cm opentelemetry-collector-overrides \
-o jsonpath='{.data.relay\.yaml}' | tee /tmp/overrides.yaml
echo
# All three exporter endpoints present, derived from release name "lgtm-pack"
grep -q 'http://lgtm-pack-loki:3100/otlp' /tmp/overrides.yaml
grep -q 'http://lgtm-pack-tempo:4317' /tmp/overrides.yaml
grep -q 'http://lgtm-pack-mimir-gateway/otlp' /tmp/overrides.yaml
# Each pipeline routes ONLY to its respective backend exporter
# (no debug). Parse with yq so we check the actual list contents.
for pipeline_pair in "logs:otlphttp/loki" "traces:otlp/tempo" "metrics:otlphttp/mimir"; do
pipeline="${pipeline_pair%:*}"
expected="${pipeline_pair#*:}"
actual=$(yq ".service.pipelines.${pipeline}.exporters | join(\",\")" /tmp/overrides.yaml)
if [ "$actual" != "$expected" ]; then
echo "FAIL: pipeline ${pipeline} exporters = [${actual}], expected [${expected}]"
exit 1
fi
done
echo "All pipelines correctly route to LGTM exporters."
- name: Verify rollout Job ran successfully
run: |
set -e
# The post-install Job rolls the stub DaemonSet. With pause as the
# container, rollout completes immediately. We just confirm the Job
# reached completion (it's cleaned up by hook-succeeded, so check
# the DaemonSet's revision history instead).
revision=$(kubectl -n monitoring get daemonset opentelemetry-collector-agent \
-o jsonpath='{.metadata.annotations.deprecated\.daemonset\.template\.generation}')
if [ "${revision:-1}" = "1" ]; then
echo "FAIL: DaemonSet was not rolled by the post-install Job"
kubectl -n monitoring get daemonset opentelemetry-collector-agent -o yaml | head -40
exit 1
fi
echo "DaemonSet generation is ${revision} — rollout completed."
- name: Dump rollout Job logs on failure
if: failure()
run: |
echo "=== Rollout Job pods ==="
kubectl -n monitoring get pods -l app.kubernetes.io/component=otel-rollout
echo "=== Rollout Job logs ==="
kubectl -n monitoring logs -l app.kubernetes.io/component=otel-rollout --tail=200 || true
echo "=== Override CM (if rendered) ==="
kubectl -n monitoring get cm opentelemetry-collector-overrides -o yaml || true
- name: Wait for Grafana
run: |
for i in {1..60}; do
echo "=== Attempt $i/60 ==="
kubectl get pods
if kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=grafana --timeout=5s 2>/dev/null; then
echo "Grafana pod ready!"
exit 0
fi
sleep 5
done
echo "Timeout waiting for Grafana"
exit 1
- name: Test Grafana health endpoint
run: |
kubectl port-forward svc/lgtm-pack-grafana 3000:80 &
PF_PID=$!
sleep 5
echo "=== Grafana health check ==="
curl -sS http://localhost:3000/api/health
echo ""
curl -sS http://localhost:3000/api/health | grep -q '"database": "ok"'
RESULT=$?
kill $PF_PID 2>/dev/null || true
exit $RESULT
- name: Test datasource provisioning
run: |
kubectl port-forward svc/lgtm-pack-grafana 3000:80 &
PF_PID=$!
sleep 5
echo "=== Checking datasources ==="
curl -sS -u admin:admin http://localhost:3000/api/datasources
echo ""
# Verify Loki datasource exists
curl -sS -u admin:admin http://localhost:3000/api/datasources | grep -q '"name":"Loki"'
RESULT=$?
kill $PF_PID 2>/dev/null || true
exit $RESULT
- name: Test Loki log push and query
run: |
kubectl port-forward svc/lgtm-pack-loki 3100:3100 &
PF_PID=$!
sleep 5
# Push a test log entry
echo "=== Pushing test log ==="
curl -sS -X POST http://localhost:3100/loki/api/v1/push \
-H "Content-Type: application/json" \
-d '{"streams":[{"stream":{"job":"ci-test"},"values":[["'$(date +%s)000000000'","hello from CI"]]}]}'
echo ""
# Query for it
echo "=== Querying Loki ==="
sleep 2
curl -sS 'http://localhost:3100/loki/api/v1/query?query={job="ci-test"}'
echo ""
kill $PF_PID 2>/dev/null || true
- name: Dump logs on failure
if: failure()
run: |
echo "=== Grafana logs ==="
kubectl logs -l app.kubernetes.io/name=grafana --tail=100 2>/dev/null || true
echo "=== Loki logs ==="
kubectl logs -l app.kubernetes.io/name=loki --tail=100 2>/dev/null || true
echo "=== Tempo logs ==="
kubectl logs -l app.kubernetes.io/name=tempo --tail=100 2>/dev/null || true
echo "=== Mimir logs ==="
kubectl logs -l app.kubernetes.io/name=mimir --tail=100 2>/dev/null || true
echo "=== All pods ==="
kubectl get pods -o wide
echo "=== Events ==="
kubectl get events --sort-by=.lastTimestamp