# CLI Reference

## apolo-extras

Auxiliary scripts and recipes for automating routine tasks.

**Usage:**

```bash
apolo-extras [OPTIONS] COMMAND [ARGS]...
```

**Options:**

| Name            | Description                                                          |
| --------------- | -------------------------------------------------------------------- |
| *-v, --verbose* | Give more output. Option is additive, and can be used up to 2 times. |
| *-q, --quiet*   | Give less output. Option is additive, and can be used up to 2 times. |
| *--version*     | Show the version and exit.                                           |
| *--help*        | Show this message and exit.                                          |

**Command Groups:**

| Usage                                         | Description                     |
| --------------------------------------------- | ------------------------------- |
| [*apolo-extras config*](#apolo-extras-config) | Configuration operations.       |
| [*apolo-extras data*](#apolo-extras-data)     | Data transfer operations.       |
| [*apolo-extras image*](#apolo-extras-image)   | Job container image operations. |
| [*apolo-extras k8s*](#apolo-extras-k8s)       | Cluster Kubernetes operations.  |

**Commands:**

| Usage                                                     | Description                                              |
| --------------------------------------------------------- | -------------------------------------------------------- |
| [*apolo-extras init-aliases*](#apolo-extras-init-aliases) | Create apolo CLI aliases for apolo-extras functionality. |

### apolo-extras config

Configuration operations.

**Usage:**

```bash
apolo-extras config [OPTIONS] COMMAND [ARGS]...
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

**Commands:**

| Usage                                                                               | Description                                            |
| ----------------------------------------------------------------------------------- | ------------------------------------------------------ |
| [*apolo-extras config build-registy-auth*](#apolo-extras-config-build-registy-auth) | Generate docker auth for accessing remote registry.    |
| [*apolo-extras config save-registry-auth*](#apolo-extras-config-save-registry-auth) | Save docker auth file for accessing platform registry. |

#### apolo-extras config build-registy-auth

Generate docker auth for accessing remote registry.

**Usage:**

```bash
apolo-extras config build-registy-auth [OPTIONS] REGISTRY_URI USERNAME
                                              PASSWORD
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

#### apolo-extras config save-registry-auth

Save docker auth file for accessing platform registry.

**Usage:**

```bash
apolo-extras config save-registry-auth [OPTIONS] PATH
```

**Options:**

| Name             | Description                                                                             |
| ---------------- | --------------------------------------------------------------------------------------- |
| *--cluster TEXT* | Cluster name for which the auth information should be saved. Current cluster by default |
| *--help*         | Show this message and exit.                                                             |

### apolo-extras data

Data transfer operations.

**Usage:**

```bash
apolo-extras data [OPTIONS] COMMAND [ARGS]...
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

**Commands:**

| Usage                                                       | Description                                            |
| ----------------------------------------------------------- | ------------------------------------------------------ |
| [*apolo-extras data cp*](#apolo-extras-data-cp)             | Copy data between external object storage and cluster. |
| [*apolo-extras data transfer*](#apolo-extras-data-transfer) | Copy data between storages on different clusters.      |

#### apolo-extras data cp

Copy data between external object storage and cluster. Supported external object storage systems: \['AWS', 'GCS', 'AZURE', 'HTTP', 'HTTPS']. Note: originally, Azure's blob storage scheme is 'http(s)', but we prepend 'azure+' to differenciate https vs azure

**Usage:**

```bash
apolo-extras data cp [OPTIONS] SOURCE DESTINATION
```

**Options:**

| Name                        | Description                                                                                                                                                                                                                                                                                                                                                |
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *-x, --extract*             | Perform extraction of SOURCE into the DESTINATION directory. The archive type is derived from the file name. Supported types: .tar.gz, .tgz, .tar.bz2, .bz2, .tbz, .tar, .gz, .zip.                                                                                                                                                                        |
| *-c, --compress*            | Perform compression of SOURCE into the DESTINATION file. The archive type is derived from the file name. Supported types: .tar.gz, .tgz, .tar.bz2, .bz2, .tbz, .tar, .gz, .zip.                                                                                                                                                                            |
| *-v, --volume MOUNT*        | Mounts directory from vault into container. Use multiple options to mount more than one volume.                                                                                                                                                                                                                                                            |
| *-e, --env VAR=VAL*         | Set environment variable in container. Use multiple options to define more than one variable.                                                                                                                                                                                                                                                              |
| *-t, --use-temp-dir*        | DEPRECATED - need for temp dir is automatically detected, this flag will be removed in a future release. Download and extract / compress data (if needed) inside the temporary directory. Afterwards move resulted file(s) into the DESTINATION. NOTE: use it if 'storage:' is involved and extraction or compression is performed to speedup the process. |
| *-s, --preset PRESET\_NAME* | Preset name used for copy.                                                                                                                                                                                                                                                                                                                                 |
| *-l, --life\_span SECONDS*  | Copy job life span in seconds.                                                                                                                                                                                                                                                                                                                             |
| *--help*                    | Show this message and exit.                                                                                                                                                                                                                                                                                                                                |

#### apolo-extras data transfer

Copy data between storages on different clusters.

Consider archiving dataset first for the sake of performance, if the dataset contains a lot (100k+) of small (< 100Kb each) files.

**Usage:**

```bash
apolo-extras data transfer [OPTIONS] SOURCE DESTINATION
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

### apolo-extras image

Job container image operations.

**Usage:**

```bash
apolo-extras image [OPTIONS] COMMAND [ARGS]...
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

**Commands:**

| Usage                                                               | Description                                                 |
| ------------------------------------------------------------------- | ----------------------------------------------------------- |
| [*apolo-extras image build*](#apolo-extras-image-build)             | Build Job container image remotely on cluster using Kaniko. |
| [*apolo-extras image local-build*](#apolo-extras-image-local-build) | Build Job container image locally (requires Docker daemon). |
| [*apolo-extras image transfer*](#apolo-extras-image-transfer)       | Copy images between clusters.                               |

#### apolo-extras image build

Build Job container image remotely on cluster using Kaniko.

**Usage:**

```bash
apolo-extras image build [OPTIONS] CONTEXT_PATH IMAGE_URI
```

**Options:**

| Name                          | Description                                                                                                                                                                                                                                                                                                                       |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *-f, --file TEXT*             | Relative (w\.r.t. context) path to the dockerfile. The dockerfile should be within the context directory. \[default: Dockerfile]                                                                                                                                                                                                  |
| *--build-arg VAR=VAL*         | Build-time variables passed in ARG values, similarly to Docker. Could be used multiple times for multiple arguments.                                                                                                                                                                                                              |
| *-v, --volume MOUNT*          | Mounts directory from storage into container. Use multiple options to mount more than one volume.                                                                                                                                                                                                                                 |
| *-e, --env VAR=VAL*           | Set environment variable in container. Use multiple options to define more than one variable. Those env vars will be passed as build arguments too.                                                                                                                                                                               |
| *-s, --preset PRESET*         | Predefined resource configuration (to see available values, run `apolo config show`)                                                                                                                                                                                                                                              |
| *-F, --force-overwrite*       | Overwrite if the destination image already exists.                                                                                                                                                                                                                                                                                |
| *--cache / --no-cache*        | Use Kaniko cache while building image. \[default: cache]                                                                                                                                                                                                                                                                          |
| *--verbose BOOLEAN*           | If specified, run Kaniko with 'debug' verbosity, otherwise 'info' (default).                                                                                                                                                                                                                                                      |
| *--build-tag VAR=VAL*         | Set tag(s) for image builder job. We will add tag 'kaniko-builds:{image-name}' authomatically.                                                                                                                                                                                                                                    |
| *-p, --project PROJECT\_NAME* | Start image builder job in other than the current project.                                                                                                                                                                                                                                                                        |
| *--extra-kaniko-args ARGS*    | Extra arguments for Kaniko builder. Useful for advanced users, e.g. to set custom Kaniko caching behaviour. We set some default arguments for you, so use this option with caution. Please refer to Kaniko documentation for more details at <https://github.com/GoogleContainerTools/kaniko?tab=readme-ov-file#additional-flags> |
| *--help*                      | Show this message and exit.                                                                                                                                                                                                                                                                                                       |

#### apolo-extras image local-build

Build Job container image locally (requires Docker daemon).

**Usage:**

```bash
apolo-extras image local-build [OPTIONS] CONTEXT_PATH IMAGE_URI
```

**Options:**

| Name                          | Description                                                                                                                      |
| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| *-f, --file TEXT*             | Relative (w\.r.t. context) path to the dockerfile. The dockerfile should be within the context directory. \[default: Dockerfile] |
| *--build-arg VAR=VAL*         | Build-time variables passed in ARG values. Could be used multiple times for multiple arguments.                                  |
| *-F, --force-overwrite*       | Overwrite if the destination image already exists.                                                                               |
| *--verbose BOOLEAN*           | If specified, provide verbose output (default False).                                                                            |
| *-p, --project PROJECT\_NAME* | Start image builder job in other than the current project.                                                                       |
| *--help*                      | Show this message and exit.                                                                                                      |

#### apolo-extras image transfer

Copy images between clusters.

**Usage:**

```bash
apolo-extras image transfer [OPTIONS] SOURCE DESTINATION
```

**Options:**

| Name                    | Description                                            |
| ----------------------- | ------------------------------------------------------ |
| *-F, --force-overwrite* | Transfer even if the destination image already exists. |
| *--help*                | Show this message and exit.                            |

### apolo-extras k8s

Cluster Kubernetes operations.

**Usage:**

```bash
apolo-extras k8s [OPTIONS] COMMAND [ARGS]...
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

**Commands:**

| Usage                                                                                     | Description |
| ----------------------------------------------------------------------------------------- | ----------- |
| [*apolo-extras k8s generate-registry-secret*](#apolo-extras-k8s-generate-registry-secret) |             |
| [*apolo-extras k8s generate-secret*](#apolo-extras-k8s-generate-secret)                   |             |

#### apolo-extras k8s generate-registry-secret

**Usage:**

```bash
apolo-extras k8s generate-registry-secret [OPTIONS]
```

**Options:**

| Name          | Description                 |
| ------------- | --------------------------- |
| *--name TEXT* |                             |
| *--help*      | Show this message and exit. |

#### apolo-extras k8s generate-secret

**Usage:**

```bash
apolo-extras k8s generate-secret [OPTIONS]
```

**Options:**

| Name          | Description                 |
| ------------- | --------------------------- |
| *--name TEXT* |                             |
| *--help*      | Show this message and exit. |

### apolo-extras init-aliases

Create apolo CLI aliases for apolo-extras functionality.

**Usage:**

```bash
apolo-extras init-aliases [OPTIONS]
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |
