Skip to content

Commit

Permalink
Add collapsible examples
Browse files Browse the repository at this point in the history
  • Loading branch information
valaparthvi committed Sep 15, 2022
1 parent daf6292 commit 596bf59
Show file tree
Hide file tree
Showing 16 changed files with 204 additions and 74 deletions.
12 changes: 11 additions & 1 deletion docs/website/docs/command-reference/add-binding.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ In the interactive mode, you will be guided to choose:
# Add binding between a service, and the component present in the working directory in the interactive mode
odo add binding
```
<details>
<summary>Example</summary>

```shell
$ odo add binding
? Do you want to list services from: current namespace
Expand All @@ -55,6 +58,8 @@ Run `odo dev` to create it on the cluster.
You can automate this command by executing:
odo add binding --service cluster-sample.Cluster.postgresql.k8s.enterprisedb.io --name my-go-app-cluster-sample
```
</details>
### Non-interactive mode
In the non-interactive mode, you will have to specify the following required information through the command-line:
Expand All @@ -69,13 +74,18 @@ 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>
odo add binding --name <name> --service <service-name> [--service-namespace NAMESPACE] [--bind-as-files] [--naming-strategy [none | lowercase | uppercase]]
```
<details>
<summary>Example</summary>
```shell
$ odo add binding --service cluster-sample.Cluster.postgresql.k8s.enterprisedb.io --name my-go-app-cluster-sample
✓ Successfully added the binding to the devfile.
Run `odo dev` to create it on the cluster.
```
</details>
#### Understanding Bind as Files
To connect your component with a service, you need to store some data (e.g. username, password, host address) on your component's container.
Expand Down
11 changes: 8 additions & 3 deletions docs/website/docs/command-reference/build-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ If the `--push` flag is passed to the command, the images will be pushed to thei
```shell
odo build-images
```
<details>
<summary>Example</summary>

```shell
$ odo build-images

↪ Building & Pushing Container: quay.io/pvala18/myimage
↪ Building & Pushing Container: quay.io/user/myimage
• Building image locally ...
STEP 1/7: FROM quay.io/phmartin/node:17
STEP 2/7: WORKDIR /usr/src/app
Expand All @@ -53,12 +56,14 @@ STEP 5/7: COPY . .
STEP 6/7: EXPOSE 8080
--> 12af8468cd0
STEP 7/7: CMD [ "node", "server.js" ]
COMMIT quay.io/pvala18/myimage
COMMIT quay.io/user/myimage
--> 58c0731e9a1
Successfully tagged quay.io/pvala18/myimage:latest
Successfully tagged quay.io/user/myimage:latest
58c0731e9a110e8dbb2dbe4bdb55a15bdbbce1b78e121d350e23de79f33c3dde
✓ Building image locally [2s]
```
</details>


### Faking the image build
You can also fake the image build by exporting `PODMAN_CMD=echo` to your environment.
23 changes: 17 additions & 6 deletions docs/website/docs/command-reference/create-namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,40 @@ title: odo create namespace
Any new namespace created with this command will also be set as the current active namespace, this applies to project as well.

## Running the command
To create a namespace you can run `odo create namespace <name>`:
To create a namespace, run the following command:
```shell
odo create namespace mynamespace
odo create namespace <name>
```
<details>
<summary>Example</summary>

```shell
$ odo create namespace mynamespace
✓ Namespace "mynamespace" is ready for use
✓ New namespace created and now using namespace: mynamespace
```
</details>


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

To create a project you can run `odo create project <name>`:
To create a project, run the following command:
```shell
odo create project myproject
odo create project <name>
```
<details>
<summary>Example</summary>

```shell
$ odo create project myproject
✓ Project "myproject" is ready for use
✓ New project created and now using project: myproject
```
</details>

:::note

:::tip
Using either of the aliases will not make any change to the resource created on the cluster. This command is smart enough to detect the resources supported by your cluster and make an informed decision on the type of resource that should be created.
So you can run `odo create project` on a Kubernetes cluster, and it will create a Namespace resource, and you can run `odo create namespace` on an OpenShift cluster, it will create a Project resource.

So you can run `odo create project` on a Kubernetes cluster, and it will create a `Namespace` resource, and you can run `odo create namespace` on an OpenShift cluster, it will create a `Project` resource.
:::
18 changes: 12 additions & 6 deletions docs/website/docs/command-reference/delete-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ There are 2 ways to delete a component:

### Delete with access to Devfile
```shell
odo delete component
odo delete component [--force] [--wait]
```
<details>
<summary>Example</summary>

```shell
$ odo delete component
Searching resources to delete, please wait...
Expand All @@ -22,6 +25,8 @@ This will delete "my-nodejs" from the namespace "my-project".
? Are you sure you want to delete "my-nodejs" and all its resources? Yes
The component "my-nodejs" is successfully deleted from namespace "my-project"
```
</details>

