|
| 1 | +# Cluster Node API |
| 2 | + |
| 3 | +## Getting started |
| 4 | + |
| 5 | +### System requirements |
| 6 | + |
| 7 | +- git |
| 8 | +- docker |
| 9 | +- docker-compose |
| 10 | + |
| 11 | +## Startup |
| 12 | + |
| 13 | +A `Makefile` provides a couple of commands |
| 14 | + |
| 15 | +```shell |
| 16 | +$ make |
| 17 | +Usage: |
| 18 | + make [target] |
| 19 | + |
| 20 | +Available targets: |
| 21 | + help: Help |
| 22 | + start: starts platform |
| 23 | + recreate: destroys containers and recreates platform |
| 24 | +``` |
| 25 | +To startup the project just run `make start`. |
| 26 | +Wait a bit for the containers to start and then browse [http://localhost:3000/api](http://localhost:3000/api) and you should see a Swagger UI |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +## Authentication |
| 31 | +```text |
| 32 | +username: john.doe |
| 33 | +password: password |
| 34 | +``` |
| 35 | +```shell |
| 36 | +curl --request POST 'http://localhost:3000/api/v1/auth/login' \ |
| 37 | +--header 'Content-Type: application/json' \ |
| 38 | +--data-raw '{ |
| 39 | + "username": "john.doe", |
| 40 | + "password": "password" |
| 41 | +}' |
| 42 | +``` |
| 43 | + |
| 44 | +it will give an access token that should be used to access other APIs |
| 45 | + |
| 46 | +```shell |
| 47 | +{ |
| 48 | + "access_token": "<THE GENERATED TOKEN>" |
| 49 | +} |
| 50 | +``` |
| 51 | + |
| 52 | +```shell |
| 53 | +curl --request GET 'http://localhost:3000/api/v1/<some endpoint>' \ |
| 54 | +--header 'Authorization: Bearer <THE GENERATED TOKEN>' |
| 55 | +``` |
| 56 | + |
| 57 | +<details> |
| 58 | + <summary>See Assignment document!</summary> |
| 59 | + |
| 60 | +# Interview Assignment - Cluster Node API |
| 61 | + |
| 62 | +Hello, dear candidate! Thanks for taking the time to try this out. |
| 63 | + |
| 64 | +The goal of this assignment is to assert (to some degree) your skills as a software engineer. You should focus on showcasing your skill at coding and problem solving. The solution is intentionally open-ended, to give you space for personal interpretation, but for all intents and purposes you can pretend that you're building a production-ready application! |
| 65 | + |
| 66 | +You can develop the assignment in any common language you can demonstrate being comfortable coding with. |
| 67 | + |
| 68 | +You're **allowed and encouraged** to use third party libraries and tools, as long as they are free and open source. An effective developer knows what to build and what to reuse, but also how his/her tools work. Be prepared to answer some questions about these, like why you chose them and what other alternatives you considered. |
| 69 | + |
| 70 | +As this is a code review process, please minimize generated code, as this might make our jobs as reviewers more difficult. |
| 71 | + |
| 72 | +_Note: While we love open source at SUSE, please do not create a public repo with your assignment in! This test is only shared with people interviewing, and for obvious reasons we'd like it to remain this way._ |
| 73 | + |
| 74 | +## Instructions |
| 75 | + |
| 76 | +1. Clone this repository. |
| 77 | +2. Create a pull request targeting the master branch of this repository. |
| 78 | + This PR should contain setup instructions for your application and a breakdown of the technologies & packages you chose to use, why you chose to use them, and the design decisions you made. |
| 79 | +3. Reply to the email thread you're having with our HR department telling them we can start reviewing your code. |
| 80 | + |
| 81 | +## Requirements |
| 82 | + |
| 83 | +Create a simple API to manage nodes of computing clusters. |
| 84 | +We'll refer to this as "The API" throughout the rest of this document. |
| 85 | + |
| 86 | +There are two possible types of end users for this API: an unauthenticated one, and an authenticated one. We'll refer to these as "anonymous user" and "privileged user" respectively. The privileged user can implicitly also do everything the anonymous user can. |
| 87 | + |
| 88 | +- As an anonymous user, I shall be able to access The API remotely. |
| 89 | +- As an anonymous user, I shall be able to read a list of features The API offers. |
| 90 | +- As an anonymous user, I shall be informed when trying to use a feature that is only available to privileged users. |
| 91 | +- As a privileged user, I shall be able to search for nodes, either by node name or by cluster name. |
| 92 | +- As a privileged user, I shall be able to create/read/update/delete nodes. |
| 93 | +- As a privileged user, I shall be able to issue power-on/shutdown/reboot commands to a single node. |
| 94 | + |
| 95 | +### Constraints and details |
| 96 | + |
| 97 | +- The achitectural patterns, protocols and schemas used to implement The API are left as free design decisions. |
| 98 | +- The only required entity handled by The API is a cluster _node_. Clusters are not required to be handled as a dedicated entity. |
| 99 | +- The state represented by The API obviously doesn't have to be an actual cluster: the _single source of truth_ is expected to be simulated by any mean necessary (filesystem, database, object storage, etc); the only requirement is that such state must be persistent, i.e. restarting The API doesn't clear the data. |
| 100 | +- The API itself doesn't _need_ to be "containerized" but, as a developer, I should be able to perform changes to the source code of The API and observe the results, by building/running it, on a Linux system which only provides an OCI container engine, without installing any new packages. |
| 101 | +- Additional features you might want to autonomously define and implement are welcome! |
| 102 | + |
| 103 | + |
| 104 | +## What to expect from the review |
| 105 | + |
| 106 | +The review of your solution will happen in two phases: |
| 107 | +1. First, you'll have a chance to interact with the interviewer[s] in a traditional asynchronous code review, like you would do on GitHub every day. |
| 108 | +2. After the async peer review is done, we'll schedule a live chat with team, where further in-depth questions might be asked, to give you the chance to meet your potential future colleagues! |
| 109 | + |
| 110 | +## Good luck |
| 111 | + |
| 112 | +Code something awesome! |
| 113 | + |
| 114 | +</details> |
0 commit comments