-
Notifications
You must be signed in to change notification settings - Fork 27
Refactor Elasticsearch controller to use a semi-state machine design & add ginkgo based e2e tests #228
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Assign the PR to them by writing The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
e82260c
to
ed305d4
Compare
641d8c8
to
7a5236d
Compare
7a5236d
to
403c5d5
Compare
f54d0bf
to
1aca3a1
Compare
fcc58f6
to
baabd83
Compare
baabd83
to
a9b6f2e
Compare
/test verify |
/test e2e v1.9 |
7f8af77
to
a62a64e
Compare
@wallrj this PR has grown large, so I'm not going to continue any more work here. Our e2e tests are passing and stand up an ElasticsearchCluster (both single and multi-node), plus wait for the cluster to transition into a Yellow/Green state respectively. I'll be following up with more PRs to address the remaining items:
I'll also be expanding the test suite further, to:
This PR also introduces two new test frameworks:
Once merged, we can start to migrate the remaining cassandra e2e tests to this new format too. It appears to be running stable, and cleans up after itself nice and quickly 😄 Please reach out if you need a hand with review/if there's anything I can do to help. Big PRs are big 😬 |
Automatic merge from submit-queue. Refactor Elasticsearch node pool controller into Actions structures **What this PR does / why we need it**: This gives us a generic way to implement 'Actions' against a given 'State' structure, and additionally introduces a unit testing framework that can be reused between controllers for testing Actions. See #228 fixes #215 **Special notes for your reviewer**: Stacks on #240, #239 **Release note**: ```release-note Updated Elasticsearch controller that carefully manages upgrade rollouts ```
What this PR does / why we need it:
This change refactors the Elasticsearch controller to use a state-machine 'style' of operation.
We introduce an 'Action' interface with a simple spec:
The
cluster_control.go
contains the 'state machine' like logic. For now, this is implemented as a simple function that uses if/else branches to determine which 'Action' to return depending on the current state of the cluster.Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Fixes #215, fixes #156, fixes #32
Special notes for your reviewer:
I'm currently working on a general purpose unit testing fixture,
StateFixture
that can be used to mock theState
structure. This should allow for easy testing of all of our Action implementations, between Elasticsearch and in future Cassandra.Right now, this PR does not properly wait for document count to be zero during scale down, however it does manage a rolling upgrade across multiple statefulsets by careful management of the
partition
field on statefulset.spec.updateStrategy.rollingUpdate`.Things still to do:
Release note:
/cc @mattbates @simonswine @wallrj