Skip to content

Commit

Permalink
doc/projects: add UI instructions for projects
Browse files Browse the repository at this point in the history
Signed-off-by: Ruth Fuchss <[email protected]>
  • Loading branch information
ru-fu committed Jul 1, 2024
1 parent 9b0243b commit f8869a4
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 10 deletions.
5 changes: 5 additions & 0 deletions doc/howto/projects_confine.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ How to confine a project to a specific user depends on the authentication method
You can confine access to specific projects by restricting the TLS client certificate that is used to connect to the LXD server.
See {ref}`authentication-tls-certs` for detailed information.

```{note}
The UI does not currently support configuring project confinement.
Use the CLI or API to set up confinement.
```

To confine the access from the time the client certificate is added, you must either use token authentication or add the client certificate to the server directly.

Follow these instructions:
Expand Down
62 changes: 53 additions & 9 deletions doc/howto/projects_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ However, note that it is not possible to modify the features that are enabled fo

## Create a project

````{tabs}
```{group-tab} CLI
`````{tabs}
````{group-tab} CLI
To create a project, use the [`lxc project create`](lxc_project_create.md) command.
You can specify configuration options by using the `--config` flag.
Expand All @@ -17,11 +17,11 @@ For example, to create a project called `my-project` that isolates instances, bu
lxc project create my-project --config features.images=false --config features.profiles=false
To create a project called `my-restricted-project` that blocks access to security-sensitive features (for example, container nesting) but allows backups, enter the following command:
To create a project called `my-restricted-project` that blocks access to security-sensitive features (for example, container nesting) but allows snapshots, enter the following command:
lxc project create my-restricted-project --config restricted=true --config restricted.backups=allow
```
```{group-tab} API
lxc project create my-restricted-project --config restricted=true --config restricted.snapshots=allow
````
````{group-tab} API
To create a project, send a POST request to the `/1.0/projects` endpoint.
You can specify configuration options under the `"config"` field.
Expand All @@ -37,22 +37,58 @@ For example, to create a project called `my-project` that isolates instances, bu
"name": "my-project"
}'
To create a project called `my-restricted-project` that blocks access to security-sensitive features (for example, container nesting) but allows backups, send the following request:
To create a project called `my-restricted-project` that blocks access to security-sensitive features (for example, container nesting) but allows snapshots, send the following request:
lxc query --request POST /1.0/projects --data '{
"config": {
"restricted": "true",
"restricted.backups": "allow"
"restricted.snapshots": "allow"
},
"name": "my-restricted-project"
}'
See [`POST /1.0/projects`](swagger:/projects/projects_post) for more information.
````
````{group-tab} UI
To create a project, expand the {guilabel}`Project` drop-down and select {guilabel}`+ Create project` at the bottom.
Enter a name and optionally a description for the new project.
You can create the project using the default set of features or select {guilabel}`Customised` to add or remove specific features.
See {ref}`project-features` for more information about the available features.
For example, to create a project called `my-project` that isolates instances, but allows access to the default project's images and profiles:
```{figure} /images/UI/create_project.png
:width: 80%
:alt: Create a project
```
To configure resource limits for the project, select {guilabel}`Resource limits`.
To restrict a project from accessing security-sensitive features, check {guilabel}`Allow custom restrictions on a project level`.
You can then configure the restrictions under {guilabel}`Restrictions`.
See {ref}`project-restrictions` for more information.
For example, to create a project called `my-restricted-project` that blocks access to security-sensitive features (for example, container nesting) but allows snapshots:
1. Check {guilabel}`Allow custom restrictions on a project level`:
```{figure} /images/UI/create_restr_project1.png
:width: 80%
:alt: Create a restricted project
```
1. Configure the restrictions:
```{figure} /images/UI/create_restr_project2.png
:width: 80%
:alt: Allow snapshots in a restricted project
```
````
`````

```{tip}
When you create a project without specifying configuration options, {config:option}`project-features:features.profiles` is set to `true`, which means that profiles are isolated in the project.
When you create a project with the default options, {config:option}`project-features:features.profiles` is set to `true`, which means that profiles are isolated in the project.
Consequently, the new project does not have access to the `default` profile of the `default` project and therefore misses required configuration for creating instances (like the root disk).
To fix this, add a root disk device to the project's `default` profile (see {ref}`profiles-set-options` for instructions).
Expand Down Expand Up @@ -101,6 +137,10 @@ Therefore, you must specify all configuration options as part of the PATCH reque
See [`PATCH /1.0/projects/{name}`](swagger:/projects/project_patch) for more information.
````
````{group-tab} UI
To update the project configuration, select the respective project from the {guilabel}`Project` drop-down.
Then go to {guilabel}`Configuration` and click {guilabel}`Edit configuration` to set or unset any configuration options.
````
`````

### Edit the project
Expand All @@ -123,4 +163,8 @@ For example:
See [`PUT /1.0/projects/{name}`](swagger:/projects/project_put) for more information.
```
```{group-tab} UI
To UI does not currently support editing the full YAML configuration for a project.
However, you can update several or all configuration options at the same time through the UI.
```
````
27 changes: 26 additions & 1 deletion doc/howto/projects_work.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ To display information about each project, use {ref}`rest-api-recursion`:
See [`GET /1.0/projects`](swagger:/projects/projects_get) and [`GET /1.0/projects?recursion=1`](swagger:/projects/projects_get_recursion1) for more information.
````
````{group-tab} UI
To list all projects (that you have permission to see), expand the {guilabel}`Project` drop-down.
````
`````

(projects-switch)=
## Switch projects

````{tabs}
Expand All @@ -63,12 +67,15 @@ To switch to a different project, enter the following command:
The API does not have the concept of switching projects.
All requests target the default project unless a different project is specified (see {ref}`projects-target`).
```
```{group-tab} UI
To switch to another project, select a different project from the {guilabel}`Project` drop-down.
```
````

