Progressive delivery concept in Kubernetes - Time & Space Complexity
We want to understand how the time to deploy and verify updates grows as we increase the number of users or steps in progressive delivery.
How does the process scale when we add more stages or traffic percentages?
Analyze the time complexity of the following Kubernetes progressive delivery steps.
apiVersion: rollout.k8s.io/v1alpha1
kind: Rollout
metadata:
name: example-rollout
spec:
strategy:
canary:
steps:
- setWeight: 10
- pause: {duration: 5m}
- setWeight: 50
- pause: {duration: 10m}
- setWeight: 100
This snippet defines a rollout with canary steps that gradually increase traffic to a new version with pauses in between.
Identify the loops, recursion, array traversals that repeat.
- Primary operation: Sequential execution of rollout steps (setWeight and pause).
- How many times: Number of steps defined in the rollout strategy.
The total time to complete the rollout grows as we add more steps or longer pauses.
| Input Size (n = steps) | Approx. Operations (time units) |
|---|---|
| 3 | Short total pause and weight changes |
| 5 | Longer total pause and more gradual weight changes |
| 10 | Much longer total pause and many small weight changes |
Pattern observation: Total rollout time grows roughly linearly with the number of steps.
Time Complexity: O(n)
This means the rollout time increases in direct proportion to the number of steps in the progressive delivery.
[X] Wrong: "Adding more steps won't affect rollout time much because they run quickly."
[OK] Correct: Each step often includes a pause to monitor, so more steps add more waiting time, increasing total rollout duration.
Understanding how rollout steps affect deployment time helps you design safer updates and explain your approach clearly in real projects.
"What if we removed all pauses between steps? How would the time complexity change?"