Skip to content
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

Implement incremental update for StatefulSet #307

Merged
merged 11 commits into from
Dec 18, 2018

Conversation

lblackstone
Copy link
Member

Fixes #300

@lblackstone lblackstone force-pushed the lblackstone/statefulset-awaiter branch from 07905e0 to 19743da Compare November 30, 2018 23:55
@lblackstone lblackstone changed the title WIP: Implement incremental update for StatefulSet Implement incremental update for StatefulSet Dec 3, 2018
Copy link
Contributor

@hausdorff hausdorff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is looking pretty good. Just wanted to put a few questions in to make sure I understand. If we've smoke-tested this I think we're ok to ship if we're on the same page re: all the comments.

pkg/await/apps_deployment.go Show resolved Hide resolved
pkg/await/apps_statefulset.go Show resolved Hide resolved
obj, err := decodeUnstructured(fmt.Sprintf(`{
"kind": "StatefulSet",
"apiVersion": "apps/v1beta1",
"metadata": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're intermingling spaces and tabs here. I don't think it particularly matters which we pick, but we're using spaces in the deployment examples.

return obj
}

func statefulsetUpdate(namespace, name, targetService string) *unstructured.Unstructured {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be the user-provided inputs that update StatefulSet, or the StatefulSet after the new user inputs are provided? I believe it's the first, in which case is it intentional that .status is missing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, was supposed to be the user-provided StatefulSet

return obj
}

func statefulsetAdded(namespace, name, targetService string) *unstructured.Unstructured {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference between each of these is kind of subtle -- what do you think about putting a little comment above each to point out the major differences?

replicasReady bool
currentGeneration int64

statefulsetErrors map[string]string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, doesn't seem like this is actually populated?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, looks like you're right. Will fix.

//
// The success conditions are somewhat complex:
//
// 1. `.status.replicas`, `.status.currentReplicas` and `.status.readyReplicas` match the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, looks like we also have to check .status.updatedReplicas if it's an update rather than a create?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using it for the status messages, but it's not actually part of the success condition.

Here's a table that's illustrative (I'll add to the doc as well):

Current replicas    Ready replicas  Updated replicas    Notes
3                   3               --
<Update image>
2                   3               --                  observedGeneration/updateRevision changes
2                   2               --
2                   2               1
1                   3               1
1                   2               1
1                   2               2
--                  3               2
--                  2               2
--                  2               3
3                   3               3                   currentRevision updated
3                   3               --

pkg/await/apps_statefulset.go Show resolved Hide resolved
pkg/await/apps_statefulset.go Show resolved Hide resolved
pkg/await/apps_statefulset.go Show resolved Hide resolved
@lblackstone
Copy link
Member Author

@hausdorff I think I've addressed all your feedback.

@joeduffy
Copy link
Member

@lblackstone @hausdorff Ready to merge?

@hausdorff
Copy link
Contributor

@joeduffy This was delayed by kubecon, I told @lblackstone that I'd pick up the remaining work and make the tweaks necessary.

@hausdorff hausdorff merged commit 14af58e into master Dec 18, 2018
@pulumi-bot pulumi-bot deleted the lblackstone/statefulset-awaiter branch December 18, 2018 19:34
@hausdorff
Copy link
Contributor

Per my earlier comment, I'm merging this because (a) looks reasonable, and (b) I understand this to be smoke-tested fairly extensively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants