1+ {{- if .Values.integrationJob.enabled }}
2+ apiVersion : batch/v1
3+ kind : Job
4+ metadata :
5+ name : integration-duplo
6+ namespace : {{ .Values.global.tenantName }}
7+ spec :
8+ backoffLimit : 0
9+ template :
10+ spec :
11+ containers :
12+ - name : init-duplo
13+ image : " {{ .Values.integrationJob.image }}:{{ .Values.integrationJob.imageTag }}"
14+ command :
15+ - /bin/sh
16+ - -c
17+ - |
18+ echo "Waiting for $DUPLO_AUTOMATION_DEPLOYMENT_NAME to be ready..."
19+ until curl --silent --fail --output /dev/null $DUPLO_AUTOMATION_ENDPOINT; do
20+ echo "Waiting for $DUPLO_AUTOMATION_ENDPOINT to be ready..."
21+ sleep 10
22+ done
23+ echo "Waiting for $GRAFANA_UI to be ready..."
24+ until curl --silent --fail --output /dev/null $GRAFANA_UI; do
25+ echo "Waiting for $GRAFANA_UI to be ready..."
26+ sleep 10
27+ done
28+ echo "Waiting for $MIMIR_RULER to be ready..."
29+ until curl --silent --fail --output /dev/null $MIMIR_RULER; do
30+ echo "Waiting for $MIMIR_RULER to be ready..."
31+ sleep 10
32+ done
33+ echo "Waiting for $MIMIR_ALERTMANAGER to be ready..."
34+ until curl --silent --fail --output /dev/null $MIMIR_ALERTMANAGER; do
35+ echo "Waiting for $MIMIR_ALERTMANAGER to be ready..."
36+ sleep 10
37+ done
38+ echo "installing mimirtool"
39+ ARCH=$(uname -m)
40+ PLATFORM=$( [[ "$ARCH" == "x86_64" ]] && echo "linux-amd64" || ([[ "$ARCH" == "aarch64" ]] && echo "linux-arm64" || echo "linux-armv7"))
41+ curl -fLo mimirtool "https://github.com/grafana/mimir/releases/latest/download/mimirtool-${PLATFORM}"
42+ chmod +x mimirtool
43+ apk add --no-cache git
44+ git clone --depth=1 https://github.com/duplocloud/opentelemetry-release.git
45+ sed -i 's/<<SlackChannelName>>/duplo-otel-alerting/g' opentelemetry-release/integrations/integration-duplo/duplo-default-config.yaml
46+ sed -i "s/<<region>>/$REGION/g" opentelemetry-release/integrations/integration-duplo/datasource-duplo-aws.yaml
47+ sed -i 's|<<SlackWebhook>>|https://hooks.slack.com/services/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|g' opentelemetry-release/integrations/integration-duplo/duplo-default-config.yaml
48+ sed -i 's|<<GrafanaURL>>|grafana-proxy-{{ .Values.global.tenantName }}.{{ .Values.global.dnsSuffix }}|g' opentelemetry-release/integrations/integration-duplo/duplo_templates.tpl
49+ sed -i "s|<<DuploPortalName>>|$DUPLO_PORTAL_NAME|g" opentelemetry-release/integrations/integration-duplo/duplo_templates.tpl
50+ cp opentelemetry-release/integrations/integration-duplo/datasource-duplo-aws.yaml opentelemetry-release/integrations/integration-duplo/provisioning/datasource-duplo-aws.yaml
51+ ./mimirtool alertmanager load opentelemetry-release/integrations/integration-duplo/duplo-default-config.yaml opentelemetry-release/integrations/integration-duplo/duplo_templates.tpl
52+ echo "Triggering Duplo automation integration..."
53+ INTEGRATIONS="apm linuxnode kubernetes slo aws-cloudwatch mimir loki tempo"
54+ for i in $INTEGRATIONS; do
55+ echo "Enabling $i"
56+ curl --fail --silent --show-error --location "$DUPLO_AUTOMATION_ENDPOINT/enable-integration" \
57+ --header 'Content-Type:application/json' \
58+ --data-raw "{\"integration_name\":\"$i\",\"context_name\":\"duplo-otel\"}" || { echo "❌ Failed to enable $i"; exit 1; }
59+ done
60+ echo "Enabling duplo"
61+ curl --fail --silent --show-error --location "$DUPLO_AUTOMATION_ENDPOINT/enable-integration" \
62+ --header 'Content-Type:application/json' \
63+ --data '{"integration_name":"duplo","context_name":"duplo-otel"}' || { echo "❌ Failed to enable duplo"; exit 1; }
64+ echo "✅ Duplo default provisioning completed successfully."
65+ env :
66+ - name : DUPLO_AUTOMATION_DEPLOYMENT_NAME
67+ value : " duplo-automation"
68+ - name : DUPLO_AUTOMATION_ENDPOINT
69+ value : " http://duplo-automation:5000"
70+ - name : GRAFANA_UI
71+ value : " http://grafana-ui:3000"
72+ - name : MIMIR_RULER
73+ value : " http://duplo-metrics-ruler:8080"
74+ - name : MIMIR_ADDRESS
75+ value : " http://duplo-metrics-nginx"
76+ - name : MIMIR_ALERTMANAGER
77+ value : " http://duplo-metrics-alertmanager:8080"
78+ - name : DUPLO_PORTAL_NAME
79+ value : " {{ .Values.global.customerName }}-{{ .Values.global.environment }}"
80+ - name : MIMIR_TENANT_ID
81+ value : " anonymous"
82+ - name : REGION
83+ value : {{ .Values.global.awsRegion | quote }}
84+ serviceAccountName : {{ .Values.global.tenantName }}-edit-user
85+ restartPolicy : Never
86+ {{- end }}
0 commit comments