Skip to content

Commit 79f7312

Browse files
Pothulapatiroboquat
authored andcommitted
[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 d50859a commit 79f7312

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

install/preview/entrypoint.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,18 @@ yq eval-all -i 'del(.spec.template.spec.initContainers[0])' /var/lib/rancher/k3s
136136
for f in /var/lib/rancher/k3s/server/manifests/gitpod/*.yaml; do (cat "$f"; echo) >> /var/lib/rancher/k3s/server/manifests/gitpod.yaml; done
137137
rm -rf /var/lib/rancher/k3s/server/manifests/gitpod
138138

139+
# waits for gitpod pods to be ready, and manually runs the `gitpod-telemetry` cronjob
140+
run_telemetry(){
141+
# wait for the k3s cluster to be ready and Gitpod workloads are added
142+
sleep 100
143+
# indefinitely wait for Gitpod pods to be ready
144+
kubectl wait --timeout=-1s --for=condition=ready pod -l app=gitpod,component!=migrations
145+
# manually tun the cronjob
146+
kubectl create job gitpod-telemetry-init --from=cronjob/gitpod-telemetry
147+
}
148+
149+
run_telemetry 2>&1 &
150+
139151
/bin/k3s server --disable traefik \
140152
--node-label gitpod.io/workload_meta=true \
141153
--node-label gitpod.io/workload_ide=true \

0 commit comments

Comments
 (0)