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

feat(cstor-volume-mgmt): add replica scale down support #1499

Merged
merged 4 commits into from
Nov 5, 2019

Conversation

mittachaitu
Copy link

@mittachaitu mittachaitu commented Oct 29, 2019

Signed-off-by: mittachaitu sai.chaithanya@mayadata.io

What this PR does / why we need it:
This PR adds replica scale down support in the cstor-volume-mgmt(sidecar of cstor-istgt).

Note:

  1. Only one replica at a time should be removed.

Pre-requisites:

  1. All the cstorvolume replicas(CVR) should be in a Healthy state except the cstorvolume replica that is going to delete(i.e deleting CVR can be in any state).
  2. There shouldn't be any ongoing scaleup process(Verify using cstorvolume CR replicationFactor should be equal to the desiredReplicationFactor).

Steps to execute by the user/operator:

  1. The user will decrease the value of the desired replication factor and remove the replicaID entry from cstorvolume which will under cstorvolume.Spec.ReplicaDeatails by using Kubectl edit cstorvolume <cstorvolume_name> -n openebs(both should be updated at a time).
  2. Upon successful removal of the replica user/operator will delete the corresponding CVR(CVR whose replicaID entry removed in step1).

User has the following PVC setup

sai@sai:~$ kubectl get pvc
NAME             STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
demo-vol-claim   Bound    pvc-79ba260d-fad6-11e9-8791-42010a8000c5   5G         RWO            cstor-sc       10m

Following are cstorvolume and CVRs related to above PVC

sai@sai:~$ kubectl get cstorvolume -n openebs -l openebs.io/persistent-volume=pvc-79ba260d-fad6-11e9-8791-42010a8000c5
NAME                                       STATUS    AGE   CAPACITY
pvc-79ba260d-fad6-11e9-8791-42010a8000c5   Healthy   11m   5G

sai@sai:~$ kubectl get cvr -n openebs -l openebs.io/persistent-volume=pvc-79ba260d-fad6-11e9-8791-42010a8000c5
NAME                                                              USED   ALLOCATED   STATUS    AGE
pvc-79ba260d-fad6-11e9-8791-42010a8000c5-cstor-sparse-pool-7jsv   6K     6K          Healthy   11m
pvc-79ba260d-fad6-11e9-8791-42010a8000c5-cstor-sparse-pool-mch2   6K     6K          Healthy   11m
pvc-79ba260d-fad6-11e9-8791-42010a8000c5-cstor-sparse-pool-qa5i   6K     6K          Healthy   11m

Explanation for the above steps:

  • Assume from above o/p if user need to delete pvc-79ba260d-fad6-11e9-8791-42010a8000c5-cstor-sparse-pool-mch2 CVR. User should follow the mentioned steps.
  • Note the replicaID of above CVR under .spec.replicaID in this case replicaID is AEB135CD6AA1E65EF2DAEA085A4C9BA7.

Following is a snippet of cstorvolume:

apiVersion: openebs.io/v1alpha1
kind: CStorVolume
name: pvc-79ba260d-fad6-11e9-8791-42010a8000c5
spec:
    consistencyFactor: 2 ## Minimum no.of replicas required to say IO(read/write) is successfull
    desiredReplicationFactor: 3 ## Maximum no.of replicas are allowed to connect
    replicaDetails:
      ## knownReplicas contains map[string]string key as cvr replicaID and value as replica ZVOL_GUID
      knownReplicas:
        44253781C6BD1384DDF024C643B60E26: "6475964221803202402"
        AEB135CD6AA1E65EF2DAEA085A4C9BA7: "1440900316001731961"
        B2EEE0A0E4C9439926AD544D0E134D90: "8420817958580332064"
    replicationFactor: 3 ## Maximum no.of quorum replicas that can allowed to connect
    ...
    ...
  status:
    ...
    ...
    replicaDetails:
      knownReplicas:
        44253781C6BD1384DDF024C643B60E26: "6475964221803202402"
        AEB135CD6AA1E65EF2DAEA085A4C9BA7: "1440900316001731961"
        B2EEE0A0E4C9439926AD544D0E134D90: "8420817958580332064"

Above snippet will be updated as follows using kubectl edit

apiVersion: openebs.io/v1alpha1
kind: CStorVolume
name: pvc-79ba260d-fad6-11e9-8791-42010a8000c5
spec:
    consistencyFactor: 2
    desiredReplicationFactor: 2
    replicaDetails:
      knownReplicas:
        44253781C6BD1384DDF024C643B60E26: "6475964221803202402"
        B2EEE0A0E4C9439926AD544D0E134D90: "8420817958580332064"
    replicationFactor: 3
    ...
    ...
  status:
    ...
    ...
    replicaDetails:
      knownReplicas:
        44253781C6BD1384DDF024C643B60E26: "6475964221803202402"
        AEB135CD6AA1E65EF2DAEA085A4C9BA7: "1440900316001731961"
        B2EEE0A0E4C9439926AD544D0E134D90: "8420817958580332064"

After editing snippet 1 will looks as snippet 2( updated the desired replication factor to 2 and removed replicaID entry[AEB135CD...] from spec.replicaDetails.knownreplicas).

  • Upon success removal events will be generated and spec & status of cstorvolume will be updated as follows(replica scaledown verification steps)
    Events on cstorvolume:
 Normal   Updated     12m (x2 over 12m)  pvc-79ba260d-fad6-11e9-8791-42010a8000c5-target-8c76ff8f6-ssw67, gke-sai-bdd-test-pool-1-775ad7d7-j5jj  Successfully updated the desiredReplicationFactor to 2
  spec:
    ....
    ....
    consistencyFactor: 2
    desiredReplicationFactor: 2
    replicaDetails:
      knownReplicas:
        44253781C6BD1384DDF024C643B60E26: "6475964221803202402"
        B2EEE0A0E4C9439926AD544D0E134D90: "8420817958580332064"
    replicationFactor: 2
  status:
    ...
    ...
    replicaDetails:
      knownReplicas:
        44253781C6BD1384DDF024C643B60E26: "6475964221803202402"
        B2EEE0A0E4C9439926AD544D0E134D90: "8420817958580332064"

If you observe status.replicadetails.knownreplicas is updated with latest info. ReplicationFactor and consistencyFactor is updated to 2.

Now, delete the CVR pvc-79ba260d-fad6-11e9-8791-42010a8000c5-cstor-sparse-pool-mch2 using kubectl delete command.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Special notes for your reviewer:

Checklist:

  • Fixes #
  • Labelled this PR & related issue with documentation tag
  • PR messages has document related information
  • Labelled this PR & related issue with breaking-changes tag
  • PR messages has breaking changes related information
  • Labelled this PR & related issue with requires-upgrade tag
  • PR messages has upgrade related information
  • Commit has unit tests
  • Commit has integration tests

Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
Copy link

@AmitKumarDas AmitKumarDas left a comment

Choose a reason for hiding this comment

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

Will it be possible to draft the PR message in a better way / simple way.

@mittachaitu
Copy link
Author

mittachaitu commented Oct 30, 2019

Will it be possible to draft the PR message in a better way / simple way.

@AmitKumarDas updated the PR message with a detailed explanation.

Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
Copy link
Contributor

@shubham14bajpai shubham14bajpai left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
@mittachaitu mittachaitu added the pr/release-note PR should be included in release notes label Nov 5, 2019
Copy link
Contributor

@prateekpandey14 prateekpandey14 left a comment

Choose a reason for hiding this comment

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

lgtm .. it will be good to test once more locally, after all the changes has been merge in other repos.

@vishnuitta vishnuitta merged commit 8566293 into openebs-archive:master Nov 5, 2019
sonasingh46 pushed a commit to sonasingh46/maya that referenced this pull request Nov 7, 2019
…ive#1499)

Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
@kmova kmova added this to the 1.4.0 milestone Nov 8, 2019
shubham14bajpai pushed a commit to shubham14bajpai/maya that referenced this pull request Dec 27, 2019
…ive#1499)

Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-scale component: CStorVolMgmt pr/release-note PR should be included in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants