Skip to content

Commit defcd86

Browse files
committed
Update documentation with latest updates
1 parent 732b565 commit defcd86

3 files changed

Lines changed: 55 additions & 4 deletions

File tree

docs/reference/auth-oauth2.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ auth:
7070
url: https://your-oidc-server.example.com/
7171
deviceFlow: true|false
7272
authorizationFlow: true|false
73+
extraScopes:
74+
- scope1
75+
- scope2
76+
enforceScopes: true
7377
<other oidc options>
7478
```
7579

docs/reference/docker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Apart from the `container`, `host`, `network`, `platform` and `containerName` op
192192
| `agentPath` | `string` | Contains the full path to the [ContainerSSH guest agent](https://github.com/containerssh/agent) inside the shell container. The agent must be installed in the guest image. |
193193
| `disableAgent` | `bool` | Disable the ContainerSSH guest agent. This will disable several functions and is *not recommended*. |
194194
| `subsystems` | `map[string]string` | Specifies a map of subsystem names to executables. It is recommended to set at least the `sftp` subsystem as many users will want to use it. |
195-
| `imagePullPolicy` | `Never,IfNotPresent,Always` | Specifies when to pull the container image. Defaults to `IfNotPresent`, which pulls the image when it is not locally present *or* if the image has no tag/has the `latest` tag. It is recommended that you provide a custom, versioned image name to prevent pulling the image at every connection. |
195+
| `imagePullPolicy` | `Never,IfNotPresent,Always` | Specifies when to pull the container image. Defaults to `IfNotPresent`, which pulls the image only when it is not locally present. It is recommended that you provide a custom, versioned image name to prevent pulling the image at every connection. |
196196

197197
## Configuring timeouts
198198

docs/reference/kubernetes.md

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,10 @@ Apart from the `metadata` and `spec` options ContainerSSH has the following opti
199199
| Name | Type | Description |
200200
|------|------|-------------|
201201
| `consoleContainerNumber` | `uint` | Specifies the number of the container to attach to. Defaults to the first container. |
202-
| `mode` | `string` | Specify `connection` to launch one pod per SSH connection or `session` to run one pod per SSH session (multiple pods per connection). In connection mode the container is started with the `idleCommand` as the first program and every session is launched similar to how `kubectl exec` runs programs. In session mode the command is launched directly. |
203-
| `idleCommand` | `[]string` | Specifies the command to run as the first process in the container in `connection` mode. Parameters must be provided as separate items in the array. Has no effect in `session` mode. |
204-
| `shellCommand` | `[]string` | Specifies the command to run as a shell in `connection` mode. Parameters must be provided as separate items in the array. Has no effect in `session` mode. |
202+
| `mode` | `string` | Specify `connection` to launch one pod per SSH connection, `session` to run one pod per SSH session (multiple pods per connection), or `persistent` to exec into an already running pod. In connection mode the container is started with the `idleCommand` as the first program and every session is launched similar to how `kubectl exec` runs programs. In session mode the command is launched directly. In persistent mode the pod must already exist (or be auto-created with `createMissingPods`). |
203+
| `createMissingPods` | `bool` | When set to `true` in `persistent` mode, ContainerSSH will automatically create a pod if no existing pod is found. Defaults to `false`. Only valid in `persistent` mode. |
204+
| `idleCommand` | `[]string` | Specifies the command to run as the first process in the container in `connection` mode (also required in `persistent` mode when `createMissingPods` is enabled). Parameters must be provided as separate items in the array. Has no effect in `session` mode. |
205+
| `shellCommand` | `[]string` | Specifies the command to run as a shell in `connection` mode (also required in `persistent` mode when `createMissingPods` is enabled). Parameters must be provided as separate items in the array. Has no effect in `session` mode. |
205206
| `agentPath` | `string` | Contains the full path to the [ContainerSSH guest agent](https://github.com/containerssh/agent) inside the shell container. The agent must be installed in the guest image. |
206207
| `disableAgent` | `bool` | Disable the ContainerSSH guest agent. This will disable several functions and is *not recommended*. |
207208
| `subsystems` | `map[string]string` | Specifies a map of subsystem names to executables. It is recommended to set at least the `sftp` subsystem as many users will want to use it. |
@@ -210,6 +211,52 @@ Apart from the `metadata` and `spec` options ContainerSSH has the following opti
210211

211212
- In `connection` mode the `idleCommand` and `shellCommand` options are required.
212213
- In `session` mode the restart policy must be empty or `Never`.
214+
- In `persistent` mode with `createMissingPods` enabled, the `idleCommand`, `shellCommand`, and at least one container in the pod spec are required.
215+
216+
### Persistent mode
217+
218+
The `persistent` execution mode allows ContainerSSH to exec into an already running pod rather than creating a new one for each connection or session. This is useful when you have long-lived pods that should be reused across SSH sessions, for example pre-provisioned development environments.
219+
220+
```yaml
221+
kubernetes:
222+
pod:
223+
mode: persistent
224+
metadata:
225+
name: my-existing-pod
226+
namespace: default
227+
spec:
228+
containers:
229+
- name: shell
230+
image: containerssh/containerssh-guest-image
231+
```
232+
233+
In persistent mode:
234+
235+
- ContainerSSH looks up the pod by `metadata.name` and `metadata.namespace` and creates an exec session inside it, similar to `kubectl exec`.
236+
- The pod is **not removed** when the SSH session ends — it persists for future connections.
237+
- Files from the authentication metadata (e.g. Kerberos credential caches) are automatically written into the container on connection.
238+
239+
If the target pod may not always exist, you can enable `createMissingPods` to have ContainerSSH create it automatically:
240+
241+
```yaml
242+
kubernetes:
243+
pod:
244+
mode: persistent
245+
createMissingPods: true
246+
idleCommand:
247+
- /bin/sh
248+
shellCommand:
249+
- /bin/bash
250+
metadata:
251+
name: my-pod
252+
namespace: default
253+
spec:
254+
containers:
255+
- name: shell
256+
image: containerssh/containerssh-guest-image
257+
```
258+
259+
When `createMissingPods` is enabled, the `idleCommand`, `shellCommand`, and at least one container in the pod spec must be configured.
213260

214261
## Configuring timeouts
215262

0 commit comments

Comments
 (0)