Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit 0085d06

Browse files
JackQuincyjackfrancis
authored andcommitted
Autoscale api model (#3586)
* adding fields to specify that we should autoscale a cluster. These will be user admin override due to these changes not being used in acs-engine and thus the tests don't test it.
1 parent ae9329e commit 0085d06

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

pkg/api/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,9 @@ type AgentPoolProfile struct {
450450
Extensions []Extension `json:"extensions"`
451451
KubernetesConfig *KubernetesConfig `json:"kubernetesConfig,omitempty"`
452452
ImageRef *ImageReference `json:"imageReference,omitempty"`
453+
MaxCount *int `json:"maxCount,omitempty"`
454+
MinCount *int `json:"minCount,omitempty"`
455+
EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"`
453456
}
454457

455458
// AgentPoolProfileRole represents an agent role

pkg/helpers/helpers.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ func PointerToBool(b bool) *bool {
6363
return &p
6464
}
6565

66+
// PointerToInt returns a pointer to a int
67+
func PointerToInt(i int) *int {
68+
p := i
69+
return &p
70+
}
71+
6672
// EqualError is a ni;-safe method which reports whether errors a and b are considered equal.
6773
// They're equal if both are nil, or both are not nil and a.Error() == b.Error().
6874
func EqualError(a, b error) bool {

pkg/helpers/helpers_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,23 @@ func TestPointerToBool(t *testing.T) {
8484
}
8585
}
8686

87+
func TestPointerToInt(t *testing.T) {
88+
int1 := 1
89+
int2 := 2
90+
ret1 := PointerToInt(int1)
91+
if *ret1 != int1 {
92+
t.Fatalf("expected PointerToInt(1) to return *1, instead returned %#v", ret1)
93+
}
94+
ret2 := PointerToInt(int2)
95+
if *ret2 != int2 {
96+
t.Fatalf("expected PointerToInt(2) to return *2, instead returned %#v", ret2)
97+
}
98+
99+
if *ret2 <= *ret1 {
100+
t.Fatalf("Pointers to ints messed up their values and made 2 <= 1")
101+
}
102+
}
103+
87104
func TestCreateSSH(t *testing.T) {
88105
rg := rand.New(rand.NewSource(42))
89106

0 commit comments

Comments
 (0)