Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Remove cvm edit flag #204

Merged
merged 3 commits into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion coder-sdk/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ type UpdateEnvironmentReq struct {
GPUs *int `json:"gpus"`
Services *[]string `json:"services"`
CodeServerReleaseURL *string `json:"code_server_release_url"`
UseContainerVM *bool `json:"use_container_vm"`
}

// RebuildEnvironment requests that the given envID is rebuilt with no changes to its specification.
Expand Down
20 changes: 10 additions & 10 deletions docs/coder_envs_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ coder envs create my-new-powerful-env --cpu 12 --disk 100 --memory 16 --image ub
### Options

```
--container-vm deploy the environment as a Container-based VM
-c, --cpu float32 number of cpu cores the environment should be provisioned with.
-d, --disk int GB of disk storage an environment should be provisioned with.
--follow follow buildlog after initiating rebuild
-g, --gpus int number GPUs an environment should be provisioned with.
-h, --help help for create
-i, --image string name of the image to base the environment off of.
-m, --memory float32 GB of RAM an environment should be provisioned with.
-o, --org string name of the organization the environment should be created under.
-t, --tag string tag of the image the environment will be based off of. (default "latest")
--container-based-vm deploy the environment as a Container-based VM
-c, --cpu float32 number of cpu cores the environment should be provisioned with.
-d, --disk int GB of disk storage an environment should be provisioned with.
--follow follow buildlog after initiating rebuild
-g, --gpus int number GPUs an environment should be provisioned with.
-h, --help help for create
-i, --image string name of the image to base the environment off of.
-m, --memory float32 GB of RAM an environment should be provisioned with.
-o, --org string name of the organization the environment should be created under.
-t, --tag string tag of the image the environment will be based off of. (default "latest")
```

### Options inherited from parent commands
Expand Down
22 changes: 10 additions & 12 deletions docs/coder_envs_edit.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,16 @@ coder envs edit back-end-env --disk 20
### Options

```
--container-vm deploy the environment as a Container-based VM
-c, --cpu float32 The number of cpu cores the environment should be provisioned with.
-d, --disk int The amount of disk storage an environment should be provisioned with.
--follow follow buildlog after initiating rebuild
-g, --gpu int The amount of disk storage to provision the environment with.
-h, --help help for edit
-i, --image string name of the image you want the environment to be based off of.
-m, --memory float32 The amount of RAM an environment should be provisioned with.
--not-container-vm do not deploy the environment as a Container-based VM
-o, --org string name of the organization the environment should be created under.
-t, --tag string image tag of the image you want to base the environment off of. (default "latest")
--user string Specify the user whose resources to target (default "me")
-c, --cpu float32 The number of cpu cores the environment should be provisioned with.
-d, --disk int The amount of disk storage an environment should be provisioned with.
--follow follow buildlog after initiating rebuild
-g, --gpu int The amount of disk storage to provision the environment with.
-h, --help help for edit
-i, --image string name of the image you want the environment to be based off of.
-m, --memory float32 The amount of RAM an environment should be provisioned with.
-o, --org string name of the organization the environment should be created under.
-t, --tag string image tag of the image you want to base the environment off of. (default "latest")
--user string Specify the user whose resources to target (default "me")
```

### Options inherited from parent commands
Expand Down
22 changes: 1 addition & 21 deletions internal/cmd/envs.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ coder envs create my-new-powerful-env --cpu 12 --disk 100 --memory 16 --image ub
cmd.Flags().IntVarP(&gpus, "gpus", "g", 0, "number GPUs an environment should be provisioned with.")
cmd.Flags().StringVarP(&img, "image", "i", "", "name of the image to base the environment off of.")
cmd.Flags().BoolVar(&follow, "follow", false, "follow buildlog after initiating rebuild")
cmd.Flags().BoolVar(&useCVM, "container-vm", false, "deploy the environment as a Container-based VM")
cmd.Flags().BoolVar(&useCVM, "container-based-vm", false, "deploy the environment as a Container-based VM")
_ = cmd.MarkFlagRequired("image")
return cmd
}
Expand All @@ -260,8 +260,6 @@ func editEnvCmd() *cobra.Command {
disk int
gpus int
follow bool
useCVM bool
notCVM bool
user string
)

Expand Down Expand Up @@ -307,8 +305,6 @@ coder envs edit back-end-env --disk 20`,
image: img,
imageTag: tag,
orgName: org,
useCVM: useCVM,
notCVM: notCVM,
})
if err != nil {
return err
Expand Down Expand Up @@ -341,8 +337,6 @@ coder envs edit back-end-env --disk 20`,
cmd.Flags().IntVarP(&disk, "disk", "d", 0, "The amount of disk storage an environment should be provisioned with.")
cmd.Flags().IntVarP(&gpus, "gpu", "g", 0, "The amount of disk storage to provision the environment with.")
cmd.Flags().BoolVar(&follow, "follow", false, "follow buildlog after initiating rebuild")
cmd.Flags().BoolVar(&useCVM, "container-vm", false, "deploy the environment as a Container-based VM")
cmd.Flags().BoolVar(&notCVM, "not-container-vm", false, "do not deploy the environment as a Container-based VM")
cmd.Flags().StringVar(&user, "user", coder.Me, "Specify the user whose resources to target")
return cmd
}
Expand Down Expand Up @@ -412,12 +406,8 @@ type updateConf struct {
image string
imageTag string
orgName string
useCVM bool
notCVM bool
}

func boolP(a bool) *bool { return &a }

func buildUpdateReq(ctx context.Context, client *coder.Client, conf updateConf) (*coder.UpdateEnvironmentReq, error) {
var (
updateReq coder.UpdateEnvironmentReq
Expand All @@ -426,16 +416,6 @@ func buildUpdateReq(ctx context.Context, client *coder.Client, conf updateConf)
defaultDiskGB int
)

if conf.useCVM && conf.notCVM {
return nil, xerrors.New("--container-vm and --not-container-vm flags conflict")
}
if conf.useCVM {
updateReq.UseContainerVM = boolP(true)
}
if conf.notCVM {
updateReq.UseContainerVM = boolP(false)
}

// If this is not empty it means the user is requesting to change the environment image.
if conf.image != "" {
importedImg, err := findImg(ctx, client, findImgConf{
Expand Down