Problem
DaemonSet is missing two capabilities that force consumers to shell out to oc:
-
No restart method — oc rollout restart works by patching the pod template with a kubectl.kubernetes.io/restartedAt annotation, triggering a rolling update. The wrapper has Resource.update() which can do a merge-patch, but there's no convenience method on DaemonSet.
-
No rollout-aware wait — wait_until_deployed only checks desiredNumberScheduled == numberReady, which is racy after a restart (old pods are still ready, returns immediately).
Root Cause
File: ocp_resources/daemonset.py
- No
restart() method exists. VirtualMachine has one (via subresource API), but DaemonSet restart is a standard annotation patch — not currently implemented.
wait_until_deployed (line 15) checks only:
if desired_number_scheduled > 0 and desired_number_scheduled == number_ready:
This doesn't verify pods are actually updated — just that enough are ready.
Proposed Approach
restart() method
Patch the pod template with a restartedAt annotation (same as oc rollout restart):
def restart(self):
self.update(resource_dict={
"spec": {"template": {"metadata": {"annotations": {
"kubectl.kubernetes.io/restartedAt": datetime.utcnow().isoformat()
}}}}
})
wait_for_rollout() method
Check all three conditions (mirrors oc rollout status):
status.observedGeneration == metadata.generation
status.updatedNumberScheduled == status.desiredNumberScheduled
status.numberAvailable == status.desiredNumberScheduled
Similar to how Deployment.wait_for_replicas checks updatedReplicas.
Done
Problem
DaemonSetis missing two capabilities that force consumers to shell out tooc:No restart method —
oc rollout restartworks by patching the pod template with akubectl.kubernetes.io/restartedAtannotation, triggering a rolling update. The wrapper hasResource.update()which can do a merge-patch, but there's no convenience method onDaemonSet.No rollout-aware wait —
wait_until_deployedonly checksdesiredNumberScheduled == numberReady, which is racy after a restart (old pods are still ready, returns immediately).Root Cause
File:
ocp_resources/daemonset.pyrestart()method exists.VirtualMachinehas one (via subresource API), but DaemonSet restart is a standard annotation patch — not currently implemented.wait_until_deployed(line 15) checks only:Proposed Approach
restart()methodPatch the pod template with a
restartedAtannotation (same asoc rollout restart):wait_for_rollout()methodCheck all three conditions (mirrors
oc rollout status):status.observedGeneration == metadata.generationstatus.updatedNumberScheduled == status.desiredNumberScheduledstatus.numberAvailable == status.desiredNumberScheduledSimilar to how
Deployment.wait_for_replicaschecksupdatedReplicas.Done
restart()method toDaemonSetclasswait_for_rollout()method toDaemonSetclasswait_until_deployedunchanged (no breaking change)