Skip to content

Commit ddaa3f8

Browse files
committed
[preview] run the telemetry job right after gitpod is ready
This PR updates the `entry-point.sh` to run a parallel step that waits for the gitpod pods to be ready, and manually executes the cronjob once its necessary. This is necessary as our telemetry `cronjobs` are only ran daily in the midnight, and we can't expect this schedule to work for local previews as they are short lived. example data that we get: ``` client.Track(&analytics.Track{ UserId: "334c379a-afee-4882-ba44-fbd7dfc0a8b0", Event: "Installation telemetry", Properties: map[string]interface{}{ "customerID": "", "platform": "local-preview", "totalInstances": 0, "totalUsers": 0, "totalWorkspaces": 0, "version": "tar-preview-tel-init.4", }, }) ``` Signed-off-by: Tarun Pothulapati <[email protected]>
1 parent cf6a34a commit ddaa3f8

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

install/preview/entrypoint.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44

55
set -e
66

7-
if [ "$1" != "logging" ]; then
8-
$0 logging 2>&1 | /prettylog
9-
exit
10-
fi
11-
127
# check for minimum requirements
138
REQUIRED_MEM_KB=$((6 * 1024 * 1024))
149
total_mem_kb=$(awk '/MemTotal:/ {print $2}' /proc/meminfo)
@@ -136,6 +131,18 @@ yq eval-all -i 'del(.spec.template.spec.initContainers[0])' /var/lib/rancher/k3s
136131
for f in /var/lib/rancher/k3s/server/manifests/gitpod/*.yaml; do (cat "$f"; echo) >> /var/lib/rancher/k3s/server/manifests/gitpod.yaml; done
137132
rm -rf /var/lib/rancher/k3s/server/manifests/gitpod
138133

134+
# waits for gitpod pods to be ready, and manually runs the `gitpod-telemetry` cronjob
135+
run_telemetry(){
136+
# wait for the k3s cluster to be ready and Gitpod workloads are added
137+
sleep 100
138+
# indefinitely wait for Gitpod pods to be ready
139+
kubectl wait --timeout=7m --for=condition=ready pod -l app=gitpod,component!=migrations
140+
# manually tun the cronjob
141+
kubectl create job gitpod-telemetry-init --from=cronjob/gitpod-telemetry
142+
}
143+
144+
run_telemetry 2>&1 &
145+
139146
/bin/k3s server --disable traefik \
140147
--node-label gitpod.io/workload_meta=true \
141148
--node-label gitpod.io/workload_ide=true \

0 commit comments

Comments
 (0)