Skip to content

Commit 1a07a04

Browse files
authored
improve: metrics processing e2e test stability (#3244)
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent b308d3c commit 1a07a04

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

observability/install-observability.sh

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ else
9292
fi
9393
echo -e "${GREEN}✓ OpenTelemetry Operator installation started${NC}"
9494

95+
# Wait for OpenTelemetry Operator to be ready (webhook must be serving before we create CRs)
96+
echo -e "${YELLOW}Waiting for OpenTelemetry Operator deployment to be ready...${NC}"
97+
kubectl wait --for=condition=Available deployment/opentelemetry-operator -n observability --timeout=120s
98+
echo -e "${GREEN}✓ OpenTelemetry Operator deployment is ready${NC}"
99+
95100
# Install kube-prometheus-stack (includes Prometheus + Grafana)
96101
echo -e "\n${YELLOW}Installing Prometheus and Grafana stack...${NC}"
97102
if helm list -n observability | grep -q kube-prometheus-stack; then
@@ -110,9 +115,9 @@ else
110115
fi
111116
echo -e "${GREEN}✓ Prometheus and Grafana installation started${NC}"
112117

113-
# Create OpenTelemetry Collector instance
118+
# Create OpenTelemetry Collector instance (retry until webhook is fully serving)
114119
echo -e "\n${YELLOW}Creating OpenTelemetry Collector...${NC}"
115-
cat <<EOF | kubectl apply -f -
120+
COLLECTOR_YAML=$(cat <<'EOF'
116121
apiVersion: opentelemetry.io/v1beta1
117122
kind: OpenTelemetryCollector
118123
metadata:
@@ -168,7 +173,19 @@ spec:
168173
processors: [memory_limiter, batch]
169174
exporters: [debug]
170175
EOF
171-
echo -e "${GREEN}✓ OpenTelemetry Collector created${NC}"
176+
)
177+
for i in $(seq 1 20); do
178+
if echo "$COLLECTOR_YAML" | kubectl apply -f - 2>/dev/null; then
179+
echo -e "${GREEN}✓ OpenTelemetry Collector created${NC}"
180+
break
181+
fi
182+
if [ "$i" -eq 20 ]; then
183+
echo -e "${RED}✗ Failed to create OpenTelemetry Collector after 20 attempts${NC}"
184+
exit 1
185+
fi
186+
echo -e "${YELLOW} Webhook not ready yet, retrying ($i/20)...${NC}"
187+
sleep 5
188+
done
172189

173190
# Create ServiceMonitor for OpenTelemetry Collector
174191
echo -e "\n${YELLOW}Creating ServiceMonitor for OpenTelemetry...${NC}"

0 commit comments

Comments
 (0)