Skip to content

Commit 694c8d7

Browse files
authored
don't sleep for infinity but 2 hours instead (#435)
# Summary This pull request primarily updates the sleep durations for various BusyBox sidecar containers and test scripts across multiple Kubernetes fixtures and test files, changing them from indefinite or long-running sleeps to a fixed 7200 seconds (2 hours). Additionally, it includes a minor improvement to the cluster cleaner script to prevent failures when querying deleted resources, and bumps the image version for the cluster cleaner. **Kubernetes fixtures and pod specs:** * Changed BusyBox container `args` from `"infinity"` or long sleep values to `"7200"` seconds in multiple test fixture files (`mongodb-multi-central-sts-override.yaml`, `mongodb-multi-sts-override.yaml`, `om_ops_manager_pod_spec.yaml`, `replica-set-custom-podspec.yaml`, `sharded-cluster-custom-podspec.yaml`, `standalone-custom-podspec.yaml`) to avoid issues with indefinite sleep and improve test reliability. **Test deployment templates:** * Changed the keepalive container command in `mongodb-enterprise-tests.yaml` to use `sleep 7200` instead of `sleep 3600` for consistency with other changes. **Cluster cleaner maintenance:** * Improved error handling in `clean-failed-namespaces.sh` by suppressing errors when querying for deleted resources, ensuring the script continues deletion without failing. * Bumped `IMAGE_VERSION` in the cluster cleaner `Makefile` from `0.14` to `0.15` to reflect these updates. ## Proof of Work - green ci - successful master run ## 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 330c11e commit 694c8d7

File tree

11 files changed

+16
-15
lines changed

11 files changed

+16
-15
lines changed

docker/cluster-cleaner/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
IMAGE_VERSION=0.14
1+
IMAGE_VERSION=0.15
22

33
.PHONY: all
44
all: build push install

docker/cluster-cleaner/scripts/clean-failed-namespaces.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ delete_resources_safely() {
88
kubectl delete "${resource_type}" --all -n "${namespace}" --wait=true --timeout=10s || true
99

1010
# Check if any resources are still stuck
11-
resources=$(kubectl get "$resource_type" -n "${namespace}" --no-headers -o custom-columns=":metadata.name")
11+
# Let's not fail here and continue deletion
12+
resources=$(kubectl get "$resource_type" -n "${namespace}" --no-headers -o custom-columns=":metadata.name" 2>/dev/null || true)
1213

1314
for resource in ${resources}; do
1415
echo "${resource_type}/${resource} is still present, force deleting..."

docker/mongodb-kubernetes-tests/tests/multicluster/fixtures/mongodb-multi-central-sts-override.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ spec:
1212
spec:
1313
template:
1414
spec:
15-
# FIXME workaround for sleep infinity hanging
15+
# FIXME workaround for sleep 7200 hanging
1616
shareProcessNamespace: true
1717
containers:
1818
- name: sidecar1
1919
image: busybox
2020
command: ["sleep"]
21-
args: [ "infinity" ]
21+
args: [ "7200" ]
2222
opsManager:
2323
configMapRef:
2424
name: my-project

docker/mongodb-kubernetes-tests/tests/multicluster/fixtures/mongodb-multi-sts-override.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ spec:
2828
- name: sidecar1
2929
image: busybox
3030
command: ["sleep"]
31-
args: [ "infinity" ]
31+
args: [ "7200" ]
3232
volumeClaimTemplates:
3333
- metadata:
3434
name: data
@@ -44,7 +44,7 @@ spec:
4444
- name: sidecar2
4545
image: busybox
4646
command: ["sleep"]
47-
args: [ "infinity" ]
47+
args: [ "7200" ]
4848
volumeClaimTemplates:
4949
- metadata:
5050
name: data
@@ -60,7 +60,7 @@ spec:
6060
- name: sidecar3
6161
image: busybox
6262
command: ["sleep"]
63-
args: [ "infinity" ]
63+
args: [ "7200" ]
6464
volumeClaimTemplates:
6565
- metadata:
6666
name: data

docker/mongodb-kubernetes-tests/tests/opsmanager/fixtures/om_ops_manager_pod_spec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ spec:
6666
- name: appdb-sidecar
6767
image: busybox
6868
command: ["sleep"]
69-
args: ["infinity"]
69+
args: ["7200"]
7070
resources:
7171
limits:
7272
cpu: "1"

docker/mongodb-kubernetes-tests/tests/opsmanager/withMonitoredAppDB/om_ops_manager_pod_spec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def test_appdb_pod_template_containers(self, ops_manager: MongoDBOpsManager):
9696
appdb_sidecar_container = containers_by_name["appdb-sidecar"]
9797
assert appdb_sidecar_container.image == "busybox"
9898
assert appdb_sidecar_container.command == ["sleep"]
99-
assert appdb_sidecar_container.args == ["infinity"]
99+
assert appdb_sidecar_container.args == ["7200"]
100100

101101
def test_appdb_persistence(self, ops_manager: MongoDBOpsManager, namespace: str):
102102
# appdb pod volume claim template

docker/mongodb-kubernetes-tests/tests/replicaset/fixtures/replica-set-custom-podspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ spec:
2525
- name: side-car
2626
image: busybox:latest
2727
command: ["/bin/sh"]
28-
args: ["-c", "echo ok > /somewhere/busybox_file && sleep 86400"]
28+
args: ["-c", "echo ok > /somewhere/busybox_file && sleep 7200"]
2929
volumeMounts:
3030
- mountPath: /somewhere
3131
name: test-volume

docker/mongodb-kubernetes-tests/tests/replicaset/replica_set_custom_podspec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def test_stateful_set_spec_updated(replica_set, namespace):
139139
}
140140
],
141141
"command": ["/bin/sh"],
142-
"args": ["-c", "echo ok > /somewhere/busybox_file && sleep 86400"],
142+
"args": ["-c", "echo ok > /somewhere/busybox_file && sleep 7200"],
143143
},
144144
]
145145

docker/mongodb-kubernetes-tests/tests/shardedcluster/fixtures/sharded-cluster-custom-podspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ spec:
4343
- name: sharded-cluster-sidecar
4444
image: busybox
4545
command: ["sleep"]
46-
args: [ "infinity" ]
46+
args: [ "7200" ]
4747
resources:
4848
limits:
4949
cpu: "1"
@@ -63,7 +63,7 @@ spec:
6363
- name: sharded-cluster-sidecar-override
6464
image: busybox
6565
command: ["sleep"]
66-
args: [ "infinity" ]
66+
args: [ "7200" ]
6767
resources:
6868
limits:
6969
cpu: "1"

docker/mongodb-kubernetes-tests/tests/standalone/fixtures/standalone-custom-podspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ spec:
2121
- name: standalone-sidecar
2222
image: busybox
2323
command: ["sleep"]
24-
args: [ "infinity" ]
24+
args: [ "7200" ]
2525
terminationGracePeriodSeconds: 10
2626
affinity:
2727
podAntiAffinity:

0 commit comments

Comments
 (0)