Skip to content

Commit

Permalink
feat: Add spot instances support for azure
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Riobo Lorenzo <[email protected]>
  • Loading branch information
adrianriobo committed Sep 18, 2023
1 parent 255fb0f commit ebd4951
Show file tree
Hide file tree
Showing 677 changed files with 91,857 additions and 29,491 deletions.
8 changes: 6 additions & 2 deletions cmd/cmd/azure/windows/windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (
defaultLocation = "West US"
paramVMSize = "vmsize"
paramVMSizeDesc = "size for the VM. Type requires to allow nested virtualization"
defaultVMSize = "Standard_D4_v5"
defaultVMSize = "Standard_D8a_v4"
paramVersion = "windows-version"
paramVersionDesc = "Major version for windows desktop 10 or 11"
defaultVersion = "11"
Expand All @@ -32,6 +32,8 @@ const (
paramAdminUsername = "admin-username"
paramAdminUsernameDesc = "username for admin user. Only rdp accessible within generated password"
defaultAdminUsername = "rhqpadmin"
paramSpot = "spot"
paramSpotDesc = "if spot is set the spot prices across all regions will be cheked and machine will be started on best spot option (price / eviction)"
)

func GetCmd() *cobra.Command {
Expand Down Expand Up @@ -72,7 +74,8 @@ func getCreate() *cobra.Command {
Version: viper.GetString(paramVersion),
Feature: viper.GetString(paramFeature),
Username: viper.GetString(paramUsername),
AdminUsername: viper.GetString(paramAdminUsername)}); err != nil {
AdminUsername: viper.GetString(paramAdminUsername),
Spot: viper.IsSet(paramSpot)}); err != nil {
logging.Error(err)
}
return nil
Expand All @@ -87,6 +90,7 @@ func getCreate() *cobra.Command {
flagSet.StringP(paramFeature, "", defaultFeature, paramFeatureDesc)
flagSet.StringP(paramUsername, "", defaultUsername, paramUsernameDesc)
flagSet.StringP(paramAdminUsername, "", defaultAdminUsername, paramAdminUsernameDesc)
flagSet.Bool(paramSpot, false, paramSpotDesc)
c.PersistentFlags().AddFlagSet(flagSet)
return c
}
Expand Down
12 changes: 7 additions & 5 deletions docs/azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ It creates / destroy a windows dekstop edition ready to be included within the C
This will create a windows desktop accordig to params specificed:

```bash
podman run -it --rm quay.io/rhqp/qenvs:0.0.4 azure windows create -h
podman run -it --rm quay.io/rhqp/qenvs:v0.0.5-dev azure windows create -h
create

Usage:
Expand All @@ -31,9 +31,10 @@ Flags:
--conn-details-output string path to export host connection information (host, username and privateKey)
-h, --help help for create
--location string location for created resources within Windows desktop (default "West US")
--spot if spot is set the spot prices across all regions will be cheked and machine will be started on best spot option (price / eviction)
--tags stringToString tags to add on each resource (--tags name1=value1,name2=value2) (default [])
--username string username for general user. SSH accessible + rdp with generated password (default "rhqp")
--vmsize string size for the VM. Type requires to allow nested virtualization (default "Standard_D4_v5")
--vmsize string size for the VM. Type requires to allow nested virtualization (default "Standard_D8a_v4")
--windows-featurepack string windows feature pack (default "22h2-pro")
--windows-version string Major version for windows desktop 10 or 11 (default "11")

Expand Down Expand Up @@ -63,11 +64,12 @@ podman run -d --rm \
-e ARM_SUBSCRIPTION_ID=${asi_value} \
-e ARM_CLIENT_ID=${aci_value} \
-e ARM_CLIENT_SECRET=${acs_lue} \
quay.io/rhqp/qenvs:0.0.4 azure \
quay.io/rhqp/qenvs:v0.0.5-dev azure \
windows create \
--project-name "win-desk-11" \
--backed-url "file:///workspace" \
--conn-details-output "/workspace"
--conn-details-output "/workspace" \
--spot
```
The following is a snipped on how to destroy the resources:
Expand All @@ -79,7 +81,7 @@ podman run -d --rm \
-e ARM_SUBSCRIPTION_ID=${asi_value} \
-e ARM_CLIENT_ID=${aci_value} \
-e ARM_CLIENT_SECRET=${acs_lue} \
quay.io/rhqp/qenvs:0.0.4 azure \
quay.io/rhqp/qenvs:v0.0.5-dev azure \
windows destroy \
--project-name "win-desk-11" \
--backed-url "file:///workspace"
Expand Down
30 changes: 21 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ require (
github.com/coocood/freecache v1.2.2
// github.com/pulumi/pulumi-aws-native/sdk
github.com/pulumi/pulumi-aws/sdk/v5 v5.30.0
github.com/pulumi/pulumi-azure-native-sdk/compute v1.98.1
github.com/pulumi/pulumi-azure-native-sdk/network v1.98.1
github.com/pulumi/pulumi-azure-native-sdk/resources v1.98.1
github.com/pulumi/pulumi-azure-native-sdk/storage v1.99.1
github.com/pulumi/pulumi-command/sdk v0.7.1
github.com/pulumi/pulumi-random/sdk/v4 v4.11.2
github.com/pulumi/pulumi-tls/sdk/v4 v4.10.0
Expand All @@ -21,16 +17,32 @@ require (
)

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0-beta.1
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.8.1
github.com/pulumi/pulumi-azure-native-sdk/compute/v2 v2.6.0
github.com/pulumi/pulumi-azure-native-sdk/network/v2 v2.6.0
github.com/pulumi/pulumi-azure-native-sdk/resources/v2 v2.6.0
github.com/pulumi/pulumi-azure-native-sdk/storage/v2 v2.6.0
)

require (
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cloudflare/circl v1.1.0 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/pjbgf/sha1cd v0.2.3 // indirect
github.com/pulumi/pulumi-azure-native-sdk v1.99.1 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/pulumi/pulumi-azure-native-sdk/v2 v2.6.0 // indirect
github.com/santhosh-tekuri/jsonschema/v5 v5.0.0 // indirect
github.com/skeema/knownhosts v1.1.0 // indirect
github.com/spf13/afero v1.8.2 // indirect
Expand Down Expand Up @@ -84,11 +96,11 @@ require (
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
go.uber.org/atomic v1.9.0 // indirect
golang.org/x/crypto v0.3.0 // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/crypto v0.6.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
golang.org/x/term v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
google.golang.org/genproto v0.0.0-20220802133213-ce4fa296bf78 // indirect
google.golang.org/grpc v1.51.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
Expand Down
Loading

0 comments on commit ebd4951

Please sign in to comment.