Skip to content

Commit

Permalink
Use autoscaler workers from env
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Paskal <[email protected]>
  • Loading branch information
maksim-paskal committed Nov 18, 2024
1 parent 9c816b6 commit 191c02e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 8 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"os/user"
"path/filepath"
"regexp"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -126,12 +127,18 @@ func getDefaultClusterAutoscaler() map[interface{}]interface{} {
defaultServers = append(defaultServers, strings.Split(instances, ",")...)
}

workersMaxSize := 20

if workersCountEnv, err := strconv.Atoi(os.Getenv("AUTOSCALER_WORKERS_MAX")); err == nil && workersCountEnv > 0 {
workersMaxSize = workersCountEnv
}

for _, location := range defaultLocations {
for _, server := range defaultServers {
result = append(result, &clusterAutoscalingGroup{
Name: fmt.Sprintf("%s-%s", server, location),
MinSize: 0,
MaxSize: workersCount,
MaxSize: workersMaxSize,
InstanceType: server,
Region: location,
})
Expand Down
1 change: 0 additions & 1 deletion pkg/config/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import "time"

const (
masterServersCount = 3
workersCount = 20
loadBalancerDefaultPort = 6443
waitTimeInRetry = 3 * time.Second
retryTimeLimit = 20
Expand Down

0 comments on commit 191c02e

Please sign in to comment.