From 8ad74c5a11ae8313ec93a96fd51234d5ff2a33bc Mon Sep 17 00:00:00 2001 From: Parthvi Vala Date: Wed, 21 Sep 2022 15:26:54 +0530 Subject: [PATCH] Add examples to missing command reference docs Signed-off-by: Parthvi Vala --- .../docs/command-reference/add-binding.md | 2 +- .../docs/command-reference/build-images.md | 2 +- .../command-reference/delete-namespace.md | 2 + .../command-reference/describe-binding.md | 22 ++++- docs/website/docs/command-reference/init.md | 6 ++ .../docs/command-reference/list-component.md | 6 +- .../docs/command-reference/list-namespace.md | 6 +- docs/website/docs/command-reference/logs.md | 35 +++++++- .../docs/command-reference/remove-binding.md | 4 + .../docs/command-reference/set-namespace.md | 12 ++- docs/website/docs/overview/configure.md | 90 +++++++++++-------- 11 files changed, 140 insertions(+), 47 deletions(-) diff --git a/docs/website/docs/command-reference/add-binding.md b/docs/website/docs/command-reference/add-binding.md index 811fe432a3d..f0270416df8 100644 --- a/docs/website/docs/command-reference/add-binding.md +++ b/docs/website/docs/command-reference/add-binding.md @@ -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 --service [--service-namespace NAMESPACE] [--bind-as-files] [--naming-strategy [none | lowercase | uppercase]] +odo add binding --name --service [--service-namespace NAMESPACE] [--bind-as-files {true, false}] [--naming-strategy {none, lowercase, uppercase}] ```
Example diff --git a/docs/website/docs/command-reference/build-images.md b/docs/website/docs/command-reference/build-images.md index 74bf3b76259..2f20855de2d 100644 --- a/docs/website/docs/command-reference/build-images.md +++ b/docs/website/docs/command-reference/build-images.md @@ -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. \ No newline at end of file +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. \ No newline at end of file diff --git a/docs/website/docs/command-reference/delete-namespace.md b/docs/website/docs/command-reference/delete-namespace.md index f2772d36248..9822cb48467 100644 --- a/docs/website/docs/command-reference/delete-namespace.md +++ b/docs/website/docs/command-reference/delete-namespace.md @@ -14,6 +14,7 @@ odo delete namespace [--wait] [--force] ```shell $ odo delete namespace mynamespace +? Are you sure you want to delete namespace "mynamespace"? Yes ✓ Namespace "mynamespace" deleted ```
@@ -29,6 +30,7 @@ odo delete project [--wait] [--force] ```shell $ odo delete project myproject +? Are you sure you want to delete project "myproject"? Yes ✓ Project "myproject" deleted ``` diff --git a/docs/website/docs/command-reference/describe-binding.md b/docs/website/docs/command-reference/describe-binding.md index 4b872e3289d..2d6dd32a168 100644 --- a/docs/website/docs/command-reference/describe-binding.md +++ b/docs/website/docs/command-reference/describe-binding.md @@ -37,7 +37,7 @@ odo describe binding When the service binding are not deployed yet to the cluster:
-Example(not deployed) +Example (not deployed) ```console $ odo describe binding @@ -68,7 +68,7 @@ When the resources have been deployed to the cluster, the command also extracts
-Example(after deploying on the cluster) +Example (after deploying on the cluster) ```console $ odo describe binding @@ -114,6 +114,24 @@ Available binding information: odo describe binding --name ``` +
+Example + +```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 +``` +
+ 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: diff --git a/docs/website/docs/command-reference/init.md b/docs/website/docs/command-reference/init.md index 2f3e7b41043..3e68d0bd576 100644 --- a/docs/website/docs/command-reference/init.md +++ b/docs/website/docs/command-reference/init.md @@ -21,6 +21,10 @@ In interactive mode, you will be guided to: ```console odo init ``` + +
+Example + ```console $ odo init ? Select language: java @@ -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". ``` +
+ ### Non-interactive mode diff --git a/docs/website/docs/command-reference/list-component.md b/docs/website/docs/command-reference/list-component.md index 77de975ba04..a596554cb70 100644 --- a/docs/website/docs/command-reference/list-component.md +++ b/docs/website/docs/command-reference/list-component.md @@ -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 ```
diff --git a/docs/website/docs/command-reference/list-namespace.md b/docs/website/docs/command-reference/list-namespace.md index a9790d57a29..492fb287b4b 100644 --- a/docs/website/docs/command-reference/list-namespace.md +++ b/docs/website/docs/command-reference/list-namespace.md @@ -40,9 +40,9 @@ odo list project
Example - ```console - $ odo list project - ACTIVE NAME +```console +$ odo list project +ACTIVE NAME * default kube-node-lease kube-public diff --git a/docs/website/docs/command-reference/logs.md b/docs/website/docs/command-reference/logs.md index 2804b8a06e0..2a89cd3da27 100644 --- a/docs/website/docs/command-reference/logs.md +++ b/docs/website/docs/command-reference/logs.md @@ -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] +``` +
+Example + +```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 +``` +
+ `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. @@ -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`. \ No newline at end of file + dev` and `odo deploy`. diff --git a/docs/website/docs/command-reference/remove-binding.md b/docs/website/docs/command-reference/remove-binding.md index ee17828211f..1a1546c6a36 100644 --- a/docs/website/docs/command-reference/remove-binding.md +++ b/docs/website/docs/command-reference/remove-binding.md @@ -13,7 +13,11 @@ The command takes a required `--name` flag that points to the name of the Servic odo remove binding --name ``` +
+Example + ```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. ``` +
\ No newline at end of file diff --git a/docs/website/docs/command-reference/set-namespace.md b/docs/website/docs/command-reference/set-namespace.md index 026ff269577..308d4285949 100644 --- a/docs/website/docs/command-reference/set-namespace.md +++ b/docs/website/docs/command-reference/set-namespace.md @@ -9,10 +9,15 @@ To set the current active namespace you can run `odo set namespace `: ```console odo set namespace mynamespace ``` + +
+Example + ```console $ odo set namespace mynamespace ✓ Current active namespace set to "mynamespace" ``` +
Optionally, you can also use `project` as an alias to `namespace`. @@ -20,12 +25,17 @@ To set the current active project you can run `odo set project `: ```console odo set project myproject ``` + +
+Example + ```console $ odo set project myproject ✓ Current active project set to "myproject" ``` +
-:::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. ::: diff --git a/docs/website/docs/overview/configure.md b/docs/website/docs/overview/configure.md index b052232afa4..1cffed5fe71 100644 --- a/docs/website/docs/overview/configure.md +++ b/docs/website/docs/overview/configure.md @@ -44,53 +44,71 @@ C:\\Users\userName\.odo\preference.yaml ``` - --- 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: +
+Example + ```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 + ``` +
+ ### Set a configuration -To set a value for a preference key, run `odo preference set `. +To set a value for a preference key, run the following command: ```shell -odo preference set updatenotification false +odo preference set ``` -Example: +
+Example + ```shell $ odo preference set updatenotification false Global preference was successfully updated ``` +
+ Note that the preference key is case-insensitive. ### Unset a configuration -To unset a value of a preference key, run `odo preference unset `; 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 [--force] ``` -Example: + +
+Example + ```shell $ odo preference unset updatednotification ? Do you want to unset updatenotification in the preference (y/N) y Global preference was successfully updated ``` +
+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 @@ -115,40 +133,43 @@ You can use the `odo preference 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 ``` -For example: +
+Example ``` $ odo preference add registry StageRegistry https://registry.stage.devfile.io New registry successfully added ``` +
### 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 [--force] ``` - -For example: +
+Example ``` $ odo preference remove registry StageRegistry ? Are you sure you want to delete registry "StageRegistry" Yes Successfully deleted registry ``` +
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 @@ -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` |