Skip to content
This repository has been archived by the owner. It is now read-only.

examples/catset: Add StatefulSet-style rolling update. #22

Merged
merged 1 commit into from Feb 20, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -1,6 +1,6 @@
## CatSet

This is a reimplementation of StatefulSet (except for rolling updates) as a CompositeController.
This is a reimplementation of StatefulSet (now including rolling updates) as a CompositeController.

For this example, you need a cluster with a default storage class and a dynamic provisioner.

@@ -21,9 +21,18 @@ spec:
parentResource:
apiVersion: ctl.enisoc.com/v1
resource: catsets
revisionHistory:
fieldPaths:
- spec.template
childResources:
- apiVersion: v1
resource: pods
updateStrategy:
method: RollingRecreate
statusChecks:
conditions:
- type: Ready
status: "True"
- apiVersion: v1
resource: persistentvolumeclaims
clientConfig:
@@ -98,7 +98,10 @@ module.exports = async function (context) {
delete desiredPods[maxOrdinal];
}
}
desired.children.push(...Object.values(desiredPods));
// List Pods in descending order, since that determines rolling update order.
for (let ordinal of Object.keys(desiredPods).sort((a,b) => a-b).reverse()) {
desired.children.push(desiredPods[ordinal]);
}

if (catset.spec.volumeClaimTemplates) {
// Generate desired PVCs.
ProTip! Use n and p to navigate between commits in a pull request.