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

Added documentation to readthedocs for paasta playground - PAASTA-17768 #3478

Merged
merged 1 commit into from
Oct 24, 2022

Conversation

EmanElsaban
Copy link
Contributor

In this PR, I added documentation related to debugging and running paasta playground.

Testing

I tried viewing the RST document using a VS Code RST extension to ensure there are no syntax mistakes.

@EmanElsaban EmanElsaban changed the title Added documentation to readthedocs for paasta playground Added documentation to readthedocs for paasta playground - PAASTA-17768 Oct 11, 2022
Copy link
Member

@nemacysts nemacysts left a comment

Choose a reason for hiding this comment

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

i mostly just have super tiny nits that you can ignore - the only real comments are about the image resizing and the zookeeper mention

looks good otherwise tho!

==================


What is PaaSTA playground
Copy link
Member

Choose a reason for hiding this comment

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

super-nit:

Suggested change
What is PaaSTA playground
What is the PaaSTA playground?

What is PaaSTA playground
-------------------------

PaaSTA playground allows the developer to run and debug paasta locally on an ephemeral Kubernetes cluster. Currently, it includes the following components:
Copy link
Member

Choose a reason for hiding this comment

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

super-nit:

Suggested change
PaaSTA playground allows the developer to run and debug paasta locally on an ephemeral Kubernetes cluster. Currently, it includes the following components:
PaaSTA playground allows the developer to run and debug PaaSTA locally on an ephemeral Kubernetes cluster. Currently, it includes the following components:

Comment on lines 10 to 11
generating ``etc_paasta_playground`` and ``soa_config_playground`` directories, setup_kubernetes_job (deploy compute-infra-test-service),
PaaSTA API, and PaaSTA CLI client.
Copy link
Member

Choose a reason for hiding this comment

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

hmm, might be good to expand on some of these pieces in the future (i.e., so that we can point a new hire to this and not need to explain what things like etc_paasta_playground are)

e.g.,

* generating ``etc_paasta_playground`` (stores system-level PaaSTA configuration)
* generating ``soa_config_playground`` (stores what services PaaSTA should manage)
* running setup_kubernetes_job (the tool we use to deploy services on Kubernetes)
* starting the PaaSTA API (the backend that the PaaSTA CLI talks to)
* configuring the PaaSTA CLI (the interface to interacting with PaaSTA)

but this can be done in another PR unless we really wanna do this now

Create a Kind Cluster - K8s Cluster
-----------------------------------

Before running or debugging PaaSTA playground, you will need to create a kubernetes cluster - Kind. You can do so by running the make target
Copy link
Member

Choose a reason for hiding this comment

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

super-nit:

Suggested change
Before running or debugging PaaSTA playground, you will need to create a kubernetes cluster - Kind. You can do so by running the make target
Before running or debugging PaaSTA playground, you will need to create a Kubernetes cluster using ``kind``. You can do so by running the Make target

-----------------------------------

Before running or debugging PaaSTA playground, you will need to create a kubernetes cluster - Kind. You can do so by running the make target
``make create_cluster`` from ``paasta/k8s_itests`` directory.
Copy link
Member

Choose a reason for hiding this comment

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

super-nit:

Suggested change
``make create_cluster`` from ``paasta/k8s_itests`` directory.
``make create_cluster`` from the ``paasta/k8s_itests`` directory.

In order to run the debugger with any of the configurations in ``launch.json``, you can go to ``Run and Debug`` tab in VS Code

.. image:: run_and_debug_tab.png
:width: 700px
Copy link
Member

Choose a reason for hiding this comment

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

nit: could we make these images 700px wide so that we don't need to resize them in the browser? should also make the file size smaller if we shrink the picture size :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ohh sorry I'm confused. The images width is already set to 700px, do you mean to decrease this value?

Copy link
Member

Choose a reason for hiding this comment

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

oh sorry, i meant: we should make the raw image be exactly the size that we want to display it as rather than having browsers/rst resize the image for us (i.e., edit the image to be exactly 700px wide)


.. _running-debugger:

Running debugger (in VS Code)
Copy link
Member

Choose a reason for hiding this comment

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

super-nit:

Suggested change
Running debugger (in VS Code)
Running the debugger (in VS Code)


Steps below outline running PaaSTA playground components with a debugger attached:

1. Run the make target ``generate_etc_paasta_playground`` to generate the ``etc_paasta_playground`` and ``soa_config_playground`` directories and ``deployments.json`` file.
Copy link
Member

Choose a reason for hiding this comment

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

super-nit:

Suggested change
1. Run the make target ``generate_etc_paasta_playground`` to generate the ``etc_paasta_playground`` and ``soa_config_playground`` directories and ``deployments.json`` file.
1. Run t ``generate_etc_paasta_playground`` to run the Make target that generates the ``etc_paasta_playground`` and ``soa_config_playground`` directories and ``deployments.json`` file.

1. Run the make target ``generate_etc_paasta_playground`` to generate the ``etc_paasta_playground`` and ``soa_config_playground`` directories and ``deployments.json`` file.
2. [This step can be ran one time] From the ``Run and Debug`` tab in VS Code, press on ``Run setup k8s job in playground`` to deploy ``compute-infra-test-service`` service in the cluster, if it's not deployed.

