Skip to content

Commit

Permalink
Support for IaaS images (#559)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
bahkauv70 and marceljk authored Jan 15, 2025
1 parent bc4c8c6 commit b39e32c
Show file tree
Hide file tree
Showing 24 changed files with 2,896 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Below you can find a list of the STACKIT services already available in the CLI (
| Service | CLI Commands | Status |
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
| Observability | `observability` | :white_check_mark: |
| 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) |
| 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)|
| Authorization | `project`, `organization` | :white_check_mark: |
| DNS | `dns` | :white_check_mark: |
| Kubernetes Engine (SKE) | `ske` | :white_check_mark: |
Expand Down
1 change: 1 addition & 0 deletions docs/stackit_beta.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ stackit beta [flags]
### SEE ALSO

* [stackit](./stackit.md) - Manage STACKIT resources using the command line
* [stackit beta image](./stackit_beta_image.md) - Manage server images
* [stackit beta key-pair](./stackit_beta_key-pair.md) - Provides functionality for SSH key pairs
* [stackit beta network](./stackit_beta_network.md) - Provides functionality for networks
* [stackit beta network-area](./stackit_beta_network-area.md) - Provides functionality for STACKIT Network Area (SNA)
Expand Down
38 changes: 38 additions & 0 deletions docs/stackit_beta_image.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## stackit beta image

Manage server images

### Synopsis

Manage the lifecycle of server images.

```
stackit beta image [flags]
```

### Options

```
-h, --help Help for "stackit beta image"
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
-p, --project-id string Project ID
--region string Target region for region-specific requests
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit beta](./stackit_beta.md) - Contains beta STACKIT CLI commands
* [stackit beta image create](./stackit_beta_image_create.md) - Creates images
* [stackit beta image delete](./stackit_beta_image_delete.md) - Deletes an image
* [stackit beta image describe](./stackit_beta_image_describe.md) - Describes image
* [stackit beta image list](./stackit_beta_image_list.md) - Lists images
* [stackit beta image update](./stackit_beta_image_update.md) - Updates an image

64 changes: 64 additions & 0 deletions docs/stackit_beta_image_create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
## stackit beta image create

Creates images

### Synopsis

Creates images.

```
stackit beta image create [flags]
```

### Examples

```
Create an image with name 'my-new-image' from a raw disk image located in '/my/raw/image'
$ stackit beta image create --name my-new-image --disk-format=raw --local-file-path=/my/raw/image
Create an image with name 'my-new-image' from a qcow2 image read from '/my/qcow2/image' with labels describing its contents
$ 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
```

### Options

```
--boot-menu Enables the BIOS bootmenu.
--cdrom-bus string Sets CDROM bus controller type.
--disk-bus string Sets Disk bus controller type.
--disk-format string The disk format of the image.
-h, --help Help for "stackit beta image create"
--labels stringToString Labels are key-value string pairs which can be attached to a network-interface. E.g. '--labels key1=value1,key2=value2,...' (default [])
--local-file-path string The path to the local disk image file.
--min-disk-size int Size in Gigabyte.
--min-ram int Size in Megabyte.
--name string The name of the image.
--nic-model string Sets virtual nic model.
--no-progress Show no progress indicator for upload.
--os string Enables OS specific optimizations.
--os-distro string Operating System Distribution.
--os-version string Version of the OS.
--protected Protected VM.
--rescue-bus string Sets the device bus when the image is used as a rescue image.
--rescue-device string Sets the device when the image is used as a rescue image.
--secure-boot Enables Secure Boot.
--uefi Enables UEFI boot.
--video-model string Sets Graphic device model.
--virtio-scsi Enables the use of VirtIO SCSI to provide block device access. By default instances use VirtIO Block.
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
-p, --project-id string Project ID
--region string Target region for region-specific requests
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit beta image](./stackit_beta_image.md) - Manage server images

40 changes: 40 additions & 0 deletions docs/stackit_beta_image_delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## stackit beta image delete

Deletes an image

### Synopsis

Deletes an image by its internal ID.

```
stackit beta image delete IMAGE_ID [flags]
```

### Examples

```
Delete an image with ID "xxx"
$ stackit beta image delete xxx
```

### Options

