Capacity Target

A CapacityTarget is the interface used by the Release Controller to change the target number of replicas for an application in a set of clusters. It is acted upon by the Capacity Controller.

The status resource includes status per-cluster so that the Release Controller can determine when the Capacity Controller is complete and it can move to the traffic step.

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
apiVersion: shipper.booking.com/v1alpha1
kind: CapacityTarget
metadata:
  name: reviewsapi-deadbeef-0
  namespace: reviewsapi
  annotations:
    "shipper.booking.com/v1/finalReplicaCount": 10
  labels:
    release: reviewsapi-4
spec:
  clusters:
  - name: kube-us-east1-a
    percent: 10
  - name: kube-eu-west2-b
    percent: 10
status:
  clusters:
  - name: kube-us-east1-a
    availableReplicas: 1
    achievedPercent: 10
  - name: kube-eu-west2-b
    availableReplicas: 1
    achievedPercent: 10
    sadPods:
    - name: reviewsapi-deadbeef-0-cafebabe
      phase: Terminated
      containers:
      - name: app
        status: CrashLoopBackOff
      condition:
        type: Ready
        status: False
        reason: ContainersNotReady
        message: "unready containers [app]"

Spec

.spec.clusters

clusters is a list of clusters the associated Release object is present in. Each item in the list has a name, which should map to a Cluster object, and a percent. percent declares how much capacity the Release should have in this cluster relative to the final replica count. For example, if the final replica count is 10 and the percent is 50, the Deployment object for this Release will be patched to have 5 pods.

1
2
3
4
5
6
    release: reviewsapi-4
spec:
  clusters:
  - name: kube-us-east1-a
    percent: 10
  - name: kube-eu-west2-b

Status

.status.clusters

.status.clusters is a list of objects representing the capacity status of all clusters where the associated Release objects must be installed.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
    percent: 10
status:
  clusters:
  - name: kube-us-east1-a
    availableReplicas: 1
    achievedPercent: 10
  - name: kube-eu-west2-b
    availableReplicas: 1
    achievedPercent: 10
    sadPods:
    - name: reviewsapi-deadbeef-0-cafebabe
      phase: Terminated
      containers:
      - name: app
        status: CrashLoopBackOff
      condition:
        type: Ready
        status: False
        reason: ContainersNotReady
        message: "unready containers [app]"

The following table displays the keys a cluster status entry should have:

Key Description
name The Application Cluster name. For example, kube-us-east1-a.
availableReplicas The number of pods that have successfully started up
achievedPercent What percentage of the final replica count does availableReplicas represent.
sadPods Pod Statuses for up to 5 Pods which are not yet Ready.
conditions A list of all conditions observed for this particular Application Cluster.

.status.clusters.conditions

The following table displays the different conditions statuses and reasons reported in the CapacityTarget object for the Operational condition type:

Type Status Reason Description
Operational True N/A Cluster is reachable, and seems to be operational.
Operational False ServerError Some error has happened Shipper couldn’t classify. Details can be found in the .message field.

The following table displays the different conditions statuses and reasons reported in the CapacityTarget object for the Ready condition type:

Type Status Reason Description
Ready True N/A The correct number of pods are running and all of them are Ready.
Ready False WrongPodCount This cluster has not yet achieved the desired number of pods.
Ready False PodsNotReady The cluster has the desired number of pods, but not all of them are Ready.
Ready False MissingDeployment Shipper could not find the Deployment object that it expects to be able to adjust capacity on. See message for more details.