diff --git a/cli-tests/helpers/cliHelper.ts b/cli-tests/helpers/cliHelper.ts index 28f29bb4..6dfe35f1 100644 --- a/cli-tests/helpers/cliHelper.ts +++ b/cli-tests/helpers/cliHelper.ts @@ -64,13 +64,6 @@ export class CliHelper { }); } - async everestExecSkipWizardWithEnv(command, env: string) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-return - return test.step(`Run "${command}" command with env variables`, async () => { - return this.execute(`${env} ${this.pathToBinary} ${command} --skip-wizard`); - }); - } - /** * Silent Shell(sh) exec() wrapper to return handy {@link Output} object. * Provides no logs to skip huge outputs. diff --git a/cli-tests/tests/flow/all-operators.spec.ts b/cli-tests/tests/flow/all-operators.spec.ts index 4e5a5a15..d7a24475 100644 --- a/cli-tests/tests/flow/all-operators.spec.ts +++ b/cli-tests/tests/flow/all-operators.spec.ts @@ -71,27 +71,5 @@ test.describe('Everest CLI install operators', async () => { ]); }); await verifyClusterResources(); - await test.step('disable telemetry', async () => { - // check that the telemetry IS NOT disabled by default - let out = await cli.exec('kubectl get deployments/percona-xtradb-cluster-operator --namespace=percona-everest -o yaml'); - - await out.outContains( - 'name: DISABLE_TELEMETRY\n value: "false"', - ); - - out = await cli.everestExecSkipWizardWithEnv('install operators --backup.enable=0 --monitoring.enable=0 --name=aaa', 'DISABLE_TELEMETRY=true'); - await out.assertSuccess(); - await out.outErrContainsNormalizedMany([ - 'percona-xtradb-cluster-operator operator has been installed', - 'percona-server-mongodb-operator operator has been installed', - 'percona-postgresql-operator operator has been installed', - 'everest-operator operator has been installed', - ]); - // check that the telemetry IS disabled - out = await cli.exec('kubectl get deployments/percona-xtradb-cluster-operator --namespace=percona-everest -o yaml'); - await out.outContains( - 'name: DISABLE_TELEMETRY\n value: "true"', - ); - }); }); }); diff --git a/pkg/kubernetes/client/client.go b/pkg/kubernetes/client/client.go index 6a2c73ff..04ef19e6 100644 --- a/pkg/kubernetes/client/client.go +++ b/pkg/kubernetes/client/client.go @@ -84,8 +84,6 @@ const ( defaultAPIURIPath = "/api" defaultAPIsURIPath = "/apis" - - disableTelemetryEnvVar = "DISABLE_TELEMETRY" ) // Each level has 2 spaces for PrefixWriter. @@ -1070,11 +1068,6 @@ func (c *Client) CreateSubscriptionForCatalog(ctx context.Context, namespace, na return nil, errors.Join(err, errors.New("cannot create an operator client instance")) } - disableTelemetry, ok := os.LookupEnv(disableTelemetryEnvVar) - if !ok || disableTelemetry != "true" { - disableTelemetry = "false" - } - subscription := &v1alpha1.Subscription{ TypeMeta: metav1.TypeMeta{ Kind: v1alpha1.SubscriptionKind, @@ -1091,33 +1084,16 @@ func (c *Client) CreateSubscriptionForCatalog(ctx context.Context, namespace, na Channel: channel, StartingCSV: startingCSV, InstallPlanApproval: approval, - Config: &v1alpha1.SubscriptionConfig{ - Env: []corev1.EnvVar{ - { - Name: disableTelemetryEnvVar, - Value: disableTelemetry, - }, - }, - }, }, } + sub, err := operatorClient. OperatorsV1alpha1(). Subscriptions(namespace). Create(ctx, subscription, metav1.CreateOptions{}) if err != nil { if apierrors.IsAlreadyExists(err) { - bytes, err := json.Marshal(subscription) - if err != nil { - return nil, err - } - - sub, err = operatorClient. - OperatorsV1alpha1(). - Subscriptions(namespace). - Patch(ctx, name, types.MergePatchType, bytes, metav1.PatchOptions{}) - - return sub, err + return sub, nil } return sub, err }