```
-h, --help Help for "stackit beta image delete"
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
-p, --project-id string Project ID
--region string Target region for region-specific requests
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit beta image](./stackit_beta_image.md) - Manage server images

40 changes: 40 additions & 0 deletions docs/stackit_beta_image_describe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## stackit beta image describe

Describes image

### Synopsis

Describes an image by its internal ID.

```
stackit beta image describe IMAGE_ID [flags]
```

### Examples

```
Describe image "xxx"
$ stackit beta image describe xxx
```

### Options

```
-h, --help Help for "stackit beta image describe"
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
-p, --project-id string Project ID
--region string Target region for region-specific requests
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit beta image](./stackit_beta_image.md) - Manage server images

48 changes: 48 additions & 0 deletions docs/stackit_beta_image_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
## stackit beta image list

Lists images

### Synopsis

Lists images by their internal ID.

```
stackit beta image list [flags]
```

### Examples

```
List all images
$ stackit beta image list
List images with label
$ stackit beta image list --label-selector ARM64,dev
List the first 10 images
$ stackit beta image list --limit=10
```

### Options

```
-h, --help Help for "stackit beta image list"
--label-selector string Filter by label
--limit int Limit the output to the first n elements
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
-p, --project-id string Project ID
--region string Target region for region-specific requests
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit beta image](./stackit_beta_image.md) - Manage server images

63 changes: 63 additions & 0 deletions docs/stackit_beta_image_update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
## stackit beta image update

Updates an image

### Synopsis

Updates an image

```
stackit beta image update IMAGE_ID [flags]
```

### Examples

```
Update the name of an image with ID "xxx"
$ stackit beta image update xxx --name my-new-name
Update the labels of an image with ID "xxx"
$ stackit beta image update xxx --labels label1=value1,label2=value2
```

### Options

```
--boot-menu Enables the BIOS bootmenu.
--cdrom-bus string Sets CDROM bus controller type.
--disk-bus string Sets Disk bus controller type.
--disk-format string The disk format of the image.
-h, --help Help for "stackit beta image update"
--labels stringToString Labels are key-value string pairs which can be attached to a network-interface. E.g. '--labels key1=value1,key2=value2,...' (default [])
--local-file-path string The path to the local disk image file.
--min-disk-size int Size in Gigabyte.
--min-ram int Size in Megabyte.
--name string The name of the image.
--nic-model string Sets virtual nic model.
--os string Enables OS specific optimizations.
--os-distro string Operating System Distribution.
--os-version string Version of the OS.
--protected Protected VM.
--rescue-bus string Sets the device bus when the image is used as a rescue image.
--rescue-device string Sets the device when the image is used as a rescue image.
--secure-boot Enables Secure Boot.
--uefi Enables UEFI boot.
--video-model string Sets Graphic device model.
--virtio-scsi Enables the use of VirtIO SCSI to provide block device access. By default instances use VirtIO Block.
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
-p, --project-id string Project ID
--region string Target region for region-specific requests
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit beta image](./stackit_beta_image.md) - Manage server images

6 changes: 3 additions & 3 deletions docs/stackit_ske_kubeconfig_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ stackit ske kubeconfig create CLUSTER_NAME [flags]
Create a kubeconfig for the SKE cluster with name "my-cluster" in a custom filepath
$ stackit ske kubeconfig create my-cluster --filepath /path/to/config
Get a kubeconfig for the SKE cluster with name "my-cluster" without writing it to a file.
Get a kubeconfig for the SKE cluster with name "my-cluster" without writing it to a file and format the output as json
$ stackit ske kubeconfig create my-cluster --disable-writing --output-format json
```

### Options

```
--disable-writing Disable writing to the kubeconfig file.
--disable-writing Disable the writing of kubeconfig. Set the output format to json or yaml using the --output-format flag to display the kubeconfig.
-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
--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.
-h, --help Help for "stackit ske kubeconfig create"
Expand Down
2 changes: 2 additions & 0 deletions internal/cmd/beta/beta.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package beta
import (
"fmt"

image "github.com/stackitcloud/stackit-cli/internal/cmd/beta/image"
keypair "github.com/stackitcloud/stackit-cli/internal/cmd/beta/key-pair"
"github.com/stackitcloud/stackit-cli/internal/cmd/beta/network"
networkArea "github.com/stackitcloud/stackit-cli/internal/cmd/beta/network-area"
Expand Down Expand Up @@ -52,4 +53,5 @@ func addSubcommands(cmd *cobra.Command, p *print.Printer) {
cmd.AddCommand(publicip.NewCmd(p))
cmd.AddCommand(securitygroup.NewCmd(p))
cmd.AddCommand(keypair.NewCmd(p))
cmd.AddCommand(image.NewCmd(p))
}
Loading

0 comments on commit b39e32c

Please sign in to comment.