Skip to content

scheduling-webhook: hypershift image builds in memory-based storage #4533

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 21 additions & 0 deletions cmd/ci-scheduling-webhook/mutation.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ func mutatePod(w http.ResponseWriter, r *http.Request) {
}
}

if podClass == PodClassBuilds &&
labels["ci.openshift.io/metadata.repo"] == "hypershift" {
podClass = PodClassBuildsTmpfs
}

if podClass != PodClassNone {
profile("classified request")

Expand Down Expand Up @@ -347,6 +352,22 @@ func mutatePod(w http.ResponseWriter, r *http.Request) {
addPatchEntry("add", "/spec/affinity", unstructuredAffinity)
}

if podClass == PodClassBuildsTmpfs {
// Iterate over pod volumes and set medium to memory for container-storage-root and container-storage-run volumes
for i, volume := range pod.Spec.Volumes {
if volume.Name == "container-storage-root" || volume.Name == "container-storage-run" {
addPatchEntry("add", fmt.Sprintf("/spec/volumes/%v/emptyDir/medium", i), "Memory")
}
}

// Find the docker-build container and remove its memory request
for i, container := range pod.Spec.Containers {
if container.Name == "docker-build" {
addPatchEntry("remove", fmt.Sprintf("/spec/containers/%v/resources/requests/memory", i), nil)
}
}
}

// There is currently an issue with cluster scale up where pods are stacked up, unschedulable.
// A machine is provisioned. As soon as the machine is provisioned, pods are scheduled to the
// node and they begin to run before DNS daemonset pods can successfully configure the pod.
Expand Down
11 changes: 6 additions & 5 deletions cmd/ci-scheduling-webhook/prioritization.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ import (
type PodClass string

const (
PodClassBuilds PodClass = "builds"
PodClassTests PodClass = "tests"
PodClassLongTests PodClass = "longtests"
PodClassProwJobs PodClass = "prowjobs"
PodClassNone PodClass = ""
PodClassBuilds PodClass = "builds"
PodClassBuildsTmpfs PodClass = "builds-tmpfs"
PodClassTests PodClass = "tests"
PodClassLongTests PodClass = "longtests"
PodClassProwJobs PodClass = "prowjobs"
PodClassNone PodClass = ""

// MachineDeleteAnnotationKey When a machine is annotated with this and the machineset is scaled down,
// it will target machines with this annotation to satisfy the change.
Expand Down