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

PWX-32425: Non-managed Replicaset activating/deactivating with storkctl. #1471

Merged
merged 1 commit into from
Aug 12, 2023

Conversation

diptiranjanpx
Copy link
Contributor

What type of PR is this?
improvement

What this PR does / why we need it:
storkctl activate/deactivate has to take care of the non-managed migrated replicasets.

Does this PR change a user-facing CRD or CLI?:

Is a release note needed?:

Issue: Migrated replicasets which were not managed by deployments could not be activated/deactivated with storkctl.
User Impact: User has to manually scale up/down the replicaset using kubectl.
Resolution: storkctl now has the capability to scale up/down the migrated replicaset as part of activate/deactivate.

Does this change need to be cherry-picked to a release branch?:

Test:

  1. Non-managed replicasets:
➜  ~ km get all
NAME                       DESIRED   CURRENT   READY   AGE
replicaset.apps/mysql-rs   0         0         0       2m9s

➜  stork git:(PWX-32425) ✗ bin/linux/storkctl activate migrations -n mysql2
Set the ApplicationActivated status in the MigrationSchedule mysql2/rs-fp to true
Updated replicas for replicaset mysql2/mysql-rs to 1
W0808 09:26:08.688901    1680 warnings.go:70] snapshot.storage.k8s.io/v1beta1 VolumeSnapshot is deprecated; use snapshot.storage.k8s.io/v1 VolumeSnapshot

➜  stork git:(PWX-32425) ✗ km get po
NAME             READY   STATUS    RESTARTS   AGE
mysql-rs-mh76x   1/1     Running   0          4m27s

➜  stork git:(PWX-32425) ✗ bin/linux/storkctl deactivate migrations -n mysql2
Updated replicas for replicaset mysql2/mysql-rs to 0
W0808 09:52:39.944142    4226 warnings.go:70] snapshot.storage.k8s.io/v1beta1 VolumeSnapshot is deprecated; use snapshot.storage.k8s.io/v1 VolumeSnapshot
Set the ApplicationActivated status in the MigrationSchedule mysql2/rs-fp to false

➜  stork git:(PWX-32425) ✗ km get all
NAME                    TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
service/mysql-service   ClusterIP   10.233.57.73   <none>        3306/TCP   8m35s

NAME                    READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/mysql   0/0     0            0           8m35s

NAME                               DESIRED   CURRENT   READY   AGE
replicaset.apps/mysql-5c9475cd45   0         0         0       8m35s

➜  stork git:(PWX-32425) ✗ km get all -n mysql2
NAME                       DESIRED   CURRENT   READY   AGE
replicaset.apps/mysql-rs   0         0         0       40m

  1. Managed replicasets:
➜  stork git:(PWX-32425) ✗ km get all
NAME                    TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
service/mysql-service   ClusterIP   10.233.57.73   <none>        3306/TCP   19s

NAME                    READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/mysql   0/0     0            0           19s

NAME                               DESIRED   CURRENT   READY   AGE
replicaset.apps/mysql-5c9475cd45   0         0         0       19s


➜  stork git:(PWX-32425) ✗ bin/linux/storkctl activate migrations -n mysql
Set the ApplicationActivated status in the MigrationSchedule kube-system/mysql-fp to true
Updated replicas for deployment mysql/mysql to 1
W0808 09:47:53.934392    3991 warnings.go:70] snapshot.storage.k8s.io/v1beta1 VolumeSnapshot is deprecated; use snapshot.storage.k8s.io/v1 VolumeSnapshot

➜  stork git:(PWX-32425) ✗ km get all
NAME                         READY   STATUS    RESTARTS   AGE
pod/mysql-5c9475cd45-7728m   1/1     Running   0          2m55s

NAME                    TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
service/mysql-service   ClusterIP   10.233.57.73   <none>        3306/TCP   6m10s

NAME                    READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/mysql   1/1     1            1           6m10s

NAME                               DESIRED   CURRENT   READY   AGE
replicaset.apps/mysql-5c9475cd45   1         1         1       6m10s

➜  stork git:(PWX-32425) ✗ bin/linux/storkctl deactivate migrations -n mysql
Updated replicas for deployment mysql/mysql to 0
W0808 09:52:07.599122    4168 warnings.go:70] snapshot.storage.k8s.io/v1beta1 VolumeSnapshot is deprecated; use snapshot.storage.k8s.io/v1 VolumeSnapshot
Set the ApplicationActivated status in the MigrationSchedule kube-system/mysql-fp to false

@cnbu-jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

Copy link
Contributor

@pp511 pp511 left a comment

Choose a reason for hiding this comment

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

lgtm

@codecov
Copy link

codecov bot commented Aug 11, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.06% ⚠️

Comparison is base (745d8ee) 66.24% compared to head (b15be13) 66.18%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1471      +/-   ##
==========================================
- Coverage   66.24%   66.18%   -0.06%     
==========================================
  Files          43       43              
  Lines        5025     5025              
==========================================
- Hits         3329     3326       -3     
- Misses       1373     1375       +2     
- Partials      323      324       +1     

see 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@diptiranjanpx diptiranjanpx added unit-test The change adds or updates a unit test release-note Information about this change needs to be added to the release note labels Aug 11, 2023
@diptiranjanpx diptiranjanpx merged commit 70d51b7 into master Aug 12, 2023
3 of 4 checks passed
@diptiranjanpx diptiranjanpx deleted the PWX-32425 branch May 27, 2024 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement release-note Information about this change needs to be added to the release note unit-test The change adds or updates a unit test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants