Skip to content

Commit

Permalink
feat(lmeval): Disable telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
ruivieira committed Dec 22, 2024
1 parent 8db3fab commit 62f19fc
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 0 deletions.
13 changes: 13 additions & 0 deletions controllers/lmes/lmevaljob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,19 @@ func CreatePod(svcOpts *serviceOptions, job *lmesv1alpha1.LMEvalJob, log logr.Lo

var envVars = removeProtectedEnvVars(job.Spec.Pod.GetContainer().GetEnv())

disableTelemetryEnvVars := []corev1.EnvVar{
{
Name: "HF_HUB_DISABLE_TELEMETRY",
Value: "1",
},
{
Name: "DO_NOT_TRACK",
Value: "1",
},
}

envVars = append(envVars, disableTelemetryEnvVars...)

var volumeMounts = []corev1.VolumeMount{
{
Name: "shared",
Expand Down
115 changes: 115 additions & 0 deletions controllers/lmes/lmevaljob_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ func Test_SimplePod(t *testing.T) {
},
},
Env: []corev1.EnvVar{
{
Name: "HF_HUB_DISABLE_TELEMETRY",
Value: "1",
},
{
Name: "DO_NOT_TRACK",
Value: "1",
},
{
Name: "TRUST_REMOTE_CODE",
Value: "0",
Expand Down Expand Up @@ -325,6 +333,14 @@ func Test_WithCustomPod(t *testing.T) {
},
},
Env: []corev1.EnvVar{
{
Name: "HF_HUB_DISABLE_TELEMETRY",
Value: "1",
},
{
Name: "DO_NOT_TRACK",
Value: "1",
},
{
Name: "TRUST_REMOTE_CODE",
Value: "0",
Expand Down Expand Up @@ -515,6 +531,14 @@ func Test_EnvSecretsPod(t *testing.T) {
},
},
},
{
Name: "HF_HUB_DISABLE_TELEMETRY",
Value: "1",
},
{
Name: "DO_NOT_TRACK",
Value: "1",
},
{
Name: "TRUST_REMOTE_CODE",
Value: "0",
Expand Down Expand Up @@ -669,6 +693,14 @@ func Test_FileSecretsPod(t *testing.T) {
Args: generateArgs(svcOpts, job, log),
SecurityContext: defaultSecurityContext,
Env: []corev1.EnvVar{
{
Name: "HF_HUB_DISABLE_TELEMETRY",
Value: "1",
},
{
Name: "DO_NOT_TRACK",
Value: "1",
},
{
Name: "TRUST_REMOTE_CODE",
Value: "0",
Expand Down Expand Up @@ -1122,6 +1154,14 @@ func Test_ManagedPVC(t *testing.T) {
Args: generateArgs(svcOpts, job, log),
SecurityContext: defaultSecurityContext,
Env: []corev1.EnvVar{
{
Name: "HF_HUB_DISABLE_TELEMETRY",
Value: "1",
},
{
Name: "DO_NOT_TRACK",
Value: "1",
},
{
Name: "TRUST_REMOTE_CODE",
Value: "0",
Expand Down Expand Up @@ -1265,6 +1305,14 @@ func Test_ExistingPVC(t *testing.T) {
Args: generateArgs(svcOpts, job, log),
SecurityContext: defaultSecurityContext,
Env: []corev1.EnvVar{
{
Name: "HF_HUB_DISABLE_TELEMETRY",
Value: "1",
},
{
Name: "DO_NOT_TRACK",
Value: "1",
},
{
Name: "TRUST_REMOTE_CODE",
Value: "0",
Expand Down Expand Up @@ -1425,6 +1473,14 @@ func Test_PVCPreference(t *testing.T) {
},
},
Env: []corev1.EnvVar{
{
Name: "HF_HUB_DISABLE_TELEMETRY",
Value: "1",
},
{
Name: "DO_NOT_TRACK",
Value: "1",
},
{
Name: "TRUST_REMOTE_CODE",
Value: "0",
Expand Down Expand Up @@ -1616,6 +1672,14 @@ func Test_OfflineMode(t *testing.T) {
},
},
Env: []corev1.EnvVar{
{
Name: "HF_HUB_DISABLE_TELEMETRY",
Value: "1",
},
{
Name: "DO_NOT_TRACK",
Value: "1",
},
{
Name: "TRUST_REMOTE_CODE",
Value: "0",
Expand Down Expand Up @@ -1803,6 +1867,15 @@ func Test_ProtectedVars(t *testing.T) {
Name: "NOT_PROTECTED",
Value: "True",
},
{
Name: "HF_HUB_DISABLE_TELEMETRY",
Value: "1",
},
{
Name: "DO_NOT_TRACK",
Value: "1",
},

{
Name: "TRUST_REMOTE_CODE",
Value: "0",
Expand Down Expand Up @@ -1974,6 +2047,14 @@ func Test_OnlineModeDisabled(t *testing.T) {
},
},
Env: []corev1.EnvVar{
{
Name: "HF_HUB_DISABLE_TELEMETRY",
Value: "1",
},
{
Name: "DO_NOT_TRACK",
Value: "1",
},
{
Name: "TRUST_REMOTE_CODE",
Value: "0",
Expand Down Expand Up @@ -2141,6 +2222,14 @@ func Test_OnlineMode(t *testing.T) {
},
},
Env: []corev1.EnvVar{
{
Name: "HF_HUB_DISABLE_TELEMETRY",
Value: "1",
},
{
Name: "DO_NOT_TRACK",
Value: "1",
},
{
Name: "TRUST_REMOTE_CODE",
Value: "0",
Expand Down Expand Up @@ -2294,6 +2383,16 @@ func Test_AllowCodeOnlineMode(t *testing.T) {
},
},
},
Env: []corev1.EnvVar{
{
Name: "HF_HUB_DISABLE_TELEMETRY",
Value: "1",
},
{
Name: "DO_NOT_TRACK",
Value: "1",
},
},
VolumeMounts: []corev1.VolumeMount{
{
Name: "shared",
Expand Down Expand Up @@ -2437,6 +2536,14 @@ func Test_AllowCodeOfflineMode(t *testing.T) {
},
},
Env: []corev1.EnvVar{
{
Name: "HF_HUB_DISABLE_TELEMETRY",
Value: "1",
},
{
Name: "DO_NOT_TRACK",
Value: "1",
},
{
Name: "HF_DATASETS_OFFLINE",
Value: "1",
Expand Down Expand Up @@ -2597,6 +2704,14 @@ func Test_OfflineModeWithOutput(t *testing.T) {
},
},
Env: []corev1.EnvVar{
{
Name: "HF_HUB_DISABLE_TELEMETRY",
Value: "1",
},
{
Name: "DO_NOT_TRACK",
Value: "1",
},
{
Name: "TRUST_REMOTE_CODE",
Value: "0",
Expand Down

0 comments on commit 62f19fc

Please sign in to comment.