# 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 %}

## Enabling TLS for MQTT data plane

To enable Transport Layer Security encryption for MQTT you set the parameter `dataPlane.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
    dataPlane:
      tls: true
```

{% endcode %}

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

## 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 Plane Host

To override the hostname which the agent will connect to using MQTT to move data, you set the parameter `dataPlane.host` 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
    dataPlane:
      host: broker
```

{% endcode %}

### Override MQTT Data Plane Port

To override the TCP port which the agent will connect to using MQTT to move data, you set the parameter `dataPlane.port` 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
    dataPlane:
      port: 10883
```

{% endcode %}

## Overriding the Control Streaming Server Host (Advanced)

To change the hostname that an agent uses when connecting to the Control Streaming Server, configure the parameter `streamServer.host` within the agent’s entry in the `protocolMapperAgents` context of your `values.yaml` file:

{% code lineNumbers="true" %}

```yaml
protocolMapperAgentDefaults:
  streamServer:
    host: nats
```

{% endcode %}

Ensure your agents can establish a secure connection. For this, do one of the following:

* Mount the Connectware combined CA certificate (`cybus_combined_ca.crt`) into the agent (see [Configuring CA certificate chain for Agents with the connectware-agent Helm Chart](https://docs.cybus.io/2-1-0/documentation/agents/agents-in-kubernetes/configuring-agents-with-the-connectware-agent-helm-chart/configuring-ca-certificate-for-agents-with-the-connectware-agent-helm-chart)).
* Set the environment variable `CYBUS_TRUST_ALL_CERTS` to `true` (see [Configuring Environment Variables for the connectware-agent Helm Chart](https://docs.cybus.io/2-1-0/documentation/agents/agents-in-kubernetes/configuring-agents-with-the-connectware-agent-helm-chart/configuring-environment-variables-for-the-connectware-agent-helm-chart)).

### 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 `streamServer.port` 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
    streamServer:
      port: 10884
```

{% endcode %}
