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

DREIMP-10890: Implement restart for vitess components #3949

Closed
wants to merge 8 commits into from

Conversation

siadat
Copy link
Member

@siadat siadat commented Sep 9, 2024

Problem

We'd like to be able to restart vtgate or other components of a Vitess instance without restarting all components for that instance.

Solution

Update annotations to trigger a restart for the deployments or recreate the pods. Allow user to specify Vitess deployment they want to restart using dot notation.

vtgate

Commands:

$ paasta restart -s vitess-k8s -c kind-sina-k8s-test -i vitess-tablet-sets.vtgate
$ paasta restart -s vitess-k8s -c kind-sina-k8s-test -i vitess-tablet-sets.vtgate.uswest1adevc

Updated annotations

$ KUBECONFIG=./k8s_itests/kubeconfig kubectl -n paasta-vitessclusters get vitesscluster -o json | gron | grep desired_state | grep 'gateway.annotations'
json.items[0].spec.cells[0].gateway.annotations["paasta.yelp.com/desired_state"] = "start";
json.items[0].spec.cells[0].gateway.annotations["paasta.yelp.com/desired_state_updated_at"] = "2024-09-18T20:09:46.298574+00:00";
json.items[0].spec.cells[0].gateway.annotations["yelp.com/desired_state"] = "start";
json.items[0].spec.cells[1].gateway.annotations["paasta.yelp.com/desired_state"] = "start";
json.items[0].spec.cells[1].gateway.annotations["paasta.yelp.com/desired_state_updated_at"] = "2024-09-18T20:09:46.298574+00:00";
json.items[0].spec.cells[1].gateway.annotations["yelp.com/desired_state"] = "start";

vttablet

Commands:

$ paasta restart -s vitess-k8s -c kind-sina-k8s-test -i vitess-tablet-sets.vttablet
$ paasta restart -s vitess-k8s -c kind-sina-k8s-test -i vitess-tablet-sets.vttablet.yelp_aux

Updated annotations

$ KUBECONFIG=./k8s_itests/kubeconfig kubectl -n paasta-vitessclusters get vitesscluster -o json | gron | grep desired_state | grep '.spec.keyspaces....annotations'
json.items[0].spec.keyspaces[0].annotations["paasta.yelp.com/desired_state"] = "start";
json.items[0].spec.keyspaces[0].annotations["paasta.yelp.com/desired_state_updated_at"] = "2024-09-18T20:11:44.862627+00:00";
json.items[0].spec.keyspaces[0].annotations["yelp.com/desired_state"] = "start";
json.items[0].spec.keyspaces[1].annotations["paasta.yelp.com/desired_state"] = "start";
json.items[0].spec.keyspaces[1].annotations["paasta.yelp.com/desired_state_updated_at"] = "2024-09-18T20:11:44.862627+00:00";
json.items[0].spec.keyspaces[1].annotations["yelp.com/desired_state"] = "start";
json.items[0].spec.keyspaces[2].annotations["paasta.yelp.com/desired_state"] = "start";
json.items[0].spec.keyspaces[2].annotations["paasta.yelp.com/desired_state_updated_at"] = "2024-09-18T20:11:44.862627+00:00";
json.items[0].spec.keyspaces[2].annotations["yelp.com/desired_state"] = "start";

vtorc

Commands:

$ paasta restart -s vitess-k8s -c kind-sina-k8s-test -i vitess-tablet-sets.vtorc
$ paasta restart -s vitess-k8s -c kind-sina-k8s-test -i vitess-tablet-sets.vtorc.yelp_aux

Updated annotations

$ KUBECONFIG=./k8s_itests/kubeconfig kubectl -n paasta-vitessclusters get vitesscluster -o json | gron | grep desired_state | grep 'vitessOrchestrator.annotations'
json.items[0].spec.keyspaces[0].vitessOrchestrator.annotations["paasta.yelp.com/desired_state"] = "start";
json.items[0].spec.keyspaces[0].vitessOrchestrator.annotations["paasta.yelp.com/desired_state_updated_at"] = "2024-09-18T20:11:06.491611+00:00";
json.items[0].spec.keyspaces[0].vitessOrchestrator.annotations["yelp.com/desired_state"] = "start";
json.items[0].spec.keyspaces[1].vitessOrchestrator.annotations["paasta.yelp.com/desired_state"] = "start";
json.items[0].spec.keyspaces[1].vitessOrchestrator.annotations["paasta.yelp.com/desired_state_updated_at"] = "2024-09-18T20:11:06.491611+00:00";
json.items[0].spec.keyspaces[1].vitessOrchestrator.annotations["yelp.com/desired_state"] = "start";
json.items[0].spec.keyspaces[2].vitessOrchestrator.annotations["paasta.yelp.com/desired_state"] = "start";
json.items[0].spec.keyspaces[2].vitessOrchestrator.annotations["paasta.yelp.com/desired_state_updated_at"] = "2024-09-18T20:11:06.491611+00:00";
json.items[0].spec.keyspaces[2].vitessOrchestrator.annotations["yelp.com/desired_state"] = "start";

vtctld

Commands:

$ paasta restart -s vitess-k8s -c kind-sina-k8s-test -i vitess-tablet-sets.vtctld

Updated annotations

$ KUBECONFIG=./k8s_itests/kubeconfig kubectl -n paasta-vitessclusters get vitesscluster -o json | gron | grep desired_state | grep 'spec.vitessDashboard.annotations'
json.items[0].spec.vitessDashboard.annotations["paasta.yelp.com/desired_state"] = "start";
json.items[0].spec.vitessDashboard.annotations["paasta.yelp.com/desired_state_updated_at"] = "2024-09-18T20:10:11.429885+00:00";
json.items[0].spec.vitessDashboard.annotations["yelp.com/desired_state"] = "start";

vtadmin

Commands:

$ paasta restart -s vitess-k8s -c kind-sina-k8s-test -i vitess-tablet-sets.vtadmin

Updated annotations

$ KUBECONFIG=./k8s_itests/kubeconfig kubectl -n paasta-vitessclusters get vitesscluster -o json | gron | grep desired_state | grep 'spec.vtadmin.annotations'
json.items[0].spec.vtadmin.annotations["paasta.yelp.com/desired_state"] = "start";
json.items[0].spec.vtadmin.annotations["paasta.yelp.com/desired_state_updated_at"] = "2024-09-18T20:08:32.641218+00:00";
json.items[0].spec.vtadmin.annotations["yelp.com/desired_state"] = "start";

Context

http://y/DREIMP-10890

@siadat siadat changed the title DREIMP-10890: Implement stop/stop/restart for vitess_k8s components DREIMP-10890: Implement restart for vitess_k8s components Sep 9, 2024
@siadat siadat marked this pull request as draft September 9, 2024 22:19
@siadat siadat marked this pull request as ready for review September 18, 2024 14:19
@siadat siadat changed the title DREIMP-10890: Implement restart for vitess_k8s components DREIMP-10890: Implement restart for vitess components Sep 19, 2024
@siadat siadat closed this Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant