Skip to content

Commit f308f63

Browse files
committed
use a config option instead
Signed-off-by: Tarun Pothulapati <[email protected]>
1 parent 0182d4e commit f308f63

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

install/installer/pkg/components/gitpod/cronjob.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ func cronjob(ctx *common.RenderContext) ([]runtime.Object, error) {
2121
return []runtime.Object{}, nil
2222
}
2323

24+
platformTelemetryData := "unknown"
25+
if ctx.Experimental.TelemetryConfig != nil {
26+
if ctx.Experimental.TelemetryConfig.Data.Platform != "" {
27+
platformTelemetryData = ctx.Experimental.TelemetryConfig.Data.Platform
28+
}
29+
}
30+
2431
installationTelemetryComponent := fmt.Sprintf("%s-telemetry", Component)
2532

2633
objectMeta := metav1.ObjectMeta{
@@ -65,7 +72,7 @@ func cronjob(ctx *common.RenderContext) ([]runtime.Object, error) {
6572
},
6673
{
6774
Name: "GITPOD_INSTALLATION_PLATFORM",
68-
Value: "installer",
75+
Value: platformTelemetryData,
6976
},
7077
{
7178
Name: "SERVER_URL",

install/installer/pkg/config/v1/experimental/experimental.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ type Config struct {
2121
WebApp *WebAppConfig `json:"webapp,omitempty"`
2222
IDE *IDEConfig `json:"ide,omitempty"`
2323
Common *CommonConfig `json:"common,omitempty"`
24+
Telemetry *TelemetryConfig `json:"telemetry,omitempty"`
25+
}
26+
27+
type TelemetryConfig struct {
28+
Data struct {
29+
Platform string `json:"platform"`
30+
} `json:"data"`
2431
}
2532

2633
type CommonConfig struct {

install/kots/manifests/gitpod-installer-job.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ spec:
273273
fi
274274
fi
275275
276+
echo "Gitpod: Update platform telemetry value"
277+
yq eval-all --inplace '.experimental.telemetryConfig.data.platform = "{{repl Distribution }}"' "${CONFIG_FILE}"
278+
276279
echo "Gitpod: Patch Gitpod config"
277280
base64 -d "${CONFIG_PATCH_FILE}" > /tmp/patch.yaml
278281
config_patch=$(cat /tmp/patch.yaml)
@@ -303,11 +306,6 @@ spec:
303306
'del(select(.kind == "StatefulSet" and .metadata.name == "openvsx-proxy").status)' \
304307
"${GITPOD_OBJECTS}/templates/gitpod.yaml"
305308
306-
echo "Gitpod: Update GITPOD_INSTALLATION_PLATFORM telemetry value"
307-
yq eval-all --inplace \
308-
'(select(.kind == "CronJob" and .metadata.name == "gitpod-telemetry") | (.spec.jobTemplate.spec.template.spec.containers[0].env[] | select(.name=="GITPOD_INSTALLATION_PLATFORM")).value |= "repl{{ Distribution }}"' \
309-
"${GITPOD_OBJECTS}/templates/gitpod.yaml"
310-
311309
if [ '{{repl ConfigOptionEquals "reg_incluster" "1" }}' = "true" ];
312310
then
313311
echo "Gitpod: Add the local registry secret to the in-cluster registry secret"

install/preview/entrypoint.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,10 @@ yq e -i '.customCACert.kind = "secret"' config.yaml
100100
yq e -i '.observability.logLevel = "debug"' config.yaml
101101
yq e -i '.workspace.runtime.containerdSocket = "/run/k3s/containerd/containerd.sock"' config.yaml
102102
yq e -i '.workspace.runtime.containerdRuntimeDir = "/var/lib/rancher/k3s/agent/containerd/io.containerd.runtime.v2.task/k8s.io/"' config.yaml
103+
yq e -i '.experimental.telemetryConfig.data.platform = "local-preview"' config.yaml
103104

104105
echo "extracting images to download ahead..."
105-
/gitpod-installer render --config config.yaml | grep 'image:' | sed 's/ *//g' | sed 's/image://g' | sed 's/\"//g' | sed 's/^-//g' | sort | uniq > /gitpod-images.txt
106+
/gitpod-installer render --use-experimental-config --config config.yaml | grep 'image:' | sed 's/ *//g' | sed 's/image://g' | sed 's/\"//g' | sed 's/^-//g' | sort | uniq > /gitpod-images.txt
106107
echo "downloading images..."
107108
while read -r image "$(cat /gitpod-images.txt)"; do
108109
# shellcheck disable=SC2154
@@ -124,8 +125,6 @@ yq eval-all -i ". as \$item ireduce ({}; . *+ \$item)" /var/lib/rancher/k3s/serv
124125
# update Statefulset's to use k3s's `local-path` storage class
125126
for f in /var/lib/rancher/k3s/server/manifests/gitpod/*StatefulSet*.yaml; do yq e -i '.spec.volumeClaimTemplates[0].spec.storageClassName="local-path"' "$f"; done
126127

127-
# set the GITPOD_INSTALLATION_PLATFORM
128-
yq eval-all -i '(.spec.jobTemplate.spec.template.spec.containers[0].env[] | select(.name=="GITPOD_INSTALLATION_PLATFORM")).value |= "local-preview"' /var/lib/rancher/k3s/server/manifests/gitpod/*_CronJob_gitpod-telemetry.yaml
129128

130129
# removing init container from ws-daemon (systemd and Ubuntu)
131130
yq eval-all -i 'del(.spec.template.spec.initContainers[0])' /var/lib/rancher/k3s/server/manifests/gitpod/*_DaemonSet_ws-daemon.yaml

0 commit comments

Comments
 (0)