gardener / ops-toolbelt

Useful tools and operations guide for gardener landscapes
Apache License 2.0
15 stars 26 forks source link

Added a cheatsheet to help operators when using the etcdctl tool #100

Closed aaronfern closed 7 months ago

aaronfern commented 11 months ago

What this PR does / why we need it: This PR adds a cheatsheet that will help operators when debugging issues with etcd or using the etcdctl tool. This script prints out file paths of certificates the etcdctl tool uses and also prints out some common etcdctl commands

Which issue(s) this PR fixes: Fixes #

Special notes for your reviewer:

Release note:

Added a cheatsheet to help operators when debugging etcd
petersutter commented 10 months ago

Hi @aaronfern I tried to test it out but I guess there are some issues (or I didn't know how to properly use it)

$ ghelp
+---------------------------------+-----------------------------------+-------------------------------------------------------------------------------------------------------------------------+
| TOOL/PACKAGE                    | VERSION                           | NOTES                                                                                                                   |
+=================================+===================================+=========================================================================================================================+
...
| install_etcdctl                 |                                   | Bash script which installs the `etcdctl` tool in the container. If you are running this container as non-root, execute  |
|                                 |                                   | the `install-etcdctl` script in the `/nonroot/hacks` directory.                                                         |
+---------------------------------+-----------------------------------+-------------------------------------------------------------------------------------------------------------------------+
| install_etcd_cheatsheet         |                                   | Bash script which prints out etcd certificate paths and handy etcdctl comands                                           |
+---------------------------------+-----------------------------------+-------------------------------------------------------------------------------------------------------------------------+
...

$ install_etcd_cheatsheet
bash: install_etcd_cheatsheet: command not found

also print-etcd-cheatsheet.sh is not executable

$ ls -la /hacks/print-etcd-cheatsheet.sh 
-rw-r--r-- 1 root root 5572 Dec 22 12:12 /hacks/print-etcd-cheatsheet.sh

and it would be nice if the user does not have to set the PATH env var and that it's part of the installation

aaronfern commented 10 months ago

Thanks for your review @petersutter

I've changes the file permission and the command description, so I hope it runs now

it would be nice if the user does not have to set the PATH env var and that it's part of the installation

I wanted this too initially, however I was unable to set the PATH env var from the script and hence I added a note for the user to manually do it. Any idea how I would be able to do that?

petersutter commented 10 months ago

it would be nice if the user does not have to set the PATH env var and that it's part of the installation

I wanted this too initially, however I was unable to set the PATH env var from the script and hence I added a note for the user to manually do it. Any idea how I would be able to do that?

@plkokanov maybe?

plkokanov commented 10 months ago

it would be nice if the user does not have to set the PATH env var and that it's part of the installation

I wanted this too initially, however I was unable to set the PATH env var from the script and hence I added a note for the user to manually do it. Any idea how I would be able to do that?

@plkokanov maybe?

Hmm, it should be possible with a bash command similar to this: https://github.com/gardener/ops-toolbelt/blob/0a6d6f3f78cf96233eee39067c0f318eb06cfb78/dockerfile-configs/common-components.yaml#L141-L144

This generator stuff seems to be asking for some refactoring btw 😅

plkokanov commented 8 months ago

I was mistaken in my previous comment

The correct way to add the new script to the PATH env variable would be to extend the environment variables when building the container: https://github.com/gardener/ops-toolbelt/blob/f04ab43a645098a45eb6a8768d6e8130b9f45e52/dockerfile-configs/common-components.yaml#L146-L148

You can just add

  - PATH=/nonroot/hacks:$PATH

@aaronfern btw do you plan to continue with this PR. I'm really sorry for replying so late, but was busy with other stuff and this slipped my mind (yet again)

aaronfern commented 8 months ago

Hey @plkokanov Yes, I will continue with this PR Sorry, got sidetracked and lost sight of this PR

Will resolve all comments asap

aaronfern commented 8 months ago

Thanks @petersutter and @plkokanov for your reviews and I'm very sorry for the delay in addressing your comments

I've addressed all your comments. PTAL whenever possible