New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Feb 20, 2018
Jump to file or symbol
Failed to load files and symbols.
+14 −2
Diff settings

Always

Just for now

Copy path View file
@@ -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:
Copy path View file
@@ -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.