Skip to content

Commit

Permalink
feat(spec): add completion deadline (#206)
Browse files Browse the repository at this point in the history
When provisioning the pod, we have a 30min timeout, but this timeout is
not utilized in the pod spec in any way.

Provisioned pods on MP+ take quota from the non-terminating pool, but in
the case of sandbox environment we do have a deadline, since the pods
are one-shot and destroyed after running. Adding this deadline
explicitly to the spec results in OpenShift terminating the pods by
itself and additionally uses a different pool of quota, the terminating
one.

For the deadline in spec I have chosen to use our default 30min + 10min
for provisioning, because from the PoV of OpenShift it is included in
the deadline.

Related to the failed pull-from-upstream run from Apr 29 2024, as has
been reported on the Matrix channel on May 2 2024:


https://matrix.to/#/!ySjfdvNvPOsVtWHNDb:fedora.im/$FwhFOOhbbh1N2NXbVoA5oH3b97f8a2kzRSyhy9F2-F8?via=fedora.im&via=libera.chat&via=matrix.org

See details:


https://docs.openshift.com/container-platform/3.11/dev_guide/builds/advanced_build_operations.html#builds-setting-maximum-duration
  • Loading branch information
mfocko authored May 3, 2024
2 parents 3aef934 + 2f01c9a commit 39382f7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions files/container-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ set -x

source ./setup_env_in_openshift.sh

# [WARN] When adjusting, don't forget the timeout in spec (sandcastle/api.py)
# 30 minutes is a default timeout for the sandbox pod
sleep 1800
2 changes: 2 additions & 0 deletions sandcastle/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ def set_pod_manifest(self, command: Optional[List] = None):
"containers": [container],
"restartPolicy": "Never",
"automountServiceAccountToken": False,
# [NOTE] 1800s which is the default time out + 600s for the provisioning
"completionDeadlineSeconds": 1800 + 600,
}
self.pod_manifest = {
"apiVersion": "v1",
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_pod_and_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def test_manifest(init_openshift_deployer):
}
],
"restartPolicy": "Never",
"completionDeadlineSeconds": 1800 + 600,
},
}
sandcastle.env_vars = {KEY: VALUE}
Expand Down

0 comments on commit 39382f7

Please sign in to comment.