Skip to content

Commit b39e32c

Browse files
bahkauv70marceljk
andauthored
Support for IaaS images (#559)
* feat: implementation of list command * feature: create command * feat: corrected package name * feat: implemented delete command * feat: add describe command * feat: added update command * feat: linter fixes * feat: documentation * Update internal/cmd/beta/image/update/update.go Co-authored-by: Marcel Jacek <[email protected]> * feat: fix review findings * feat: add progress indicator based on actually uploaded data * feat: added explicit termination of progress indicator * chore: fix review findings * chore: fixed linter hints * chore: fix linting warnings, recreated docs again --------- Co-authored-by: Marcel Jacek <[email protected]>
1 parent bc4c8c6 commit b39e32c

24 files changed

+2896
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Below you can find a list of the STACKIT services already available in the CLI (
7676
| Service | CLI Commands | Status |
7777
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
7878
| Observability | `observability` | :white_check_mark: |
79-
| Infrastructure as a Service (IaaS) | `beta network-area` <br/> `beta network` <br/> `beta volume` <br/> `beta network-interface` <br/> `beta public-ip` <br/> `beta security-group` <br/> `beta key-pair` | :white_check_mark: (beta) |
79+
| Infrastructure as a Service (IaaS) | `beta network-area` <br/> `beta network` <br/> `beta volume` <br/> `beta network-interface` <br/> `beta public-ip` <br/> `beta security-group` <br/> `beta key-pair` <br/> `beta image` | :white_check_mark: (beta)|
8080
| Authorization | `project`, `organization` | :white_check_mark: |
8181
| DNS | `dns` | :white_check_mark: |
8282
| Kubernetes Engine (SKE) | `ske` | :white_check_mark: |

docs/stackit_beta.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ stackit beta [flags]
4141
### SEE ALSO
4242

4343
* [stackit](./stackit.md) - Manage STACKIT resources using the command line
44+
* [stackit beta image](./stackit_beta_image.md) - Manage server images
4445
* [stackit beta key-pair](./stackit_beta_key-pair.md) - Provides functionality for SSH key pairs
4546
* [stackit beta network](./stackit_beta_network.md) - Provides functionality for networks
4647
* [stackit beta network-area](./stackit_beta_network-area.md) - Provides functionality for STACKIT Network Area (SNA)

docs/stackit_beta_image.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## stackit beta image
2+
3+
Manage server images
4+
5+
### Synopsis
6+
7+
Manage the lifecycle of server images.
8+
9+
```
10+
stackit beta image [flags]
11+
```
12+
13+
### Options
14+
15+
```
16+
-h, --help Help for "stackit beta image"
17+
```
18+
19+
### Options inherited from parent commands
20+
21+
```
22+
-y, --assume-yes If set, skips all confirmation prompts
23+
--async If set, runs the command asynchronously
24+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
25+
-p, --project-id string Project ID
26+
--region string Target region for region-specific requests
27+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
28+
```
29+
30+
### SEE ALSO
31+
32+
* [stackit beta](./stackit_beta.md) - Contains beta STACKIT CLI commands
33+
* [stackit beta image create](./stackit_beta_image_create.md) - Creates images
34+
* [stackit beta image delete](./stackit_beta_image_delete.md) - Deletes an image
35+
* [stackit beta image describe](./stackit_beta_image_describe.md) - Describes image
36+
* [stackit beta image list](./stackit_beta_image_list.md) - Lists images
37+
* [stackit beta image update](./stackit_beta_image_update.md) - Updates an image
38+

docs/stackit_beta_image_create.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
## stackit beta image create
2+
3+
Creates images
4+
5+
### Synopsis
6+
7+
Creates images.
8+
9+
```
10+
stackit beta image create [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Create an image with name 'my-new-image' from a raw disk image located in '/my/raw/image'
17+
$ stackit beta image create --name my-new-image --disk-format=raw --local-file-path=/my/raw/image
18+
19+
Create an image with name 'my-new-image' from a qcow2 image read from '/my/qcow2/image' with labels describing its contents
20+
$ stackit beta image create --name my-new-image --disk-format=qcow2 --local-file-path=/my/qcow2/image --labels os=linux,distro=alpine,version=3.12
21+
```
22+
23+
### Options
24+
25+
```
26+
--boot-menu Enables the BIOS bootmenu.
27+
--cdrom-bus string Sets CDROM bus controller type.
28+
--disk-bus string Sets Disk bus controller type.
29+
--disk-format string The disk format of the image.
30+
-h, --help Help for "stackit beta image create"
31+
--labels stringToString Labels are key-value string pairs which can be attached to a network-interface. E.g. '--labels key1=value1,key2=value2,...' (default [])
32+
--local-file-path string The path to the local disk image file.
33+
--min-disk-size int Size in Gigabyte.
34+
--min-ram int Size in Megabyte.
35+
--name string The name of the image.
36+
--nic-model string Sets virtual nic model.
37+
--no-progress Show no progress indicator for upload.
38+
--os string Enables OS specific optimizations.
39+
--os-distro string Operating System Distribution.
40+
--os-version string Version of the OS.
41+
--protected Protected VM.
42+
--rescue-bus string Sets the device bus when the image is used as a rescue image.
43+
--rescue-device string Sets the device when the image is used as a rescue image.
44+
--secure-boot Enables Secure Boot.
45+
--uefi Enables UEFI boot.
46+
--video-model string Sets Graphic device model.
47+
--virtio-scsi Enables the use of VirtIO SCSI to provide block device access. By default instances use VirtIO Block.
48+
```
49+
50+
### Options inherited from parent commands
51+
52+
```
53+
-y, --assume-yes If set, skips all confirmation prompts
54+
--async If set, runs the command asynchronously
55+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
56+
-p, --project-id string Project ID
57+
--region string Target region for region-specific requests
58+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
59+
```
60+
61+
### SEE ALSO
62+
63+
* [stackit beta image](./stackit_beta_image.md) - Manage server images
64+

docs/stackit_beta_image_delete.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## stackit beta image delete
2+
3+
Deletes an image
4+
5+
### Synopsis
6+
7+
Deletes an image by its internal ID.
8+
9+
```
10+
stackit beta image delete IMAGE_ID [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Delete an image with ID "xxx"
17+
$ stackit beta image delete xxx
18+
```
19+
20+
### Options
21+
22+
```
23+
-h, --help Help for "stackit beta image delete"
24+
```
25+
26+
### Options inherited from parent commands
27+
28+
```
29+
-y, --assume-yes If set, skips all confirmation prompts
30+
--async If set, runs the command asynchronously
31+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
32+
-p, --project-id string Project ID
33+
--region string Target region for region-specific requests
34+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
35+
```
36+
37+
### SEE ALSO
38+
39+
* [stackit beta image](./stackit_beta_image.md) - Manage server images
40+

docs/stackit_beta_image_describe.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## stackit beta image describe
2+
3+
Describes image
4+
5+
### Synopsis
6+
7+
Describes an image by its internal ID.
8+
9+
```
10+
stackit beta image describe IMAGE_ID [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Describe image "xxx"
17+
$ stackit beta image describe xxx
18+
```
19+
20+
### Options
21+
22+
```
23+
-h, --help Help for "stackit beta image describe"
24+
```
25+
26+
### Options inherited from parent commands
27+
28+
```
29+
-y, --assume-yes If set, skips all confirmation prompts
30+
--async If set, runs the command asynchronously
31+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
32+
-p, --project-id string Project ID
33+
--region string Target region for region-specific requests
34+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
35+
```
36+
37+
### SEE ALSO
38+
39+
* [stackit beta image](./stackit_beta_image.md) - Manage server images
40+

docs/stackit_beta_image_list.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
## stackit beta image list
2+
3+
Lists images
4+
5+
### Synopsis
6+
7+
Lists images by their internal ID.
8+
9+
```
10+
stackit beta image list [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
List all images
17+
$ stackit beta image list
18+
19+
List images with label
20+
$ stackit beta image list --label-selector ARM64,dev
21+
22+
List the first 10 images
23+
$ stackit beta image list --limit=10
24+
```
25+
26+
### Options
27+
28+
```
29+
-h, --help Help for "stackit beta image list"
30+
--label-selector string Filter by label
31+
--limit int Limit the output to the first n elements
32+
```
33+
34+
### Options inherited from parent commands
35+
36+
```
37+
-y, --assume-yes If set, skips all confirmation prompts
38+
--async If set, runs the command asynchronously
39+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
40+
-p, --project-id string Project ID
41+
--region string Target region for region-specific requests
42+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
43+
```
44+
45+
### SEE ALSO
46+
47+
* [stackit beta image](./stackit_beta_image.md) - Manage server images
48+

docs/stackit_beta_image_update.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
## stackit beta image update
2+
3+
Updates an image
4+
5+
### Synopsis
6+
7+
Updates an image
8+
9+
```
10+
stackit beta image update IMAGE_ID [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Update the name of an image with ID "xxx"
17+
$ stackit beta image update xxx --name my-new-name
18+
19+
Update the labels of an image with ID "xxx"
20+
$ stackit beta image update xxx --labels label1=value1,label2=value2
21+
```
22+
23+
### Options
24+
25+
```
26+
--boot-menu Enables the BIOS bootmenu.
27+
--cdrom-bus string Sets CDROM bus controller type.
28+
--disk-bus string Sets Disk bus controller type.
29+
--disk-format string The disk format of the image.
30+
-h, --help Help for "stackit beta image update"
31+
--labels stringToString Labels are key-value string pairs which can be attached to a network-interface. E.g. '--labels key1=value1,key2=value2,...' (default [])
32+
--local-file-path string The path to the local disk image file.
33+
--min-disk-size int Size in Gigabyte.
34+
--min-ram int Size in Megabyte.
35+
--name string The name of the image.
36+
--nic-model string Sets virtual nic model.
37+
--os string Enables OS specific optimizations.
38+
--os-distro string Operating System Distribution.
39+
--os-version string Version of the OS.
40+
--protected Protected VM.
41+
--rescue-bus string Sets the device bus when the image is used as a rescue image.
42+
--rescue-device string Sets the device when the image is used as a rescue image.
43+
--secure-boot Enables Secure Boot.
44+
--uefi Enables UEFI boot.
45+
--video-model string Sets Graphic device model.
46+
--virtio-scsi Enables the use of VirtIO SCSI to provide block device access. By default instances use VirtIO Block.
47+
```
48+
49+
### Options inherited from parent commands
50+
51+
```
52+
-y, --assume-yes If set, skips all confirmation prompts
53+
--async If set, runs the command asynchronously
54+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
55+
-p, --project-id string Project ID
56+
--region string Target region for region-specific requests
57+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
58+
```
59+
60+
### SEE ALSO
61+
62+
* [stackit beta image](./stackit_beta_image.md) - Manage server images
63+

docs/stackit_ske_kubeconfig_create.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ stackit ske kubeconfig create CLUSTER_NAME [flags]
3333
Create a kubeconfig for the SKE cluster with name "my-cluster" in a custom filepath
3434
$ stackit ske kubeconfig create my-cluster --filepath /path/to/config
3535
36-
Get a kubeconfig for the SKE cluster with name "my-cluster" without writing it to a file.
37-
36+
Get a kubeconfig for the SKE cluster with name "my-cluster" without writing it to a file and format the output as json
37+
$ stackit ske kubeconfig create my-cluster --disable-writing --output-format json
3838
```
3939

4040
### Options
4141

4242
```
43-
--disable-writing Disable writing to the kubeconfig file.
43+
--disable-writing Disable the writing of kubeconfig. Set the output format to json or yaml using the --output-format flag to display the kubeconfig.
4444
-e, --expiration string Expiration time for the kubeconfig in seconds(s), minutes(m), hours(h), days(d) or months(M). Example: 30d. By default, expiration time is 1h
4545
--filepath string Path to create the kubeconfig file. By default, the kubeconfig is created as 'config' in the .kube folder, in the user's home directory.
4646
-h, --help Help for "stackit ske kubeconfig create"

internal/cmd/beta/beta.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package beta
33
import (
44
"fmt"
55

6+
image "github.com/stackitcloud/stackit-cli/internal/cmd/beta/image"
67
keypair "github.com/stackitcloud/stackit-cli/internal/cmd/beta/key-pair"
78
"github.com/stackitcloud/stackit-cli/internal/cmd/beta/network"
89
networkArea "github.com/stackitcloud/stackit-cli/internal/cmd/beta/network-area"
@@ -52,4 +53,5 @@ func addSubcommands(cmd *cobra.Command, p *print.Printer) {
5253
cmd.AddCommand(publicip.NewCmd(p))
5354
cmd.AddCommand(securitygroup.NewCmd(p))
5455
cmd.AddCommand(keypair.NewCmd(p))
56+
cmd.AddCommand(image.NewCmd(p))
5557
}

0 commit comments

Comments
 (0)