(projects-target)=
## Target a project

Instead of switching to a different project, you can target a specific project when running a command.
When using the CLI or the API, you can target a specific project when running a command.
Many LXD commands support the `--project` flag or the `project` parameter to run an action in a different project.

```{note}
Expand All @@ -94,6 +101,10 @@ Or with {ref}`rest-api-recursion`:
lxc query --request GET /1.0/instances?recursion=2\&project=my-project
```
```{group-tab} UI
The UI does not currently support targeting another project.
Instead, {ref}`switch to the other project <projects-switch>`.
```
````

## Move an instance to another project
Expand Down Expand Up @@ -133,6 +144,9 @@ For example, you might need to change the root disk device if one of the project
See [`POST /1.0/instances/{name}`](swagger:/instances/instance_post) for more information.
```
```{group-tab} UI
The UI does not currently support moving instances between projects.
```
````

## Copy a profile to another project
Expand All @@ -157,4 +171,15 @@ Send the following request, replacing `<project>` with the new project that has
lxc query --request PUT /1.0/profiles/default?projects=<project> --data \
"$(lxc query --request GET /1.0/profiles/default)"
```
```{group-tab} UI
1. Select the `default` project from the {guilabel}`Project` drop-down.
1. Go to {guilabel}`Profiles` and select the default profile.
1. In the profile view, switch to the {guilabel}`Configuration` tab.
1. Select {guilabel}`YAML configuration` and copy the YAML representation of the profile.
1. Select the project with the empty default profile from the {guilabel}`Project` drop-down.
1. Go to {guilabel}`Profiles` and select the empty default profile for the project.
1. In the profile view, switch to the {guilabel}`Configuration` tab.
1. Select {guilabel}`YAML configuration` and click {guilabel}`Edit profile`.
1. Paste the YAML representation that you copied and save the changes.
```
````
Binary file added doc/images/UI/create_project.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/UI/create_restr_project1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/UI/create_restr_project2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f8869a4

Please sign in to comment.