Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Allow statefulSet updates #8527

Merged
merged 4 commits into from
Nov 22, 2018
Merged

Allow statefulSet updates #8527

merged 4 commits into from
Nov 22, 2018

Conversation

stepanstipl
Copy link
Contributor

@stepanstipl stepanstipl commented Oct 17, 2018

This fixes CouchDB updates by removing Version part from StatefulSet label, as Kubernetes don't allow updates to any other fields but 'replicas', 'template', and 'updateStrategy', the chart and heritage labels from thevolumeClaimTemplates which is immutable and therefore updating CouchDB service would be impossible.

Update: To update from current state use --force flag (see https://docs.helm.sh/helm/helm_upgrade/ for details). This will cause StatefulSet recreation, therefore downtime, but as long as you use persistent storage, the data will be preserved. delete the CouchDB StatefulSet before upgrading:

$ kubectl delete statefulsets --cascade=false my-release-couchdb

@desaintmartin
Copy link
Collaborator

desaintmartin commented Oct 19, 2018

As this is a breaking change (even if it broke before this PR), could you bump major version and explain how to upgrade? (see https://github.com/helm/charts/pull/7686/files or other PRs from #7680 for reference).
Edit: the problem is NOT here. IMHO you need to revert your changes and follow only the next paragraph. It is OK (and wanted) to have a field containing version in metadata.labels.

There is another problem with the volumeClaimTemplate described in #7803, could you update this as well and bump minor version instead of patch version?

cc @kocolosk

Thanks!

@stepanstipl
Copy link
Contributor Author

stepanstipl commented Oct 22, 2018

@desaintmartin Thanks for reviewing this. I believe that removing the version from metadata.labels is required, as that field IS immutable in case of statefulSet (see #7680). Removing the version part of the label solved the issue for us.

Surprisingly we haven't experienced the #7803 in our case, but IMHO it makes sense to remove the version there as well and I have done so in this PR.

I have bumped the minor version and added not about update to the description of the PR.

@helm-bot helm-bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). labels Oct 22, 2018
@paulczar
Copy link
Collaborator

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 23, 2018
@desaintmartin
Copy link
Collaborator

desaintmartin commented Oct 23, 2018

I've quite tested and documented the three different upgrading problems we have at:
#7726
#7680
#7803
And if I'm not wrong (tell me if it is the case!), couchdb chart has the third problem, and you are trying to solve the second (but second is about spec.selector.matchLabels which is immutable, which is already the case here).

Can you sign your commits?

This fixes CouchDB updates by removing Version part from StatefulSet lables, as Kubernetes don't allow updates to any other fields but 'replicas', 'template', and 'updateStrategy', and therefore updating CouchDB service would be impossible.
- metadata.labels
- spec.VolumeClaimTemplate.metadata.labels

Signed-off-by: Stepan Stipl <stepan@stipl.net>
Signed-off-by: Stepan Stipl <stepan@stipl.net>
@helm-bot helm-bot added Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 23, 2018
@stepanstipl
Copy link
Contributor Author

stepanstipl commented Oct 23, 2018

@desaintmartin thanks, so the problem we've experienced and that I'm trying to solve is the first one - version in metadata.labels preventing the statefulSet upgrade (#7726)

We haven't experienced the 3rd one - version in spec.VolumeClaimTemplate.metadata.labels (#7803), but I have added fix for that as the version was in the label and I understood you asked for it in the previous comment and it seems reasonable.

I believe the 2nd one - version in spec.selector.matchLabels (#7680) does not apply here, as there's no version in the matchLabels as you pointed out. We have not experienced that issue, nor am I trying to fix it. (Referencing it in the previous comment was a mistake, I actually meant the 1st one - #7726).

Sorry for confusion :) and thanks for your time reviewing this.

Commits signed.

@desaintmartin
Copy link
Collaborator

The first one is about v1beta1 without explicit selector, so it doesnt match.

I'm interested, could you give me the commands used and errors encountered? It may be yet another issue.

@stepanstipl
Copy link
Contributor Author

It's a bit more complicated - were using our fork of this chart with some added bits, you can see it at https://github.com/gpii-ops/gpii-infra/blob/master/shared/charts/couchdb. Also we're not installing the chart directly, but rather via exekube (https://github.com/exekube/exekube), which uses Terraform provider (https://github.com/terraform-providers/terraform-provider-helm/).

With the version in we would receive update error, and after removing it we don't have that problem - see commit gpii-ops/gpii-infra@28efcc1.

I'll try to find out the exact error and also reproduce directly with this chart and helm.

incubator/couchdb/templates/statefulset.yaml Outdated Show resolved Hide resolved
incubator/couchdb/templates/statefulset.yaml Outdated Show resolved Hide resolved
@unguiculus unguiculus self-assigned this Nov 4, 2018
@desaintmartin
Copy link
Collaborator

I am really interested into a failing use case with the existing configuration and error log to be sure that we do not miss anything. But @unguiculus seems to agree with me. :)

Signed-off-by: Stepan Stipl <stepan@stipl.net>
@helm-bot helm-bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 8, 2018
@stepanstipl
Copy link
Contributor Author

@desaintmartin @unguiculus thanks for review and comments. I've updated the labels as suggested -> the result is only removing the mutable label chart: and heritage: one from the volumeClaimTemplates of StatefulSet.

I've tested the upgrade process by changing the chart version and it seems to do the job.

@desaintmartin
Copy link
Collaborator

After some testing, this changes is in itself a breaking change (impossible to update from the existing broken state to your new version fixing this) and I did not realize it before with the other fixes of #7803.

You should bump a MAJOR version and document it like in https://github.com/helm/charts/pull/7686/files#diff-b290a06961a11374d72f584e5925762cR48 (with only the update about volumeClaimTemplate and expliaing how to delete without cascade the statefulset).

This will allow to finally close #7803.

@helm-bot helm-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). labels Nov 21, 2018
Signed-off-by: Stepan Stipl <stepan@stipl.net>
@helm-bot helm-bot added Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 21, 2018
@stepanstipl
Copy link
Contributor Author

stepanstipl commented Nov 21, 2018

@desaintmartin thanks for the review, I have bumped the major version to 1.0.0 and added README section about upgrading.

I have tested upgrading via the proposed strategy (non-cascading delete of StatefulSet) and it worked well.

@desaintmartin
Copy link
Collaborator

Thanks! This lgtm now, ping @unguiculus

Copy link
Member

@scottrigby scottrigby left a comment

Choose a reason for hiding this comment

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

Thanks for doing this. @unguiculus requests were already changed. lgtm too 👍

@scottrigby
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 22, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: scottrigby, stepanstipl

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 22, 2018
@scottrigby scottrigby dismissed unguiculus’s stale review November 22, 2018 02:47

Change requests were addressed

@k8s-ci-robot k8s-ci-robot merged commit a240446 into helm:master Nov 22, 2018
davidkarlsen pushed a commit to davidkarlsen/charts that referenced this pull request Dec 2, 2018
* CouchDB - Allow statefulSet updates

This fixes CouchDB updates by removing Version part from StatefulSet lables, as Kubernetes don't allow updates to any other fields but 'replicas', 'template', and 'updateStrategy', and therefore updating CouchDB service would be impossible.
- metadata.labels
- spec.VolumeClaimTemplate.metadata.labels

Signed-off-by: Stepan Stipl <stepan@stipl.net>

* CouchDB - bump chart version to 0.3.0

Signed-off-by: Stepan Stipl <stepan@stipl.net>

* CouchDB - Update StatefulSet labels

Signed-off-by: Stepan Stipl <stepan@stipl.net>

* Bump major version and describe upgrade process

Signed-off-by: Stepan Stipl <stepan@stipl.net>
yuchaoran2011 pushed a commit to yuchaoran2011/charts that referenced this pull request Dec 11, 2018
* CouchDB - Allow statefulSet updates

This fixes CouchDB updates by removing Version part from StatefulSet lables, as Kubernetes don't allow updates to any other fields but 'replicas', 'template', and 'updateStrategy', and therefore updating CouchDB service would be impossible.
- metadata.labels
- spec.VolumeClaimTemplate.metadata.labels

Signed-off-by: Stepan Stipl <stepan@stipl.net>

* CouchDB - bump chart version to 0.3.0

Signed-off-by: Stepan Stipl <stepan@stipl.net>

* CouchDB - Update StatefulSet labels

Signed-off-by: Stepan Stipl <stepan@stipl.net>

* Bump major version and describe upgrade process

Signed-off-by: Stepan Stipl <stepan@stipl.net>
Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com>
wgiddens pushed a commit to wgiddens/charts that referenced this pull request Jan 18, 2019
* CouchDB - Allow statefulSet updates

This fixes CouchDB updates by removing Version part from StatefulSet lables, as Kubernetes don't allow updates to any other fields but 'replicas', 'template', and 'updateStrategy', and therefore updating CouchDB service would be impossible.
- metadata.labels
- spec.VolumeClaimTemplate.metadata.labels

Signed-off-by: Stepan Stipl <stepan@stipl.net>

* CouchDB - bump chart version to 0.3.0

Signed-off-by: Stepan Stipl <stepan@stipl.net>

* CouchDB - Update StatefulSet labels

Signed-off-by: Stepan Stipl <stepan@stipl.net>

* Bump major version and describe upgrade process

Signed-off-by: Stepan Stipl <stepan@stipl.net>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants