0
0
Kubernetesdevops~5 mins

Progressive delivery concept in Kubernetes - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: Progressive delivery concept
O(n)
Understanding Time 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?

Scenario Under Consideration

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 Repeating Operations

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.
How Execution Grows With Input

The total time to complete the rollout grows as we add more steps or longer pauses.

Input Size (n = steps)Approx. Operations (time units)
3Short total pause and weight changes
5Longer total pause and more gradual weight changes
10Much longer total pause and many small weight changes

Pattern observation: Total rollout time grows roughly linearly with the number of steps.

Final Time Complexity

Time Complexity: O(n)

This means the rollout time increases in direct proportion to the number of steps in the progressive delivery.

Common Mistake

[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.

Interview Connect

Understanding how rollout steps affect deployment time helps you design safer updates and explain your approach clearly in real projects.

Self-Check

"What if we removed all pauses between steps? How would the time complexity change?"