diff --git a/config/Config.md b/config/Config.md index 0b2bd73f..41bbf322 100644 --- a/config/Config.md +++ b/config/Config.md @@ -58,14 +58,14 @@ The order they are applied is: ### Mode -| | | -| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| name | mode | -| usage | Scaling target mode is either job based, aws Ec2 or data-center (worker/ instance) based scaling. In data-center (dc) mode the nomad workers will be scaled. In job mode the number of allocations for this job will be adjusted. | -| type | string (enum: nomad-job \| nomad-dc \| aws-ec2 ) - **the values job and dc are deprecated** | -| default | job | -| flag | --sca.mode | -| env | SK_SCA_MODE | +| | | +| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| name | mode | +| usage | Scaling target mode is either nomad-job based, aws EC2 or nomad data-center (worker/ instance) based scaling. In data-center (`noamd-dc`) mode the nomad workers will be scaled. In `nomad-job` mode the number of allocations for this job will be adjusted. In `aws-ec2` mode AWS instances will be scaled adjusting the according AutoScalingGroup. | +| type | string (enum: nomad-job \| nomad-dc \| aws-ec2 ) | +| default | job | +| flag | --sca.mode | +| env | SK_SCA_MODE | ### AWS EC2 @@ -108,19 +108,6 @@ The order they are applied is: - This section contains the configuration parameters for nomad based scalers (i.e. job or data-center on AWS). -#### [DEPRECATED] Mode - -- The parameter `sca.nomad.mode` will be replaced by `sca.mode` - -| | | -| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| name | mode | -| usage | Scaling target mode is either job based or data-center (worker/ instance) based scaling. In data-center (dc) mode the nomad workers will be scaled. In job mode the number of allocations for this job will be adjusted. | -| type | string (enum: job \| dc ) | -| default | job | -| flag | --sca.nomad.mode | -| env | SK_SCA_NOMAD_MODE | - #### Server-Address | | | diff --git a/config/entries.go b/config/entries.go index 334bb5ce..9a99ff7b 100644 --- a/config/entries.go +++ b/config/entries.go @@ -29,15 +29,6 @@ var port = configEntry{ } // ###################### Context: scaler #################################################### -// TODO: DEPRECATED, remove it -var scaNomadMode = configEntry{ - name: "sca.nomad.mode", - bindEnv: true, - bindFlag: true, - defaultValue: "", - usage: "Scaling target mode is either job based or data-center (worker/ instance) based scaling. In data-center (dc) mode the nomad workers will be scaled. In job mode the number of allocations for this job will be adjusted.", -} - var scaMode = configEntry{ name: "sca.mode", bindEnv: true, @@ -294,7 +285,6 @@ var configEntries = []configEntry{ scaAWSEC2ASGTagKey, scaNomadDataCenterAWSProfile, scaNomadDataCenterAWSRegion, - scaNomadMode, scaNomadModeServerAddress, capConstantModeEnable, capConstantModeOffset, diff --git a/config/fillCfg.go b/config/fillCfg.go index f4d5cc04..6892487b 100644 --- a/config/fillCfg.go +++ b/config/fillCfg.go @@ -20,16 +20,6 @@ func (cfg *Config) fillScaler() error { } cfg.Scaler.Mode = scaMode - // TODO: DEPRECATED, Remove it - scaNomadModeStr := cfg.viper.GetString(scaNomadMode.name) - if len(scaNomadModeStr) > 0 { - scaMode, err = strToScalerMode(scaNomadModeStr) - if err != nil { - return err - } - cfg.Scaler.Mode = scaMode - } - // Context: Scaler - AWS EC2 cfg.Scaler.AwsEc2.Profile = cfg.viper.GetString(scaAWSEC2Profile.name) cfg.Scaler.AwsEc2.Region = cfg.viper.GetString(scaAWSEC2Region.name) diff --git a/config/fillCfg_test.go b/config/fillCfg_test.go index c491efbf..d67384d5 100644 --- a/config/fillCfg_test.go +++ b/config/fillCfg_test.go @@ -300,42 +300,6 @@ func Test_StrToScalerMode(t *testing.T) { assert.Equal(t, ScalerModeAwsEc2, mode) } -// TODO: Remove as soon as the sca.nomad.mode flag has been removed -func Test_FillCfg_SupportDeprecatedFlags(t *testing.T) { - - cfg := NewDefaultConfig() - args := []string{ - "--sca.nomad.mode=aws-ec2", - "--sca.mode=job", - } - - err := cfg.ReadConfig(args) - assert.NoError(t, err) - assert.Equal(t, ScalerModeAwsEc2, cfg.Scaler.Mode) - - // old job - cfg = NewDefaultConfig() - args = []string{ - "--sca.mode=job", - "--sca.nomad.server-address=http://1.2.3.4", - } - - err = cfg.ReadConfig(args) - assert.NoError(t, err) - assert.Equal(t, ScalerModeNomadJob, cfg.Scaler.Mode) - - // old dc - cfg = NewDefaultConfig() - args = []string{ - "--sca.mode=dc", - "--sca.nomad.server-address=http://1.2.3.4", - } - - err = cfg.ReadConfig(args) - assert.NoError(t, err) - assert.Equal(t, ScalerModeNomadDataCenter, cfg.Scaler.Mode) -} - func Test_ValidateCapacityPlanner(t *testing.T) { capacityPlanner := CapacityPlanner{} err := validateCapacityPlanner(capacityPlanner) diff --git a/vendor/github.com/spf13/viper/go.mod b/vendor/github.com/spf13/viper/go.mod index 27943005..43997357 100644 --- a/vendor/github.com/spf13/viper/go.mod +++ b/vendor/github.com/spf13/viper/go.mod @@ -41,3 +41,5 @@ require ( google.golang.org/grpc v1.21.0 // indirect gopkg.in/yaml.v2 v2.2.2 ) + +go 1.13