The aim of test is to create a simple HTTP service that stores and returns configurations that satisfy certain conditions. Since we love automating things, the service should be automatically deployed to kubernetes.
Your application MUST conform to the following endpoint structure and return the HTTP status codes appropriate to each operation.
Following are the endpoints that should be implemented:
| Name | Method | URL |
|---|---|---|
| List | GET |
/configs |
| Create | POST |
/configs |
| Get | GET |
/configs/{name} |
| Update | PUT/PATCH |
/configs/{name} |
| Delete | DELETE |
/configs/{name} |
| Query | GET |
/search/metadata.key=value |
Query example-1:
curl http://config-service/search/metadata.monitoring.enabled=trueResponse example:
[
{
"name": "datacenter-1",
"metadata": {
"monitoring": {
"enabled": "true"
},
"limits": {
"cpu": {
"enabled": "false",
"value": "300m"
}
}
}
},
{
"name": "datacenter-2",
"metadata": {
"monitoring": {
"enabled": "true"
},
"limits": {
"cpu": {
"enabled": "true",
"value": "250m"
}
}
}
},
]Query example-2:
curl http://config-service/search/metadata.allergens.eggs=trueResponse example-2:
[
{
"name": "burger-nutrition",
"metadata": {
"calories": 230,
"fats": {
"saturated-fat": "0g",
"trans-fat": "1g"
},
"carbohydrates": {
"dietary-fiber": "4g",
"sugars": "1g"
},
"allergens": {
"nuts": "false",
"seafood": "false",
"eggs": "true"
}
}
}
]- Config
- Name (string)
- Metadata (nested key:value pairs where both key and value are strings of arbitrary length)
Your application MUST serve the API on the port defined by the environment variable SERVE_PORT.
The application MUST fail if the environment variable is not defined.
The application MUST be deployable on a minikube cluster. Please provide manifest files and a script that deploys the application on a minikube cluster. The application MUST be accessible from outside the minikube cluster.
- The API MUST return valid JSON and MUST follow the endpoints set out above.
- You SHOULD write testable code and demonstrate unit testing it.
- You can use any testing, mocking libraries provided that you state the reasoning and it's simple to install and run.
- You SHOULD document your code and scripts.