`odo` looks into the Devfile _present in the current directory_ for the component resources for the innerloop, and outerloop.
If these resources have been deployed on the cluster, then `odo` will delete them after user confirmation.
Otherwise, `odo` will exit with a message stating that it could not find the resources on the cluster.
Expand All @@ -35,8 +40,11 @@ You can delete these resources by running the command in the [next section](#del

### Delete without access to Devfile
```shell
odo delete component --name <component_name> [--namespace <namespace>]
odo delete component --name <component_name> [--namespace <namespace>] [--force] [--wait]
```
<details>
<summary>Example</summary>

```shell
$ odo delete component --name my-nodejs
Searching resources to delete, please wait...
Expand All @@ -46,13 +54,11 @@ This will delete "my-nodejs" from the namespace "my-project".
? Are you sure you want to delete these resources? Yes
The component "my-nodejs" is successfully deleted from namespace "my-project"
```
</details>


`odo` searches for resources attached to the given component in the given namespace on the cluster.
If `odo` finds the resources, it will delete them after user confirmation.
Otherwise, `odo` will exit with a message stating that it could not find the resources on the cluster.

`--namespace` is optional, if not provided, `odo` will use the current active namespace.

:::info
In both cases, `odo` does not wait for resources to be deleted.
:::
24 changes: 17 additions & 7 deletions docs/website/docs/command-reference/delete-namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,37 @@ title: odo delete namespace
`odo delete namespace` lets you delete a namespace/project on your cluster. If you are on a Kubernetes cluster, running the command will delete a Namespace resource for you, and for an OpenShift cluster, it will delete a Project resource.

## Running the command
To delete a namespace you can run `odo delete namespace <name>`:
To delete a namespace, run the following command:
```shell
odo delete namespace mynamespace
odo delete namespace <name> [--wait] [--force]
```
<details>
<summary>Example</summary>

```shell
$ odo delete namespace mynamespace
✓ Namespace "mynamespace" deleted
```
</details>

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

To delete a project you can run `odo delete project <name>`:
To delete a project, run the following command:
```shell
odo delete project myproject
odo delete project <name> [--wait] [--force]
```
<details>
<summary>Example</summary>

```shell
$ odo delete project myproject
✓ Project "myproject" deleted
✓ Project "myproject" deleted
```
</details>

:::note

:::tip
This command is smart enough to detect the resources supported by your cluster and make an informed decision on the type of resource that should be deleted, using either of the aliases.
So you can run `odo delete project` on a Kubernetes cluster, and it will delete a Namespace resource, or you can run `odo delete namespace` on an OpenShift cluster, it will delete a Project resource.

So you can run `odo delete project` on a Kubernetes cluster, and it will delete a `Namespace` resource, or you can run `odo delete namespace` on an OpenShift cluster, it will delete a `Project` resource.
:::
5 changes: 5 additions & 0 deletions docs/website/docs/command-reference/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ Note that the `uri` for the Dockerfile could also be an HTTP or HTTPS URL.
```shell
odo deploy
```
<details>
<summary>Example</summary>

```shell
$ odo deploy
__
Expand Down Expand Up @@ -119,6 +122,8 @@ Storing signatures
Your Devfile has been successfully deployed

```
</details>

## Substituting variables

The Devfile can define variables to make the Devfile parameterizable. The Devfile can define values for these variables, and you
Expand Down
18 changes: 13 additions & 5 deletions docs/website/docs/command-reference/describe-binding.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ For each of these resources, the following information is displayed:
- the naming strategy used for binding names, if any,
- if the binding information is auto-detected.

When the service binding are not deployed yet to the cluster:

```console
odo describe binding
```
When the service binding are not deployed yet to the cluster:

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

```console
$ odo describe binding
ServiceBinding used by the current component:
Expand All @@ -58,12 +61,15 @@ Available binding information: unknown
Binding information for one or more ServiceBinding is not available because they don't exist on the cluster yet.
Start "odo dev" first to see binding information.
```
</details>


When the resources have been deployed to the cluster, the command also extracts information from the status of the resources to display information about the variables that can be used from the component.

```console
odo describe binding
```

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

```console
$ odo describe binding
ServiceBinding used by the current component:
Expand Down Expand Up @@ -99,6 +105,8 @@ Available binding information:
• REDIS_PASSWORD
• REDIS_TYPE
```
</details>


### Describe without access to Devfile

Expand Down
21 changes: 16 additions & 5 deletions docs/website/docs/command-reference/describe-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ There are 2 ways to describe a component:
```shell
odo describe component
```
<details>
<summary>Example</summary>

```shell
$ odo describe component
Name: my-nodejs
Expand All @@ -26,17 +29,19 @@ Tags: NodeJS, Express, ubi8
Running in: Deploy

Supported odo features:
• Dev: true
• Deploy: true
• Debug: true
• Dev: true
• Deploy: true
• Debug: true

Container components:
• runtime
• runtime

Kubernetes components:
• outerloop-deploy
• outerloop-deploy

```
</details>

This command returns information extracted from the Devfile:
- metadata (name, display name, project type, language, version, description and tags)
- supported odo features, indicating if the Devfile defines necessary information to run `odo dev`, `odo dev --debug` and `odo deploy`
Expand All @@ -46,9 +51,13 @@ This command returns information extracted from the Devfile:
The command also displays if the component is currently running in the cluster on Dev and/or Deploy mode.

### Describe without access to Devfile

```shell
odo describe component --name <component_name> [--namespace <namespace>]
```
<details>
<summary>Example</summary>

```shell
$ odo describe component --name my-nodejs
Name: my-nodejs
Expand All @@ -67,6 +76,8 @@ Supported odo features:
• Debug: Unknown

```
</details>

The command extracts information from the labels and annotations attached to the deployed component to display the known metadata of the Devfile used to deploy the component.

The command also displays if the component is currently running in the cluster on Dev and/or Deploy mode.
Loading

0 comments on commit 596bf59

Please sign in to comment.