Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
rename to scaler with a 'e'
Browse files Browse the repository at this point in the history
Signed-off-by: Oscar Ward <[email protected]>
  • Loading branch information
Oscar Ward committed Jan 3, 2024
1 parent 13bf66a commit c347b25
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion docs/docs/40-admin/03-computeclasses.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ memory:
min: 1Gi
max: 2Gi
default: 1Gi # This default overrides the install-wide memory default
requestScalar: .5 # A percentage of memory to request in relation to the limit, will not go below a configured min value
requestScaler: .5 # A percentage of memory to request in relation to the limit, will not go below a configured min value
values: # Specific values that are only allowed to be used. Default must be included in these values and max/min cannot be set.
- 1.5Gi
cpuScaler: 1 # This is used as a ratio of how many VCPUs to schedule per Gibibyte of memory. In this case it is 1 to 1.
Expand Down
20 changes: 10 additions & 10 deletions integration/client/computeclass/computeclass_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,37 +181,37 @@ func TestCreatingComputeClasses(t *testing.T) {
fail: true,
},
{
name: "valid-values-with-scalar",
name: "valid-values-with-scaler",
cpuScaler: 0.25,
memory: adminv1.ComputeClassMemory{
RequestScalar: 0.1,
RequestScaler: 0.1,
Default: "1Gi",
Values: []string{"1Gi", "2Gi"},
},
},
{
name: "valid-scalar-upper-bound",
name: "valid-scaler-upper-bound",
memory: adminv1.ComputeClassMemory{
RequestScalar: 1.0,
RequestScaler: 1.0,
},
},
{
name: "valid-scalar-lower-bound",
name: "valid-scaler-lower-bound",
memory: adminv1.ComputeClassMemory{
RequestScalar: 0,
RequestScaler: 0,
},
},
{
name: "invalid-scalar-negative",
name: "invalid-scaler-negative",
memory: adminv1.ComputeClassMemory{
RequestScalar: -0.1,
RequestScaler: -0.1,
},
fail: true,
},
{
name: "invalid-scalar-too-large",
name: "invalid-scaler-too-large",
memory: adminv1.ComputeClassMemory{
RequestScalar: 1.1,
RequestScaler: 1.1,
},
fail: true,
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/internal.admin.acorn.io/v1/computeclasses.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ type ComputeClassMemory struct {
Min string `json:"min,omitempty"`
Max string `json:"max,omitempty"`
Default string `json:"default,omitempty"`
RequestScalar float64 `json:"requestScalar,omitempty"`
RequestScaler float64 `json:"requestScaler,omitempty"`
Values []string `json:"values,omitempty"`
}
4 changes: 2 additions & 2 deletions pkg/computeclasses/computeclasses.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ func ParseComputeClassMemory(memory internaladminv1.ComputeClassMemory) (memoryQ
}
quantities.Def = &defInt

if memory.RequestScalar < 0 || memory.RequestScalar > 1 {
return memoryQuantities{}, errors.New("request scalar value must be between 0 and 1")
if memory.RequestScaler < 0 || memory.RequestScaler > 1 {
return memoryQuantities{}, errors.New("request scaler value must be between 0 and 1, inclusive")
}

quantities.Values = make([]*resource.Quantity, len(memory.Values))
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/scheduling/computeclass_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ func TestGenericResourcesComputeClass(t *testing.T) {
tester.DefaultTest(t, scheme.Scheme, "testdata/computeclass/generic-resources", Calculate)
}

func TestRequestScalar(t *testing.T) {
tester.DefaultTest(t, scheme.Scheme, "testdata/computeclass/request-scalar", Calculate)
func TestRequestScaler(t *testing.T) {
tester.DefaultTest(t, scheme.Scheme, "testdata/computeclass/request-scaler", Calculate)
}

func TestRequestScalarFloor(t *testing.T) {
tester.DefaultTest(t, scheme.Scheme, "testdata/computeclass/request-scalar-floor", Calculate)
func TestRequestScalerFloor(t *testing.T) {
tester.DefaultTest(t, scheme.Scheme, "testdata/computeclass/request-scaler-floor", Calculate)
}

func TestTwoCCCDefaultsShouldError(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/scheduling/scheduling.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ func ResourceRequirements(req router.Request, app *v1.AppInstance, containerName

// Figure out the scaled value of memory to request based on the compute class
memoryRequest := memoryLimit.DeepCopy()
if computeClass != nil && computeClass.Memory.RequestScalar != 0 {
if computeClass != nil && computeClass.Memory.RequestScaler != 0 {
// The following line should hold up without loss of precision up to 4 petabytes
memoryRequest.Set(int64(memoryLimit.AsApproximateFloat64() * computeClass.Memory.RequestScalar))
memoryRequest.Set(int64(memoryLimit.AsApproximateFloat64() * computeClass.Memory.RequestScaler))

// Never allocate less than the defined minimum of the compute class
if computeClass.Memory.Min != "" && computeClass.Memory.Min != "0" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ memory:
min: 1Mi # 1Mi
max: 2Mi # 2Mi
default: 2Mi # 2Mi
requestScalar: .1
requestScaler: .1
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
Expand All @@ -18,4 +18,4 @@ affinity:
- key: foo
operator: In
values:
- bar
- bar
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ memory:
min: 1Mi # 1Mi
max: 2Mi # 2Mi
default: 2Mi # 2Mi
requestScalar: .5
requestScaler: .5
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
Expand All @@ -18,4 +18,4 @@ affinity:
- key: foo
operator: In
values:
- bar
- bar
2 changes: 1 addition & 1 deletion pkg/openapi/generated/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c347b25

Please sign in to comment.