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

[stable/redis-ha] Implement stable sentinel IDs by pregenerating them #11095

Merged
merged 5 commits into from
Feb 7, 2019

Conversation

towolf
Copy link
Contributor

@towolf towolf commented Feb 2, 2019

What this PR does / why we need it:

In the course of reworking the failover mechanisms in PR #10032, the proliferation of stale sentinel IDs was prevented by recovering the old ID from the old config file (from persistent storage) on startup.

However, the redis-ha chart can be used with volatile data and an emptyDir. The sentinel ID will be lost on termination and again randomly generated on startup.

This PR makes sentinel IDs stable by simple pre-generating them and storing the as ENV vars on the init container.

In this approach I take the unique label combination + StatefulSet pod index and take the SHA1 of that:

    Environment:              
      SENTINEL_ID_0:  e2f7f63e2872ee7884a3887a043457bc6bff1fb4
      SENTINEL_ID_1:  10257ae861ee58ad3a0c32cda22ba7f62887e5c2
      SENTINEL_ID_2:  ba97a7362cc6e46973f0fe45c895cd5b57a60000

However, I could image that this would work just as well, not sure:

    Environment:                                              
      SENTINEL_ID_0:  1111111111111111111111111111111111111111
      SENTINEL_ID_1:  2222222222222222222222222222222222222222
      SENTINEL_ID_2:  3333333333333333333333333333333333333333

Special notes for your reviewer:

Checklist

[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]

  • DCO signed
  • Chart Version bumped
  • Variables are documented in the README.md

@helm-bot helm-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 2, 2019
@k8s-ci-robot k8s-ci-robot requested a review from paulczar February 2, 2019 19:16
@towolf towolf force-pushed the pregenerate-sentinel-id branch from 114dcef to 7685059 Compare February 2, 2019 19:17
@helm-bot helm-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 2, 2019
@towolf
Copy link
Contributor Author

towolf commented Feb 2, 2019

/assign @ssalaues

We talked about this here before:
#10635 (comment)

@k8s-ci-robot
Copy link
Contributor

@towolf: GitHub didn't allow me to assign the following users: ssalaues.

Note that only helm members and repo collaborators can be assigned and that issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @ssalaues

We talked about this here before:
#10635 (comment)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@helm-bot helm-bot added 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. Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). labels Feb 3, 2019
@towolf towolf force-pushed the pregenerate-sentinel-id branch from ba0d09e to 3e45a3f Compare February 3, 2019 14:08
@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 Feb 3, 2019
@k8s-ci-robot
Copy link
Contributor

@ssalaues: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/ok-to-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ssalaues
Copy link
Collaborator

ssalaues commented Feb 4, 2019

@towolf Thanks for the PR! I tested it and works well!

The only caveat is the "ghosts" that happen on upgrade from the previous version to this one. However the "ghost" sentinels don't seem to grow beyond this initial upgrade (with or without persistence) and are still able to reach majority. Also just an FYI for any future on lookers of this PR, a consecutive rolling upgrade seemed to clear out the "ghosts" from the configs.

@ssalaues
Copy link
Collaborator

ssalaues commented Feb 7, 2019

@towolf I'm not sure why the approval didn't go through. I just was able to approve this PR #11085 . But since that one is going through, can you rebase and bump your version again?

I'll delete my test and approve comments and try again when you push.

@helm-bot helm-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 7, 2019
…alize sentinel ID

Signed-off-by: Tobias Wolf <towolf@gmail.com>
Signed-off-by: Tobias Wolf <towolf@gmail.com>
Signed-off-by: Tobias Wolf <towolf@gmail.com>
Signed-off-by: Tobias Wolf <towolf@gmail.com>
@towolf towolf force-pushed the pregenerate-sentinel-id branch from 214e752 to 9f24b29 Compare February 7, 2019 18:58
@helm-bot helm-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 7, 2019
@towolf
Copy link
Contributor Author

towolf commented Feb 7, 2019

@ssalaues done.

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. labels Feb 7, 2019
@k8s-ci-robot k8s-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Feb 7, 2019
@helm-bot helm-bot added size/S Denotes a PR that changes 10-29 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). size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 7, 2019
Signed-off-by: Tobias Wolf <towolf@gmail.com>
@towolf towolf force-pushed the pregenerate-sentinel-id branch from b2c5fcc to 5a4541e Compare February 7, 2019 20:51
@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 Feb 7, 2019
@ssalaues
Copy link
Collaborator

ssalaues commented Feb 7, 2019

/test

@ssalaues
Copy link
Collaborator

ssalaues commented Feb 7, 2019

/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ssalaues, towolf

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 lgtm Indicates that a PR is ready to be merged. label Feb 7, 2019
@k8s-ci-robot k8s-ci-robot merged commit 79aa425 into helm:master Feb 7, 2019
tbuchier pushed a commit to tbuchier/charts that referenced this pull request Feb 14, 2019
…helm#11095)

* Fix ghost sentinels by pregenerating stable 40 character IDs to initialize sentinel ID

Signed-off-by: Tobias Wolf <towolf@gmail.com>

* Fix name of _helper template

Signed-off-by: Tobias Wolf <towolf@gmail.com>

* Fix whitespace trimming

Signed-off-by: Tobias Wolf <towolf@gmail.com>

* Bump version after previous PR bumped it

Signed-off-by: Tobias Wolf <towolf@gmail.com>

* Make init.sh shellcheck clean

Signed-off-by: Tobias Wolf <towolf@gmail.com>
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.

4 participants