Skip to content

Commit ff05901

Browse files
committed
wip
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent 899e345 commit ff05901

File tree

4 files changed

+36
-18
lines changed

4 files changed

+36
-18
lines changed

observability/install-observability.sh

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@ helm repo add prometheus-community https://prometheus-community.github.io/helm-c
4545
helm repo update
4646
echo -e "${GREEN}✓ Helm repositories added${NC}"
4747

48+
echo -e "\n${GREEN}========================================${NC}"
49+
echo -e "${GREEN}Installing Components (Parallel)${NC}"
50+
echo -e "${GREEN}========================================${NC}"
51+
echo -e "The following will be installed:"
52+
echo -e " • cert-manager"
53+
echo -e " • OpenTelemetry Operator"
54+
echo -e " • Prometheus & Grafana"
55+
echo -e " • OpenTelemetry Collector"
56+
echo -e " • Service Monitors"
57+
echo -e "\n${YELLOW}All resources will be applied first, then we'll wait for them to become ready.${NC}\n"
58+
4859
# Install cert-manager (required for OpenTelemetry Operator)
4960
echo -e "\n${YELLOW}Installing cert-manager...${NC}"
5061
if kubectl get namespace cert-manager > /dev/null 2>&1; then
@@ -53,9 +64,8 @@ else
5364
kubectl create namespace cert-manager
5465
helm install cert-manager jetstack/cert-manager \
5566
--namespace cert-manager \
56-
--set crds.enabled=true \
57-
--wait
58-
echo -e "${GREEN}✓ cert-manager installed${NC}"
67+
--set crds.enabled=true
68+
echo -e "${GREEN}✓ cert-manager installation started${NC}"
5969
fi
6070

6171
# Create observability namespace
@@ -70,15 +80,13 @@ if helm list -n observability | grep -q opentelemetry-operator; then
7080
echo -e "${YELLOW}OpenTelemetry Operator already installed, upgrading...${NC}"
7181
helm upgrade opentelemetry-operator open-telemetry/opentelemetry-operator \
7282
--namespace observability \
73-
--set "manager.collectorImage.repository=otel/opentelemetry-collector-contrib" \
74-
--wait
83+
--set "manager.collectorImage.repository=otel/opentelemetry-collector-contrib"
7584
else
7685
helm install opentelemetry-operator open-telemetry/opentelemetry-operator \
7786
--namespace observability \
78-
--set "manager.collectorImage.repository=otel/opentelemetry-collector-contrib" \
79-
--wait
87+
--set "manager.collectorImage.repository=otel/opentelemetry-collector-contrib"
8088
fi
81-
echo -e "${GREEN}✓ OpenTelemetry Operator installed${NC}"
89+
echo -e "${GREEN}✓ OpenTelemetry Operator installation started${NC}"
8290

8391
# Install kube-prometheus-stack (includes Prometheus + Grafana)
8492
echo -e "\n${YELLOW}Installing Prometheus and Grafana stack...${NC}"
@@ -88,17 +96,15 @@ if helm list -n observability | grep -q kube-prometheus-stack; then
8896
--namespace observability \
8997
--set prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues=false \
9098
--set prometheus.prometheusSpec.podMonitorSelectorNilUsesHelmValues=false \
91-
--set grafana.adminPassword=admin \
92-
--wait
99+
--set grafana.adminPassword=admin
93100
else
94101
helm install kube-prometheus-stack prometheus-community/kube-prometheus-stack \
95102
--namespace observability \
96103
--set prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues=false \
97104
--set prometheus.prometheusSpec.podMonitorSelectorNilUsesHelmValues=false \
98-
--set grafana.adminPassword=admin \
99-
--wait
105+
--set grafana.adminPassword=admin
100106
fi
101-
echo -e "${GREEN}✓ Prometheus and Grafana installed${NC}"
107+
echo -e "${GREEN}✓ Prometheus and Grafana installation started${NC}"
102108

103109
# Create OpenTelemetry Collector instance
104110
echo -e "\n${YELLOW}Creating OpenTelemetry Collector...${NC}"
@@ -195,8 +201,19 @@ EOF
195201
echo -e "${GREEN}✓ ServiceMonitor created${NC}"
196202

197203
# Wait for all pods to be ready
198-
echo -e "\n${YELLOW}Waiting for all pods to be ready...${NC}"
204+
echo -e "\n${GREEN}========================================${NC}"
205+
echo -e "${GREEN}All resources have been applied!${NC}"
206+
echo -e "${GREEN}========================================${NC}"
207+
echo -e "\n${YELLOW}Waiting for all pods to become ready (this may take 2-3 minutes)...${NC}"
208+
209+
# Wait for cert-manager pods
210+
echo -e "${YELLOW}Checking cert-manager pods...${NC}"
211+
kubectl wait --for=condition=ready pod --all -n cert-manager --timeout=300s 2>/dev/null || echo -e "${YELLOW}cert-manager already running or skipped${NC}"
212+
213+
# Wait for observability pods
214+
echo -e "${YELLOW}Checking observability pods...${NC}"
199215
kubectl wait --for=condition=ready pod --all -n observability --timeout=300s
216+
200217
echo -e "${GREEN}✓ All pods are ready${NC}"
201218

202219
# Import Grafana dashboards

sample-operators/webpage/src/main/java/io/javaoperatorsdk/operator/sample/WebPageOperator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public static void main(String[] args) throws IOException {
6161
Metrics metrics = initOTLPMetrics();
6262
Operator operator =
6363
new Operator(o -> o.withStopOnInformerErrorDuringStartup(false).withMetrics(metrics));
64+
6465
String reconcilerEnvVar = System.getenv(WEBPAGE_RECONCILER_ENV);
6566
if (WEBPAGE_CLASSIC_RECONCILER_ENV_VALUE.equals(reconcilerEnvVar)) {
6667
operator.register(new WebPageReconciler());
@@ -81,7 +82,7 @@ public static void main(String[] args) throws IOException {
8182

8283
private static @NonNull Metrics initOTLPMetrics() {
8384
Map<String, String> configProperties = loadConfigFromYaml();
84-
OtlpConfig otlpConfig = configProperties::get;
85+
OtlpConfig otlpConfig = key -> configProperties.get(key);
8586

8687
MeterRegistry registry = new OtlpMeterRegistry(otlpConfig, Clock.SYSTEM);
8788

@@ -93,7 +94,6 @@ public static void main(String[] args) throws IOException {
9394
new ClassLoaderMetrics().bindTo(registry);
9495
new ProcessorMetrics().bindTo(registry);
9596
new UptimeMetrics().bindTo(registry);
96-
log.info("JVM and system metrics registered");
9797

9898
return MicrometerMetrics.newPerResourceCollectingMicrometerMetricsBuilder(registry)
9999
.collectingMetricsPerResource()

sample-operators/webpage/src/main/resources/log4j2.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</Console>
2424
</Appenders>
2525
<Loggers>
26-
<Root level="debug">
26+
<Root level="info">
2727
<AppenderRef ref="Console"/>
2828
</Root>
2929
</Loggers>

sample-operators/webpage/src/main/resources/otlp-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
otlp:
1818
# OTLP Collector endpoint - see observability/install-observability.sh for setup
19-
url: "http://otel-collector-collector.observability.svc.cluster.local:4318/v1/metrics"
19+
url: "http://localhost:4318/v1/metrics"
20+
# url: "http://otel-collector-collector.observability.svc.cluster.local:4318/v1/metrics"
2021
step: 15s
2122
batchSize: 15000
2223
aggregationTemporality: "cumulative"

0 commit comments

Comments
 (0)