> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/self-managed-enterprise-edition/use-self-managed-enterprise-edition/smp-installationupgrade/operator-installation/install/discovery.md).

# Discover an existing Harness SMP installation

If you have an existing Harness SMP installation and want it to be discovered by the Harness SMP Operator, use the script `generate-harness-values.sh` to extract your current configuration.

This topic covers what the script does, how to run it, the two files it generates, how to install with those files using either helm or clustermgr, and how to verify the result in the Installer UI.

***

### What the Script Does <a href="#what-the-script-does" id="what-the-script-does"></a>

The `generate-harness-values.sh` script connects to your running cluster, reads the existing Harness Helm release values and Kubernetes secrets, and generates the files needed for Operator to discover your existing installation.

***

### Usage <a href="#usage" id="usage"></a>

Download the script: [generate-harness-values.sh](https://github.com/iKettles/harness-gitbook/tree/main/self-managed-enterprise-edition/use-self-managed-enterprise-edition/smp-installationupgrade/operator-installation/install/static/generate-harness-values.sh), and execute the following commands in your terminal.

```bash
# outputs two files: tfi-values.yaml and harness-values.yaml <a href="#outputs-two-files-tfi-valuesyaml-and-harness-valuesyaml" id="outputs-two-files-tfi-valuesyaml-and-harness-valuesyaml"></a>

# option 1: after downloading the script from this page <a href="#option-1-after-downloading-the-script-from-this-page" id="option-1-after-downloading-the-script-from-this-page"></a>
chmod +x generate-harness-values.sh
./generate-harness-values.sh

# option 2: if running from extracted clustermgr package <a href="#option-2-if-running-from-extracted-clustermgr-package" id="option-2-if-running-from-extracted-clustermgr-package"></a>
./values-migrator/generate-harness-values.sh
```

| Flag              | Default   | Description                                      |
| ----------------- | --------- | ------------------------------------------------ |
| `-n, --namespace` | `harness` | Kubernetes namespace of existing Harness install |
| `-r, --release`   | `harness` | Helm release name                                |

***

### Generated Files <a href="#generated-files" id="generated-files"></a>

The script generates two files:

1. **`tfi-values.yaml`** - Contains `cluster.tfi.*` values extracted from the existing install:

   ```yaml
   cluster:
     tfi:
       ci: false
       cd: true
       ccm: false
       sto: false
       srm: false
       ff: false
       chaos: false
       scs: false
       dbops: false
       code: false
       iacm: false
       idp: false
       harnessLicense: "..."
       postgresqlPassword: "..."
       mongodbPassword: "..."
       minioPassword: "..."
       additionalFeatureFlags: |
         FEATURE_FLAG_1
         FEATURE_FLAG_2
   ```
2. **`harness-values.yaml`** - Contains Helm values (`global:` and `harness:` sections, excluding module flags and license which are in `tfi-values.yaml`).

***

### Install with Discovered Values <a href="#install-with-discovered-values" id="install-with-discovered-values"></a>

After the script generates the two files, pass them to your install command. In this step, the install command supplies your existing configuration to the operator.

{% tabs %}
{% tab title="helm" %}

```bash
helm install platform-installer ./platform-installer-<VERSION>.tgz -n harness --create-namespace \
  -f tfi-values.yaml \
  --set-file cluster.helmValues.harness=harness-values.yaml \
  -f override.yaml \
  -f override-<ingress>.yaml
```

* Use the generated `tfi-values.yaml` and `harness-values.yaml` with `helm install`.
* Reference the appropriate override and ingress files from the [Configure and Install](/self-managed-enterprise-edition/use-self-managed-enterprise-edition/smp-installationupgrade/operator-installation/install/install-with-smp-operator.md#step-2-configure-and-install) section.
  {% endtab %}

{% tab title="clustermgr" %}
After running the script, use the generated files with `clustermgr install-pi`:

```bash
./clustermgr install-pi \
  --dns <your-dns> \
  --namespace harness \
  --email <admin-email> \
  --password '<password>' \
  --version <version> \
  --multi-node \
  --pi-set cluster.triggerInstall=false \
  --pi-set cluster.tfi.storageClass=<storage-class> \
  --pi-set cluster.profile=<profile-type> \
  --pi-values tfi-values.yaml \
  --pi-set-file cluster.helmValues.harness=harness-values.yaml
```

For air-gapped environments, add the registry flags:

```bash
./clustermgr install-pi \
  --dns <your-dns> \
  --namespace harness \
  --registry-host registry.example.com \
  --registry-prefix your-prefix \
  --registry-user <user> \
  --registry-password '<password>' \
  --email <admin-email> \
  --password '<password>' \
  --version <version> \
  --multi-node \
  --pi-set cluster.triggerInstall=false \
  --pi-set cluster.tfi.storageClass=<storage-class> \
  --pi-set cluster.profile=<profile-type> \
  --pi-values tfi-values.yaml \
  --pi-set-file cluster.helmValues.harness=harness-values.yaml
```

{% endtab %}
{% endtabs %}

***

### Post-Discovery Verification <a href="#post-discovery-verification" id="post-discovery-verification"></a>

1. Access the Installer UI at `https://<YOUR_DNS>/pi`
2. Navigate to **Global Variables** and verify that modules, license, and database passwords are populated correctly
3. Navigate to **Helm Releases → harness → user/values.yaml** and verify the values from `harness-values.yaml` are populated
