Skip to content

Commit

Permalink
Document how odo works with projects/namespaces (redhat-developer#6009)
Browse files Browse the repository at this point in the history
* Document how odo works with projects/namespaces

* rm3l's review
  • Loading branch information
valaparthvi authored Aug 10, 2022
1 parent 076f2e2 commit c384f54
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 4 deletions.
4 changes: 4 additions & 0 deletions docs/website/docs/command-reference/create-namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ 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.

:::note
Executing this command inside a component directory will not update the namespace or project of the existing component.
:::

To create a namespace you can run `odo create namespace <name>`:
```shell
odo create namespace mynamespace
Expand Down
7 changes: 6 additions & 1 deletion docs/website/docs/command-reference/delete-namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ $ odo delete project myproject

:::note
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, and 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.
:::


:::note
Running `odo delete <namespace/project>` to delete namespace/project does not ensure that a component using it will also get updated. See [odo dev#env-file](./dev.md#env-file) or [odo deploy#env-file](./deploy.md#env-file) for more information.
:::

## Available Flags
Expand Down
17 changes: 15 additions & 2 deletions docs/website/docs/command-reference/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,22 @@ components:

Note that the `uri` for the Dockerfile could also be an HTTP or HTTPS URL.

## Sustituting variables
## Substituting variables

The Devfile can define variables to make the Devfile parameterizable. The Devfile can define values for these variables, and you
can override the values for variables from the command line when running `odo deploy`, using the `--var` and `--var-file` options.

See [Sustituting variables in odo dev](dev.md#sustituting-variables) for more information.
See [Substituting variables in odo dev](dev.md#substituting-variables) for more information.

## Env File

When `odo deploy` is executed, a `.odo/env/env.yaml` file is created if it does not exist. It stores the namespace/project that will be used by the component, and its default value is set to currently active namespace/project.

```yaml
ComponentSettings:
Project: myproject
```
:::note
Creating, deleting or setting a namespace/project will not modify this value. To use a different namespace/project, user will have to manually change `.ComponentSettings.Project` value, or delete the `.odo` directory.
:::
15 changes: 14 additions & 1 deletion docs/website/docs/command-reference/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Press Ctrl+c to exit `odo dev` and delete resources from the cluster

In the above example, three things have happened:
* Your application has been built and deployed to the cluster
* `odo` has port-forwarded your application for local accessability
* `odo` has port-forwarded your application for local accessibility
* `odo` will watch for changes in the current directory and rebuild the application when changes are detected

You can press Ctrl-c at any time to terminate the development session. The command can take a few moment to terminate, as it
Expand Down Expand Up @@ -414,3 +414,16 @@ This state file contains the forwarded ports:
]
}
```

## Env File

When `odo dev` is executed, a `.odo/env/env.yaml` file is created if it does not exist. It stores the namespace/project that will be used by the component, and its default value is set to currently active namespace/project.

```yaml
ComponentSettings:
Project: myproject
```

:::note
Creating, deleting or setting a namespace/project will not modify this value. To use a different namespace/project, user will have to manually change `.ComponentSettings.Project` value, or delete the `.odo` directory.
:::
2 changes: 2 additions & 0 deletions docs/website/docs/command-reference/set-namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ title: odo set namespace

`odo set namespace` lets you set a namespace/project as the current active one in your local `kubeconfig` configuration.

:::note
Executing this command inside a component directory will not update the namespace or project of the existing component.
:::

To set the current active namespace you can run `odo set namespace <name>`:
```console
Expand Down
1 change: 1 addition & 0 deletions pkg/odo/cli/create/namespace/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var (
This command directly performs actions on the cluster and doesn't require a push.
Any new namespace created with this command will also be set as the current active namespace.
If executed inside a component directory, this command will not update the namespace of the existing component.
`)

createShortDesc = `Create a new namespace`
Expand Down

0 comments on commit c384f54

Please sign in to comment.