Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spot module as a separate package #284

Merged
merged 3 commits into from
Sep 25, 2024
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
10 changes: 5 additions & 5 deletions cmd/mapt/cmd/azure/hosts/linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/redhat-developer/mapt/pkg/provider/util/instancetypes"
"github.com/redhat-developer/mapt/pkg/util"

spotprice "github.com/redhat-developer/mapt/pkg/provider/azure/module/spot-price"
spotAzure "github.com/redhat-developer/mapt/pkg/spot/azure"
"github.com/redhat-developer/mapt/pkg/util/logging"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
Expand Down Expand Up @@ -69,11 +69,11 @@ func getCreateLinux(ostype azureLinux.OSType, defaultOSVersion string) *cobra.Co
viper.GetStringMapString(params.Tags))

// ParseEvictionRate
var spotToleranceValue = spotprice.DefaultEvictionRate
if viper.IsSet(azparams.ParamSpotTolerance) {
var spotToleranceValue = spotAzure.DefaultEvictionRate
if viper.IsSet(paramSpotTolerance) {
var ok bool
spotToleranceValue, ok = spotprice.ParseEvictionRate(
viper.GetString(azparams.ParamSpotTolerance))
spotToleranceValue, ok = spotAzure.ParseEvictionRate(
viper.GetString(paramSpotTolerance))
if !ok {
return fmt.Errorf("%s is not a valid spot tolerance value", viper.GetString(azparams.ParamSpotTolerance))
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/mapt/cmd/azure/hosts/windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
params "github.com/redhat-developer/mapt/cmd/mapt/cmd/constants"
maptContext "github.com/redhat-developer/mapt/pkg/manager/context"
azureWindows "github.com/redhat-developer/mapt/pkg/provider/azure/action/windows"
spotprice "github.com/redhat-developer/mapt/pkg/provider/azure/module/spot-price"
"github.com/redhat-developer/mapt/pkg/provider/util/instancetypes"
spotAzure "github.com/redhat-developer/mapt/pkg/spot/azure"
"github.com/redhat-developer/mapt/pkg/util/ghactions"
"github.com/redhat-developer/mapt/pkg/util/logging"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -65,11 +65,11 @@ func getCreateWindowsDesktop() *cobra.Command {
viper.GetStringMapString(params.Tags))

// ParseEvictionRate
var spotToleranceValue = spotprice.DefaultEvictionRate
if viper.IsSet(azparams.ParamSpotTolerance) {
var spotToleranceValue = spotAzure.DefaultEvictionRate
if viper.IsSet(paramSpotTolerance) {
var ok bool
spotToleranceValue, ok = spotprice.ParseEvictionRate(
viper.GetString(azparams.ParamSpotTolerance))
spotToleranceValue, ok = spotAzure.ParseEvictionRate(
viper.GetString(paramSpotTolerance))
if !ok {
return fmt.Errorf("%s is not a valid spot tolerance value", viper.GetString(azparams.ParamSpotTolerance))
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/mapt/cmd/azure/services/aks.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
params "github.com/redhat-developer/mapt/cmd/mapt/cmd/constants"
maptContext "github.com/redhat-developer/mapt/pkg/manager/context"
azureAKS "github.com/redhat-developer/mapt/pkg/provider/azure/action/aks"
spotprice "github.com/redhat-developer/mapt/pkg/provider/azure/module/spot-price"
spotAzure "github.com/redhat-developer/mapt/pkg/spot/azure"
"github.com/redhat-developer/mapt/pkg/util/logging"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
Expand Down Expand Up @@ -57,10 +57,10 @@ func getCreateAKS() *cobra.Command {
viper.GetStringMapString(params.Tags))

// ParseEvictionRate
var spotToleranceValue = spotprice.DefaultEvictionRate
var spotToleranceValue = spotAzure.DefaultEvictionRate
if viper.IsSet(azparams.ParamSpotTolerance) {
var ok bool
spotToleranceValue, ok = spotprice.ParseEvictionRate(
spotToleranceValue, ok = spotAzure.ParseEvictionRate(
viper.GetString(azparams.ParamSpotTolerance))
if !ok {
return fmt.Errorf("%s is not a valid spot tolerance value", viper.GetString(azparams.ParamSpotTolerance))
Expand Down
69 changes: 69 additions & 0 deletions examples/spotprice/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
module spotprice

go 1.21

require github.com/redhat-developer/mapt v0.6.9

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6 v6.0.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.9.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
github.com/atotto/clipboard v0.1.4 // indirect
github.com/aws/amazon-ec2-instance-selector/v2 v2.4.2-0.20231006140257-d989c5d76f0e // indirect
github.com/aws/aws-sdk-go v1.45.6 // indirect
github.com/aws/aws-sdk-go-v2 v1.27.2 // indirect
github.com/aws/aws-sdk-go-v2/config v1.27.18 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.18 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ec2 v1.142.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11 // indirect
github.com/aws/aws-sdk-go-v2/service/pricing v1.21.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.20.11 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.5 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.28.12 // indirect
github.com/aws/smithy-go v1.20.2 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/charmbracelet/bubbles v0.16.1 // indirect
github.com/charmbracelet/bubbletea v0.25.0 // indirect
github.com/charmbracelet/lipgloss v0.7.1 // indirect
github.com/containerd/console v1.0.4 // indirect
github.com/evertras/bubble-table v0.15.2 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/sahilm/fuzzy v0.1.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
)

replace github.com/redhat-developer/mapt => ../../
Loading