Skip to content

Commit a551d4e

Browse files
authored
fix several static machine issues - pyenv, thread limit, resource requirements (#418)
# Summary This pull request introduces several improvements to the development and test environment setup scripts, focusing on container runtime configuration, resource limits, and performance tuning. The main changes include adding a dedicated script for IBM container runtime setup, updating resource requests and limits for Honeycomb performance testing, and enhancing system resource limits for Minikube clusters. **Container Runtime Setup and Configuration:** * Added a new script `setup_ibm_container_runtime.sh` to automate installation, upgrade, and configuration of `crun` as the container runtime, including cleanup of conflicting configs and minimal cross-version settings. **Resource Limits and Performance Tuning:** * set a resource requests and limits for Honeycomb DaemonSet and Deployment in their respective values files to improve performance and stability during testing (especially limiting it). * Enhanced system resource limits in `setup_minikube.sh` by increasing open files, process, kernel thread, PID, and memory map counts for limits on podman. **Minikube Cluster Improvements:** * Updated Minikube cluster startup parameters to allocate more CPUs and memory for improved cluster performance. **Python Environment Setup:** * Ensured `pyenv` is always updated before checking for required Python versions, preventing issues with stale installations on static hosts. # Proof of Work - green ci - green multi arch ibm ci: https://spruce.mongodb.com/version/68bb1549eab6910007249140 + https://spruce.mongodb.com/version/68be930977ae8a00073fbbf1 ## Checklist - [x] Have you linked a jira ticket and/or is the ticket in the title? - [x] Have you checked whether your jira ticket required DOCSP changes? - [x] Have you added changelog file? - use `skip-changelog` label if not needed - refer to [Changelog files and Release Notes](https://github.com/mongodb/mongodb-kubernetes/blob/master/CONTRIBUTING.md#changelog-files-and-release-notes) section in CONTRIBUTING.md for more details
1 parent 0852f6d commit a551d4e

File tree

6 files changed

+71
-21
lines changed

6 files changed

+71
-21
lines changed

scripts/dev/recreate_python_venv.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ ensure_required_python() {
7676
return 1
7777
fi
7878

79+
# Always update pyenv to ensure we have the latest Python versions available
80+
# On static hosts we might have a stale pyenv installation.
81+
echo "Updating pyenv to get latest Python versions..." >&2
82+
if [[ -d "${HOME}/.pyenv/.git" ]]; then
83+
cd "${HOME}/.pyenv" && git pull && cd - > /dev/null || echo "Warning: Failed to update pyenv via git" >&2
84+
fi
85+
7986
# Check if the required version is already installed
8087
if pyenv versions --bare | grep -q "^${required_version}$"; then
8188
echo "Python ${required_version} already installed via pyenv" >&2
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
3+
set -Eeou pipefail
4+
5+
echo "Installing/upgrading crun..."
6+
sudo dnf upgrade -y crun || sudo dnf install -y crun || sudo yum upgrade -y crun || sudo yum install -y crun
7+
8+
if ! crun --version &>/dev/null; then
9+
echo "❌ crun installation failed"
10+
exit 1
11+
fi
12+
13+
current_version=$(crun --version | head -n1)
14+
echo "✅ Using crun: ${current_version}"
15+
16+
# Clean up any existing conflicting configurations
17+
echo "Cleaning up existing container configurations..."
18+
rm -f ~/.config/containers/containers.conf 2>/dev/null || true
19+
sudo rm -f /root/.config/containers/containers.conf 2>/dev/null || true
20+
sudo rm -f /etc/containers/containers.conf 2>/dev/null || true
21+
22+
crun_path=$(which crun)
23+
echo "Using crun path: ${crun_path}"
24+
25+
config="[containers]
26+
cgroup_manager = \"cgroupfs\"
27+
28+
[engine]
29+
runtime = \"crun\""
30+
31+
mkdir -p ~/.config/containers
32+
echo "${config}" > ~/.config/containers/containers.conf
33+
34+
sudo mkdir -p /root/.config/containers
35+
echo "${config}" | sudo tee /root/.config/containers/containers.conf >/dev/null
36+
37+
echo "✅ Configured crun"

scripts/evergreen/e2e/performance/honeycomb/values-daemonset.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ clusterRole:
1414
verbs:
1515
- get
1616

17+
resources:
18+
requests:
19+
cpu: 50m
20+
memory: 64Mi
21+
limits:
22+
cpu: 100m
23+
memory: 128Mi
24+
1725
extraEnvs:
1826
- name: ENDPOINT
1927
valueFrom:

scripts/evergreen/e2e/performance/honeycomb/values-deployment.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ extraEnvs:
3838
# We only want one of these collectors - any more and we'd produce duplicate data
3939
replicaCount: 1
4040

41+
resources:
42+
requests:
43+
cpu: 100m
44+
memory: 128Mi
45+
limits:
46+
cpu: 200m
47+
memory: 256Mi
48+
4149
presets:
4250
# enables the k8sclusterreceiver and adds it to the metrics pipelines
4351
clusterMetrics:

scripts/evergreen/setup_minikube_host.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ run_setup_step "kubectl and helm Setup" "scripts/evergreen/setup_kubectl.sh"
4949

5050
run_setup_step "jq Setup" "scripts/evergreen/setup_jq.sh"
5151

52+
run_setup_step "IBM Container Runtime Setup" "scripts/dev/setup_ibm_container_runtime.sh"
53+
5254
if [[ "${SKIP_MINIKUBE_SETUP:-}" != "true" ]]; then
5355
run_setup_step "Minikube Host Setup with Container Runtime Detection" "scripts/minikube/setup_minikube.sh"
5456
else
@@ -63,6 +65,7 @@ echo "✅ host setup completed successfully!"
6365
echo "=========================================="
6466
echo ""
6567
echo "Installed tools summary:"
68+
echo "Container Runtime: podman"
6669
echo "- Python: $(python --version 2>/dev/null || python3 --version 2>/dev/null || echo 'Not found')"
6770
echo "- AWS CLI: $(aws --version 2>/dev/null || echo 'Not found')"
6871
echo "- kubectl: $(kubectl version --client 2>/dev/null || echo 'Not found')"

scripts/minikube/setup_minikube.sh

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ set_limits() {
1313
echo "Increasing fs.inotify.max_user_watches"
1414
sudo sysctl -w fs.inotify.max_user_watches=10485760
1515

16-
echo "Increasing the number of open files"
16+
echo "Increasing the number of open files and processes"
1717
nofile_max=$(cat /proc/sys/fs/nr_open)
18-
nproc_max=$(ulimit -u)
18+
nproc_max=65536
1919
sudo tee -a /etc/security/limits.conf <<EOF
2020
root hard nofile ${nofile_max}
2121
root hard nproc ${nproc_max}
@@ -26,6 +26,11 @@ set_limits() {
2626
* soft nofile ${nofile_max}
2727
* soft nproc ${nproc_max}
2828
EOF
29+
30+
echo "Setting kernel thread limits"
31+
sudo sysctl -w kernel.threads-max=131072
32+
sudo sysctl -w kernel.pid_max=131072
33+
sudo sysctl -w vm.max_map_count=262144
2934
}
3035

3136
# retrieve arch variable off the shell command line
@@ -149,6 +154,7 @@ start_minikube_cluster() {
149154
"${PROJECT_DIR:-.}/bin/minikube" delete 2>/dev/null || true
150155

151156
local start_args=("--driver=podman")
157+
start_args+=("--cpus=4" "--memory=8g")
152158

153159
if [[ "${ARCH}" == "ppc64le" ]]; then
154160
echo "Using custom kicbase image for ppc64le with crictl..."
@@ -171,24 +177,6 @@ start_minikube_cluster() {
171177
fi
172178
}
173179

174-
setup_podman() {
175-
echo "Setting up podman for ${ARCH}..."
176-
177-
# Configure podman to use cgroupfs instead of systemd in CI
178-
mkdir -p ~/.config/containers
179-
cat > ~/.config/containers/containers.conf << EOF
180-
[containers]
181-
cgroup_manager = "cgroupfs"
182-
events_logger = "file"
183-
184-
[engine]
185-
cgroup_manager = "cgroupfs"
186-
EOF
187-
188-
}
189-
190-
# Setup podman and container runtime
191-
setup_podman
192180
set_limits
193181
download_minikube
194182

@@ -231,7 +219,6 @@ echo "=========================================="
231219
echo "✅ Setup Summary"
232220
echo "=========================================="
233221
echo "Architecture: ${ARCH}"
234-
echo "Container Runtime: podman"
235222
echo "Minikube Driver: podman"
236223
echo "Minikube: Default cluster"
237224
echo "Minikube: ${minikube_version}"

0 commit comments

Comments
 (0)