Skip to content

Commit

Permalink
Add examples to missing command reference docs
Browse files Browse the repository at this point in the history
Signed-off-by: Parthvi Vala <pvala@redhat.com>
  • Loading branch information
valaparthvi committed Sep 21, 2022
1 parent f6e2bb7 commit 8ad74c5
Show file tree
Hide file tree
Showing 11 changed files with 140 additions and 47 deletions.
2 changes: 1 addition & 1 deletion docs/website/docs/command-reference/add-binding.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ In the non-interactive mode, you will have to specify the following required inf
Refer to [this page](https://docs.openshift.com/container-platform/4.10/applications/connecting_applications_to_services/binding-workloads-using-sbo.html#sbo-naming-strategies_binding-workloads-using-sbo) for more details on naming strategies.
```shell
odo add binding --name <name> --service <service-name> [--service-namespace NAMESPACE] [--bind-as-files] [--naming-strategy [none | lowercase | uppercase]]
odo add binding --name <name> --service <service-name> [--service-namespace NAMESPACE] [--bind-as-files {true, false}] [--naming-strategy {none, lowercase, uppercase}]
```
<details>
<summary>Example</summary>
Expand Down
2 changes: 1 addition & 1 deletion docs/website/docs/command-reference/build-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ Successfully tagged quay.io/user/myimage:latest


### Faking the image build
You can also fake the image build by exporting `PODMAN_CMD=echo` to your environment.
You can also fake the image build by exporting `PODMAN_CMD=echo` or `DOCKER_CMD=echo` to your environment. Read [environment variables controlling odo behaviour](../overview/configure.md#environment-variables-controlling-odo-behavior) for more information.
2 changes: 2 additions & 0 deletions docs/website/docs/command-reference/delete-namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ odo delete namespace <name> [--wait] [--force]

```shell
$ odo delete namespace mynamespace
? Are you sure you want to delete namespace "mynamespace"? Yes
✓ Namespace "mynamespace" deleted
```
</details>
Expand All @@ -29,6 +30,7 @@ odo delete project <name> [--wait] [--force]

```shell
$ odo delete project myproject
? Are you sure you want to delete project "myproject"? Yes
✓ Project "myproject" deleted
```
</details>
Expand Down
22 changes: 20 additions & 2 deletions docs/website/docs/command-reference/describe-binding.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ odo describe binding
When the service binding are not deployed yet to the cluster:

<details>
<summary>Example(not deployed)</summary>
<summary>Example (not deployed)</summary>

```console
$ odo describe binding
Expand Down Expand Up @@ -68,7 +68,7 @@ When the resources have been deployed to the cluster, the command also extracts


<details>
<summary>Example(after deploying on the cluster)</summary>
<summary>Example (after deploying on the cluster)</summary>

```console
$ odo describe binding
Expand Down Expand Up @@ -114,6 +114,24 @@ Available binding information:
odo describe binding --name <component_name>
```

<details>
<summary>Example</summary>

```shell
$ odo describe binding --name my-nodejs-app-redis-standalone
Service Binding Name: my-nodejs-app-redis-standalone
Services:
• redis-standalone (Redis.redis.redis.opstreelabs.in)
Bind as files: false
Detect binding resources: true
Available binding information:
• REDIS_CLUSTERIP
• REDIS_HOST
• REDIS_PASSWORD
• REDIS_TYPE
```
</details>

The command extracts information from the cluster.

The command searches for a resource in the current namespace with the given name, the kind `ServiceBinding` and one of these apiVersion:
Expand Down
6 changes: 6 additions & 0 deletions docs/website/docs/command-reference/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ In interactive mode, you will be guided to:
```console
odo init
```

<details>
<summary>Example</summary>

```console
$ odo init
? Select language: java
Expand All @@ -35,6 +39,8 @@ To start editing your component, use "odo dev" and open this folder in your favo
Changes will be directly reflected on the cluster.
To deploy your component to a cluster use "odo deploy".
```
</details>


### Non-interactive mode

Expand Down
6 changes: 3 additions & 3 deletions docs/website/docs/command-reference/list-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ odo list component
```shell
$ odo list component
✓ Listing components from namespace 'my-percona-server-mongodb-operator' [292ms]
NAME PROJECT TYPE RUNNING IN MANAGED
my-nodejs nodejs Deploy odo (v3.0.0-rc1)
my-go-app go Dev odo (v3.0.0-rc1)
NAME PROJECT TYPE RUNNING IN MANAGED
* my-nodejs nodejs Deploy odo (v3.0.0-rc1)
my-go-app go Dev odo (v3.0.0-rc1)
mongodb-instance Unknown None percona-server-mongodb-operator
```
</details>
Expand Down
6 changes: 3 additions & 3 deletions docs/website/docs/command-reference/list-namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ odo list project
<details>
<summary>Example</summary>

```console
$ odo list project
ACTIVE NAME
```console
$ odo list project
ACTIVE NAME
* default
kube-node-lease
kube-public
Expand Down
35 changes: 34 additions & 1 deletion docs/website/docs/command-reference/logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,39 @@ directory.
If you haven't already done so, you must [initialize](../command-reference/init) your source code with the `odo
init` command.

```shell
odo logs [--follow] [--dev | --deploy]
```
<details>
<summary>Example</summary>

```shell
$ odo logs
runtime: npm WARN nodejs-starter@1.0.0 No repository field.
runtime:
runtime: added 64 packages from 57 contributors and audited 64 packages in 7.761s
runtime: found 0 vulnerabilities
runtime:
runtime:
runtime: > nodejs-starter@1.0.0 start /projects
runtime: > node server.js
runtime:
runtime: App started on PORT 3000
main: Wed Sep 21 08:26:27 UTC 2022 - this is infinite while loop
main: Wed Sep 21 08:26:32 UTC 2022 - this is infinite while loop
main: Wed Sep 21 08:26:37 UTC 2022 - this is infinite while loop
main: Wed Sep 21 08:26:42 UTC 2022 - this is infinite while loop
main: Wed Sep 21 08:26:47 UTC 2022 - this is infinite while loop
main: Wed Sep 21 08:26:52 UTC 2022 - this is infinite while loop
main: Wed Sep 21 08:26:57 UTC 2022 - this is infinite while loop
main: Wed Sep 21 08:27:02 UTC 2022 - this is infinite while loop
main: Wed Sep 21 08:27:07 UTC 2022 - this is infinite while loop
main: Wed Sep 21 08:27:12 UTC 2022 - this is infinite while loop
main: Wed Sep 21 08:27:17 UTC 2022 - this is infinite while loop
main: Wed Sep 21 08:27:22 UTC 2022 - this is infinite while loop
```
</details>
`odo logs` command can be used with the following flags:
* Use `odo logs --dev` to see the logs for the containers created by `odo dev` command.
* Use `odo logs --deploy` to see the logs for the containers created by `odo deploy` command.
Expand All @@ -24,4 +57,4 @@ the same commands as above albeit, with a `--follow` flag:
* Use `odo logs --dev --follow` to follow the logs for the containers created by `odo dev` command.
* Use `odo logs --deploy --follow` to follow the logs for the containers created by `odo deploy` command.
* Use `odo logs --follow` (without `--dev` or `--deploy`) to follow the logs of all the containers created by both `odo
dev` and `odo deploy`.
dev` and `odo deploy`.
4 changes: 4 additions & 0 deletions docs/website/docs/command-reference/remove-binding.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ The command takes a required `--name` flag that points to the name of the Servic
odo remove binding --name <ServiceBinding_name>
```

<details>
<summary>Example</summary>

```shell
$ odo remove binding --name redis-service-my-nodejs-app
✓ Successfully removed the binding from the devfile. You can now run `odo dev` or `odo deploy` to delete it from the cluster.
```
</details>
12 changes: 11 additions & 1 deletion docs/website/docs/command-reference/set-namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,33 @@ To set the current active namespace you can run `odo set namespace <name>`:
```console
odo set namespace mynamespace
```

<details>
<summary>Example</summary>

```console
$ odo set namespace mynamespace
✓ Current active namespace set to "mynamespace"
```
</details>

Optionally, you can also use `project` as an alias to `namespace`.

To set the current active project you can run `odo set project <name>`:
```console
odo set project myproject
```

<details>
<summary>Example</summary>

```console
$ odo set project myproject
✓ Current active project set to "myproject"
```
</details>

:::note
:::tip
This command updates your current `kubeconfig` configuration, using either of the aliases.
So running either `odo set project` or `odo set namespace` performs the exact same operation in your configuration.
:::
90 changes: 55 additions & 35 deletions docs/website/docs/overview/configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,53 +44,71 @@ C:\\Users\userName\.odo\preference.yaml
```

</TabItem>

</Tabs>

---
A different location can be set for the `preference.yaml` by exporting `GLOBALODOCONFIG` in the user environment.

### View the configuration
To view the current configuration, run `odo preference view`.
To view the current configuration, run the following command:

```shell
odo preference view
```
Example:
<details>
<summary>Example</summary>

```shell
$ odo preference view
PARAMETER CURRENT_VALUE
UpdateNotification
Timeout
PushTimeout
RegistryCacheTime
Ephemeral
ConsentTelemetry
Preference parameters:
PARAMETER VALUE
ConsentTelemetry true
Ephemeral true
PushTimeout
RegistryCacheTime
Timeout
UpdateNotification

Devfile registries:
NAME URL SECURE
StagingRegistry https://registry.stage.devfile.io No

```
</details>

### Set a configuration
To set a value for a preference key, run `odo preference set <key> <value>`.
To set a value for a preference key, run the following command:
```shell
odo preference set updatenotification false
odo preference set <key> <value>
```
Example:
<details>
<summary>Example</summary>

```shell
$ odo preference set updatenotification false
Global preference was successfully updated
```
</details>

Note that the preference key is case-insensitive.

### Unset a configuration
To unset a value of a preference key, run `odo preference unset <key>`; use `-f` flag to skip the confirmation.
To unset a value of a preference key, run the following command:
```shell
odo preference unset updatednotification
odo preference unset <key> [--force]
```
Example:

<details>
<summary>Example</summary>

```shell
$ odo preference unset updatednotification
? Do you want to unset updatenotification in the preference (y/N) y
Global preference was successfully updated
```
</details>

You can use the `--force` (or `-f`) flag to force the unset.
Unsetting a preference key sets it to an empty value in the preference file. odo will use the [default value](./configure#preference-key-table) for such configuration.

### Preference Key Table
Expand All @@ -115,40 +133,43 @@ You can use the `odo preference <add/remove> registry` command to manage the reg

### Adding a registry

You can use the following command to add a registry:
To add a registry, run the following command:

```
odo preference add registry
odo preference add registry <name> <url>
```

For example:
<details>
<summary>Example</summary>

```
$ odo preference add registry StageRegistry https://registry.stage.devfile.io
New registry successfully added
```
</details>

### Deleting a registry

You can delete a registry with the command:
To delete a registry, run the following command:

```
odo preference remove registry
odo preference remove registry <name> [--force]
```

For example:
<details>
<summary>Example</summary>

```
$ odo preference remove registry StageRegistry
? Are you sure you want to delete registry "StageRegistry" Yes
Successfully deleted registry
```
</details>

You can use the `--force` (or `-f`) flag to force the deletion of the registry without confirmation.


:::note
To update a registry, you can delete it and add it again.
:::tip **Updating a registry**
To update a registry, you can delete it and add it again with the updated value.
:::

## Advanced configuration
Expand All @@ -158,13 +179,12 @@ Options here are mostly used for debugging and testing `odo` behavior.

### Environment variables controlling odo behavior

| Variable | Usage |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `PODMAN_CMD` | The command executed to run the local podman binary. `podman` by default |
| `DOCKER_CMD` | The command executed to run the local docker binary. `docker` by default |
| `ODO_BOOTSTRAPPER_IMAGE` | |
| `ODO_LOG_LEVEL` | |
| `ODO_DISABLE_TELEMETRY` | |
| `GLOBALODOCONFIG` | |
| `ODO_DEBUG_TELEMETRY_FILE` | Useful for debugging telemetry. When set it will save telemetry data to a file instead of sending it to the server. |
| `DEVFILE_PROXY` | Integration tests will use this address as Devfile registry instead of `https://registry.stage.devfile.io` |
| Variable | Usage |
| -------------------------- |---------------------------------------------------------------------------------------------------------------------|
| `PODMAN_CMD` | The command executed to run the local podman binary. `podman` by default |
| `DOCKER_CMD` | The command executed to run the local docker binary. `docker` by default |
| `ODO_LOG_LEVEL` | Useful for setting a log level to be used by odo commands. |
| `ODO_DISABLE_TELEMETRY` | Useful for disabling telemetry collection. |
| `GLOBALODOCONFIG` | Useful for setting a different location of global preference file preference.yaml. |
| `ODO_DEBUG_TELEMETRY_FILE` | Useful for debugging telemetry. When set it will save telemetry data to a file instead of sending it to the server. |
| `DEVFILE_PROXY` | Integration tests will use this address as Devfile registry instead of `https://registry.stage.devfile.io` |

0 comments on commit 8ad74c5

Please sign in to comment.