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

feat(api,ui,sdk): Make CPU limits configurable #381

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0d045c6
Update swagger docs
deadlycoconuts May 21, 2024
40398cb
Update sdk autogenerated openapi classes
deadlycoconuts May 21, 2024
70da2bc
Refactor knativeServiceConfig and make it an attribute of the service…
deadlycoconuts May 21, 2024
2861728
Add cpu limit to resource requests and refactor knative service struct
deadlycoconuts May 23, 2024
0cd4838
Simplify diff reporting steps in unit test helper function
deadlycoconuts May 23, 2024
6ab6d0f
Fix k8s service unit test
deadlycoconuts May 23, 2024
2ee90cb
Refactor how cpu and memory limits are set for fluentd stateful set
deadlycoconuts May 23, 2024
cfe561b
Simplify if else-block in cpu limit helper function
deadlycoconuts May 23, 2024
360729b
Update openapi specs
deadlycoconuts May 23, 2024
4104721
Update python unit tests
deadlycoconuts May 23, 2024
6af3304
Add cpu limit form group component
deadlycoconuts May 23, 2024
1ac8cde
Refactor cpu limit as nullable field
deadlycoconuts May 24, 2024
a1d019b
Add default values for cpu limit in all router components
deadlycoconuts May 24, 2024
112f26f
Fix tooltip description
deadlycoconuts May 24, 2024
1baf14c
Rename cpu limit section
deadlycoconuts May 24, 2024
94cd64f
Update docs
deadlycoconuts May 24, 2024
bb8360c
Replace env var append function with merge with replace function
deadlycoconuts May 24, 2024
89caaa2
Add codecov config file that adds a threshold to allow random code co…
deadlycoconuts May 27, 2024
4bf12de
Replace outdated comment with more detailed on describing the flow of…
deadlycoconuts May 31, 2024
1f9187e
Simplify if/else conditions in getCPULimit
deadlycoconuts May 31, 2024
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
5 changes: 5 additions & 0 deletions .github/workflows/codecov-config/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage:
status:
patch:
default:
threshold: 0.03%
1 change: 1 addition & 0 deletions .github/workflows/sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
flags: sdk-test-${{ matrix.python-version }}
name: sdk-test-${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}
codecov_yml_path: ./.github/workflows/codecov-config/codecov.yml

release-rules:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/turing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ jobs:
name: api-test
token: ${{ secrets.CODECOV_TOKEN }}
working-directory: api
codecov_yml_path: ../.github/workflows/codecov-config/codecov.yml

test-engines-router:
runs-on: ubuntu-latest
Expand Down
22 changes: 22 additions & 0 deletions api/api/openapi.bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2125,6 +2125,7 @@ components:
port: 5
created_at: 2000-01-23T04:56:07.000+00:00
resource_request:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand Down Expand Up @@ -2161,6 +2162,7 @@ components:
updated_at: 2000-01-23T04:56:07.000+00:00
default_route_id: default_route_id
resource_request:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand All @@ -2174,6 +2176,7 @@ components:
project_id: 7
ensembler_id: 9
resource_request:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand Down Expand Up @@ -2207,6 +2210,7 @@ components:
target: target
port: 2
resource_request:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand Down Expand Up @@ -2311,6 +2315,7 @@ components:
type: object
ResourceRequest:
example:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand All @@ -2323,6 +2328,10 @@ components:
cpu_request:
pattern: ^(\d{1,3}(\.\d{1,3})?)$|^(\d{2,5}m)$
type: string
cpu_limit:
nullable: true
pattern: ^(\d{1,3}(\.\d{1,3})?)$|^(\d{2,5}m)$
type: string
memory_request:
pattern: ^\d+(Ei?|Pi?|Ti?|Gi?|Mi?|Ki?)?$
type: string
Expand Down Expand Up @@ -2419,6 +2428,7 @@ components:
port: 5
created_at: 2000-01-23T04:56:07.000+00:00
resource_request:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand Down Expand Up @@ -2481,6 +2491,7 @@ components:
project_id: 7
ensembler_id: 9
resource_request:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand Down Expand Up @@ -2514,6 +2525,7 @@ components:
target: target
port: 2
resource_request:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand Down Expand Up @@ -2588,6 +2600,7 @@ components:
target: target
port: 2
resource_request:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand Down Expand Up @@ -2640,6 +2653,7 @@ components:
project_id: 7
ensembler_id: 9
resource_request:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand Down Expand Up @@ -2770,6 +2784,7 @@ components:
port: 5
created_at: 2000-01-23T04:56:07.000+00:00
resource_request:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand Down Expand Up @@ -2830,6 +2845,7 @@ components:
- values
operator: in
resource_request:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand All @@ -2842,6 +2858,7 @@ components:
project_id: 7
ensembler_id: 9
resource_request:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand Down Expand Up @@ -2875,6 +2892,7 @@ components:
target: target
port: 2
resource_request:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand Down Expand Up @@ -2929,6 +2947,7 @@ components:
port: 5
created_at: 2000-01-23T04:56:07.000+00:00
resource_request:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand Down Expand Up @@ -2989,6 +3008,7 @@ components:
- values
operator: in
resource_request:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand All @@ -3001,6 +3021,7 @@ components:
project_id: 7
ensembler_id: 9
resource_request:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand Down Expand Up @@ -3034,6 +3055,7 @@ components:
target: target
port: 2
resource_request:
cpu_limit: cpu_limit
min_replica: 0
max_replica: 6
memory_request: memory_request
Expand Down
4 changes: 4 additions & 0 deletions api/api/specs/routers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,10 @@ components:
cpu_request:
type: "string"
pattern: '^(\d{1,3}(\.\d{1,3})?)$|^(\d{2,5}m)$'
cpu_limit:
type: "string"
pattern: '^(\d{1,3}(\.\d{1,3})?)$|^(\d{2,5}m)$'
nullable: true
memory_request:
type: "string"
pattern: '^\d+(Ei?|Pi?|Ti?|Gi?|Mi?|Ki?)?$'
Expand Down
12 changes: 2 additions & 10 deletions api/turing/cluster/knative_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ type KnativeService struct {
TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints"`

// Resource properties
QueueProxyResourcePercentage int `json:"queueProxyResourcePercentage"`
UserContainerCPULimitRequestFactor float64 `json:"userContainerLimitCPURequestFactor"`
UserContainerMemoryLimitRequestFactor float64 `json:"userContainerLimitMemoryRequestFactor"`
QueueProxyResourcePercentage int `json:"queueProxyResourcePercentage"`
deadlycoconuts marked this conversation as resolved.
Show resolved Hide resolved
}

// Creates a new config object compatible with the knative serving API, from
Expand Down Expand Up @@ -131,12 +129,6 @@ func (cfg *KnativeService) buildSvcSpec(
// Revision name
revisionName := getDefaultRevisionName(cfg.Name)

// Build resource requirements for the user container
resourceReqs := cfg.buildResourceReqs(
cfg.UserContainerCPULimitRequestFactor,
cfg.UserContainerMemoryLimitRequestFactor,
)

// Build container spec
var portName string
// If protocol is using GRPC, add "h2c" which is required for grpc knative
Expand All @@ -151,7 +143,7 @@ func (cfg *KnativeService) buildSvcSpec(
ContainerPort: cfg.ContainerPort,
},
},
Resources: resourceReqs,
Resources: cfg.buildResourceReqs(),
VolumeMounts: cfg.VolumeMounts,
Env: cfg.Envs,
}
Expand Down
Loading
Loading