# Configuring Security Context for the connectware-agent Helm Chart

## Configuring Security Context

Connectware agents installed using the `connectware-agent` Helm chart allow changing the security context of executed containers by defining the `securityContext` and `podSecurityContext` sections inside the agents entry in the `protocolMapperAgents` context of your values.yaml file.

It is important to note, that the security context required by the agent is dependent on installed services, so any modifications made should be verified to work with your use case.

**Example**

{% code lineNumbers="true" %}

```yaml
protocolMapperAgents:
    - name: bender-robots
      connectwareHost: connectware.cybus # adjust to actual hostname of Connectware
      podSecurityContext:
          runAsUser: 1000
          runAsGroup: 1000
```

{% endcode %}

The difference between `securityContext` and `podSecurityContext` is, that `securityContext` puts restrictions on the container, while `podSecurityContext` puts restrictions on the pod. While this may seem pointless with the agents single container inside its pod, it does play a role when, for example, attaching an ephemeral container to the pod.

## Unsetting Security Context

If you set a securityContext or podSecurityContext in the protocolMapperAgentDefaults section of your values.yaml file, you can unset them for individual agents by setting the value of `securityContext` or `podSecurityContext` to `{}` inside the agents entry in the `protocolMapperAgents` context of your values.yaml.

**Example**

{% code lineNumbers="true" %}

```yaml
protocolMapperAgentDefaults:
    connectwareHost: connectware.cybus # adjust to actual hostname of Connectware
    podSecurityContext:
        runAsUser: 1000
        runAsGroup: 1000
protocolMapperAgents:
    - name: bender-robots # this agent will run as user & group 1000
    - name: welder-robots # this agent will not run as user & group 1000
      podSecurityContext: {}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cybus.io/1-10-2/documentation/agents/agents-in-kubernetes/configuring-agents-with-the-connectware-agent-helm-chart/configuring-security-context-for-the-connectware-agent-helm-chart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