Note: we're expecting to see the service in ``pending status`` as zookeeper component doesn't exist yet in paaSTA playground:
Copy link
Member

Choose a reason for hiding this comment

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

do we need zk running to start pods in kind? afaik, the only thing inside our infra that uses zk in paasta is some service mesh stuff

Copy link
Contributor Author

@EmanElsaban EmanElsaban Oct 18, 2022

Choose a reason for hiding this comment

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

yes, I think so. When I run setup_kubernetes_job.py it gives me this at the end of the output:

INFO:__main__:Creating compute-infra-test-service-autoscaling-0ae13cf29612fb38bbf1ad40652cdf93abfe41df-config1e4fda94 because it does not exist yet.
INFO:root:creating poddisruptionbudget compute-infra-test-service-autoscaling
ERROR:__main__:Error while processing: compute-infra-test-service-autoscaling-0ae13cf29612fb38bbf1ad40652cdf93abfe41df-config1e4fda94
Traceback (most recent call last):
  File "/nail/home/emanelsabban/pg/paasta/paasta_tools/utils.py", line 2080, in get_zk_hosts
    hosts = self.config_dict["zookeeper"]
KeyError: 'zookeeper'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/nail/home/emanelsabban/pg/paasta/paasta_tools/setup_kubernetes_job.py", line 176, in setup_kube_deployments
    app.create(kube_client)
  File "/nail/home/emanelsabban/pg/paasta/paasta_tools/kubernetes/application/controller_wrappers.py", line 231, in create
    self.sync_horizontal_pod_autoscaler(kube_client)
  File "/nail/home/emanelsabban/pg/paasta/paasta_tools/kubernetes/application/controller_wrappers.py", line 308, in sync_horizontal_pod_autoscaler
    should_have_hpa = desired_hpa_spec and not autoscaling_is_paused()
  File "/nail/home/emanelsabban/pg/paasta/paasta_tools/autoscaling/autoscaling_service_lib.py", line 839, in autoscaling_is_paused
    with ZookeeperPool() as zk:
  File "/nail/home/emanelsabban/pg/paasta/paasta_tools/utils.py", line 3820, in __enter__
    hosts=load_system_paasta_config().get_zk_hosts(), read_only=True
  File "/nail/home/emanelsabban/pg/paasta/paasta_tools/utils.py", line 2084, in get_zk_hosts
    % self.directory
paasta_tools.utils.PaastaNotConfiguredError: Could not find zookeeper connection string in configuration directory: ./etc_paasta_playground/

It looks for a zookeeper connection string

Copy link
Member

Choose a reason for hiding this comment

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

ah interesting - forgot that we had this!

might be worth making a ticket for future-us to make this fail more smoothly (probably default to autoscaling enabled if we can't talk to zk?) since it doesn't seem ideal to have pending pods when there's no zk to talk to (even if this is only likely to happen when running in a playground env)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good, will create a ticket :)

Comment on lines 104 to 107
2. Using make targets

1. Run the make target ``make generate_paasta_playground`` to generate the ``etc_paasta_playground`` and ``soa_config_playground`` directories and ``deployments.json`` file.
2. Run make target ``make playground-api`` to run the PaaSTA API.
Copy link
Member

Choose a reason for hiding this comment

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

super-nit:

Suggested change
2. Using make targets
1. Run the make target ``make generate_paasta_playground`` to generate the ``etc_paasta_playground`` and ``soa_config_playground`` directories and ``deployments.json`` file.
2. Run make target ``make playground-api`` to run the PaaSTA API.
2. Using >ake targets
1. Run ``make generate_paasta_playground`` to run the Make target that generate the ``etc_paasta_playground`` and ``soa_config_playground`` directories and ``deployments.json`` file.
2. Run ``make playground-api`` to run the Make target that runs the PaaSTA API.

@EmanElsaban EmanElsaban force-pushed the u/emanelsabban/paasta_playground_documentation branch from c25cf00 to 8c44e15 Compare October 18, 2022 19:09
@EmanElsaban EmanElsaban requested a review from nemacysts October 18, 2022 19:30
@EmanElsaban EmanElsaban force-pushed the u/emanelsabban/paasta_playground_documentation branch from f1397ff to 0079022 Compare October 24, 2022 16:36
@EmanElsaban EmanElsaban requested a review from nemacysts October 24, 2022 16:37
There are mainly two use cases for PaaSTA playground:

1) :ref:`If the developer wants to debug different components of PaaSTA <debugging-paasta>`
2) :ref:`If the developer just wants to run paasta to see a change they developed in PaaSTA components <running-paasta>`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
2) :ref:`If the developer just wants to run paasta to see a change they developed in PaaSTA components <running-paasta>`
2) :ref:`If the developer just wants to run PaaSTA to see a change they developed in PaaSTA components <running-paasta>`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks will fix it now

@EmanElsaban EmanElsaban force-pushed the u/emanelsabban/paasta_playground_documentation branch from 9401a91 to 08f5dc3 Compare October 24, 2022 16:43
@EmanElsaban EmanElsaban merged commit 94e95c5 into master Oct 24, 2022
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.

2 participants