-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support pods with multiple containers (but boost only one container) (#…
…20)
- Loading branch information
Showing
4 changed files
with
150 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
apiVersion: serving.knative.dev/v1 | ||
kind: Service | ||
metadata: | ||
name: example | ||
spec: | ||
template: | ||
metadata: | ||
annotations: | ||
queue.sidecar.serving.knative.dev/cpu-resource-request: "300m" # otherwise it takes a while to be ready | ||
queue.sidecar.serving.knative.dev/cpu-resource-limit: "300m" | ||
queue.sidecar.serving.knative.dev/memory-resource-request: "10M" | ||
queue.sidecar.serving.knative.dev/memory-resource-limit: "10M" | ||
norbjd.github.io/k8s-pod-cpu-booster-enabled: "true" | ||
norbjd.github.io/k8s-pod-cpu-booster-container: "user-container" | ||
spec: | ||
containers: | ||
- image: python:3.11-alpine | ||
command: ["python"] | ||
args: | ||
- -m | ||
- http.server | ||
ports: | ||
- containerPort: 8000 | ||
# readinessProbe is not necessary because it's already configured by Knative with the queue-proxy. | ||
# At startup, it agressively polls the user-container. But, if needed, we can configure it though | ||
readinessProbe: | ||
initialDelaySeconds: 0 | ||
periodSeconds: 1 | ||
successThreshold: 1 | ||
timeoutSeconds: 1 | ||
# resizePolicy is not required here, because by default it it set to update the resources without restarting the pod! | ||
resources: | ||
requests: | ||
cpu: 50m | ||
memory: 100M | ||
limits: | ||
cpu: 50m | ||
memory: 100M | ||
timeoutSeconds: 1 # also used to terminate the pod quickly when terminating |
43 changes: 43 additions & 0 deletions
43
examples/pod-with-multiple-containers-and-default-boost.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
annotations: | ||
norbjd.github.io/k8s-pod-cpu-booster-enabled: "true" | ||
norbjd.github.io/k8s-pod-cpu-booster-container: "python" | ||
name: pod-with-multiple-containers-and-default-boost | ||
spec: | ||
containers: | ||
- image: python:3.11-alpine | ||
name: python | ||
command: ["python"] | ||
args: | ||
- -m | ||
- http.server | ||
readinessProbe: | ||
tcpSocket: | ||
port: 8000 | ||
initialDelaySeconds: 0 | ||
periodSeconds: 1 | ||
successThreshold: 1 | ||
timeoutSeconds: 1 | ||
resizePolicy: | ||
- resourceName: cpu | ||
restartPolicy: NotRequired # this is very important to be able to update the CPU resources in place (no need to restart the pod) | ||
resources: | ||
requests: | ||
cpu: 50m | ||
memory: 100M | ||
limits: | ||
cpu: 50m | ||
memory: 100M | ||
- image: alpine:3.18 # a dummy container just sleeping | ||
name: sleep | ||
command: ["sleep", "infinity"] | ||
resources: | ||
requests: | ||
cpu: 50m | ||
memory: 50M | ||
limits: | ||
cpu: 50m | ||
memory: 50M | ||
terminationGracePeriodSeconds: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters