# Configuring Target Connectware for the connectware-agent Helm Chart

## Configuring the Target Connectware Hostname

By default agents will target a Connectware installation in the same Kubernetes namespace. If your Connectware installation is in a different namespace or outside of this Kubernetes cluster, you need to specify the hostname under which Connectware is reachable for this agent.

In the default configuration the following network ports on Connectware must be reachable for the agent:

* TCP/443
* TCP/1883

Specify the hostname of Connectware that the agent connects to by setting the Helm value `connectwareHost` inside the agents entry in `protocolMapperAgents` context of your values.yaml file. For Connectware deployments in a different Kubernetes namespace this is `connectware.<namespace>`.

**Example**

{% code lineNumbers="true" %}

```yaml
licenseKey: <your-connectware-license-key>
protocolMapperAgents:
    - name: bender-robots
      connectwareHost: connectware.cybus # adjust to actual hostname of Connectware
```

{% endcode %}

## Configuring Agents for Connectware with Separate control-plane-broker

To connect to a Connectware that uses the separate control-plane-broker, you need to set the Helm value `controlPlaneBrokerEnabled` to `true` inside the agents entry in \`protocolMapperAgents' context of your values.yaml file.

**Example**

{% code lineNumbers="true" %}

```yaml
licenseKey: <your-connectware-license-key>
protocolMapperAgents:
    - name: bender-robots
      connectwareHost: connectware.cybus # adjust to actual hostname of Connectware
      controlPlaneBrokerEnabled: true
```

{% endcode %}

{% hint style="warning" %}
This adds TCP/1884 to required network ports.
{% endhint %}

## Enabling TLS for MQTT

To enable Transport Layer Security encryption for MQTT you set the parameter `mqtt.tls` inside the agents entry in `protocolMapperAgents` context of your values.yaml file to `true`.

**Example**

{% code lineNumbers="true" %}

```yaml
licenseKey: <your-connectware-license-key>
protocolMapperAgents:
    - name: bender-robots
      connectwareHost: connectware.cybus # adjust to actual hostname of Connectware
      mqtt:
          tls: true
```

{% endcode %}

{% hint style="warning" %}
This adds TCP/8883 and TCP/8884 to required network ports.
{% endhint %}

## Overriding Control Plane URI (Advanced)

### Control Plane URI Configuration (Default Behavior)

The Agent Helm chart automatically manages `CYBUS_CONTROLPLANE_URI` using the existing Helm value `protocolMapperAgentDefaults.connectwareHost`. This default configuration should work for most installations.

### Control Plane URI Configuration (Custom Configuration)

If you need to override the default configuration:

* Set the Helm value `protocolMapperAgentDefaults.controlPlane.host` to the hostname of the Connectware Control Plane, if it differs from `protocolMapperAgentDefaults.connectwareHost`.

```yaml
protocolMapperAgentDefaults:
    controlPlane:
        host: connectware.mycompany.tld
```

* If you want to adjust the scheme or port for the `CYBUS_CONTROLPLANE_URI`, you can specify a full URI in `protocolMapperAgentDefaults.controlPlane.host` instead of `protocolMapperAgentDefaults.connectwareHost`.

**Example**

{% code lineNumbers="true" %}

```yaml
protocolMapperAgentDefaults:
    controlPlane:
        host: nats://connectware.mycompany.tld:10422
```

{% endcode %}

## Overriding MQTT Target Parameters (Advanced)

By default, the `connectware-agent` Helm chart will control the parameters in this section, and adjust them according to your chosen configuration, however, optionally you can override these values in advanced setups.

### Override MQTT Data Host

To override the hostname which the agent will connect to using MQTT to move data, you set the parameter `mqtt.dataHost` inside the agents entry in `protocolMapperAgents` context of your values.yaml file.

**Example**

{% code lineNumbers="true" %}

```yaml
licenseKey: <your-connectware-license-key>
protocolMapperAgents:
    - name: bender-robots
      connectwareHost: connectware.cybus # adjust to actual hostname of Connectware
      mqtt:
          dataHost: broker.cybus
```

{% endcode %}

### Override MQTT Control Host

To override the hostname which the agent will connect to using MQTT to exchange control-plane information, you set the parameter `mqtt.controlHost` inside the agents entry in `protocolMapperAgents` context of your values.yaml file.

**Example**

{% code lineNumbers="true" %}

```yaml
licenseKey: <your-connectware-license-key>
protocolMapperAgents:
    - name: bender-robots
      connectwareHost: connectware.cybus # adjust to actual hostname of Connectware
      mqtt:
          controlHost: control-plane-broker.cybus
```

{% endcode %}

### Override MQTT Data Port

To override the TCP port which the agent will connect to using MQTT to move data, you set the parameter `mqtt.dataPort` inside the agents entry in `protocolMapperAgents` context of your values.yaml file.

**Example**

{% code lineNumbers="true" %}

```yaml
licenseKey: <your-connectware-license-key>
protocolMapperAgents:
    - name: bender-robots
      connectwareHost: connectware.cybus # adjust to actual hostname of Connectware
      mqtt:
          dataPort: 10883
```

{% endcode %}

### Override MQTT control-plane Port

To override the TCP port which the agent will connect to using MQTT to exchange control-plane information, you set the parameter `mqtt.controlPort` inside the agents entry in `protocolMapperAgents` context of your values.yaml file.

**Example**

{% code lineNumbers="true" %}

```yaml
licenseKey: <your-connectware-license-key>
protocolMapperAgents:
    - name: bender-robots
      connectwareHost: connectware.cybus # adjust to actual hostname of Connectware
      mqtt:
          controlPort: 10884
```

{% endcode %}
