forked from elastic/opentelemetry
-
Notifications
You must be signed in to change notification settings - Fork 1
97 lines (85 loc) · 4.54 KB
/
operator-regression.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Regression Testing Operator Integration
on:
workflow_dispatch:
env:
AGENT_TESTS: java python
#go dotnet --- both pending // nodejs
permissions:
contents: read
jobs:
integration-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Kind cluster and local Docker registry
run:
bash test/operator/kind-with-registry.sh
- name: Start Elasticsearch
run: |
docker network create elastic
#Local elasticsearch without SSL on http://localhost:9200
docker run --name es01 --net elastic -p 9200:9200 -m 1GB -e xpack.security.enabled=false -e xpack.security.enrollment.enabled=false -e discovery.type=single-node docker.elastic.co/elasticsearch/elasticsearch:8.16.1 1>es.log 2>&1 &
bash test/operator/utilities/wait_for_es_http_ready.bash http://localhost:9200
- name: Start Collector
run: |
#Elastic agent from download instructions
curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-8.16.1-linux-x86_64.tar.gz
tar xzvf elastic-agent-*-linux-x86_64.tar.gz
cd elastic-agent-*-linux-x86_64/
#Use latext collector config for elastic agent
curl -L -O https://raw.githubusercontent.com/elastic/elastic-agent/refs/heads/main/internal/pkg/otel/samples/linux/logs_metrics_traces.yml
#bind to ANY rather than LOOPBACK so that the pods can connect
sed -e 's/http:/http:\n endpoint: 0.0.0.0:4318/' logs_metrics_traces.yml > logs_metrics_traces2.yml
export STORAGE_DIR=/var/tmp
export ELASTIC_ENDPOINT=http://localhost:9200
export ELASTIC_API_KEY=nothing
sudo -E ./elastic-agent otel --config logs_metrics_traces2.yml 1>collector.log 2>&1 &
bash ../test/operator/utilities/wait_for_log_entry.bash collector.log "elastic agent collector" "Everything is ready"
- name: Test Collector
run: |
echo "Nothing here yet"
- name: Create Test Images
run: |
for t in ${AGENT_TESTS[@]}
do
echo "Creating image for $t"
docker build -t $t-test-app test/operator/$t
docker tag $t-test-app localhost:5001/registry/$t-test-app
docker push localhost:5001/registry/$t-test-app
done
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.13.3
- name: Install Operator
run: |
bash test/operator/match_and_execute.sh "kubectl create namespace opentelemetry-operator-system"
bash test/operator/match_and_execute.sh "helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts"
helm repo update
bash test/operator/match_and_execute.sh "helm upgrade --install --namespace opentelemetry-operator-system opentelemetry-kube-stack open-telemetry/opentelemetry-kube-stack --values 'https://raw.githubusercontent.com/elastic/opentelemetry/refs/heads/8.16/resources/kubernetes/operator/helm/values.yaml' --version 0.3.3"
bash test/operator/wait_for_pod_start.sh opentelemetry-operator-system opentelemetry-operator 2/2 1
kubectl get pods -A
- name: Start Test Images
run: |
HOST_IP=$(hostname -I | awk '{print $1}')
echo "using host ip $HOST_IP"
sed -e "s/REPLACE/$HOST_IP/" test/operator/utilities/endpoint.yml > endpoint.yml
kubectl create namespace banana
kubectl apply -f test/operator/utilities/dummyservice.yml
kubectl apply -f endpoint.yml
for t in ${AGENT_TESTS[@]}
do
if [ "x$t" = "xgo" ]; then CONTAINER_READY="2/2"; else CONTAINER_READY="1/1"; fi
AGENT_START_GREP=`grep -A1 AGENT_HAS_STARTED_IF_YOU_SEE test/operator/$t/test-app.yaml | perl -ne '/value:\s*"(.*)"/ && print "$1\n"'`
echo "Starting pod for $t"
kubectl create -f test/operator/$t/test-app.yaml
bash test/operator/wait_for_pod_start.sh banana $t-test-app $CONTAINER_READY 1
kubectl logs pod/$t-test-app -n banana
bash test/operator/wait_for_agent_start.sh banana $t-test-app "$AGENT_START_GREP"
bash test/operator/utilities/wait_for_es_transaction.bash http://localhost:9200 $t-test-app "kubectl logs pod/$t-test-app -n banana"
kubectl logs pod/$t-test-app -n banana
kubectl delete -f test/operator/$t/test-app.yaml
done