faas: Add missing attributes to /system/function/{functionName}
Expected Behaviour
Attributes used to create a function with the POST endpoint should be mirrored when retrieving the function meta data using the GET endpoint
Current Behaviour
The attributes are currently as follows:
| Name | POST | GET |
|---|---|---|
| service |
|
|
| network |
|
|
| image |
|
|
| envProcess |
|
|
| envVars |
|
|
| constraints |
|
|
| labels |
|
|
| annotations |
|
|
| secrets |
|
|
| registryAuth |
|
|
| limits |
|
|
| requests |
|
|
| readOnlyRootFilesystem |
|
|
Possible Solution
swagger.ymladd missing attributes toFunctionListEntrygateway/requests/requests.goadd missing attributes toFunctiontypefaas-swarm/handlers/reader.goadd missing attributes inreadServicesfuncfaas-netesadd missing attributesfaas-operatoradd missing attributesfaas-clidescribeverb when merged may need updating
Context
I’m writing a terraform provider for openfaas, to work well with terraform, it’s best if the underlying infrastructure apis have mirrored POST/GET endpoints. This is also a very common practice in REST apis
About this issue
- Original URL
- State: open
- Created 6 years ago
- Comments: 35 (29 by maintainers)
Let’s move this forward for faasd and faas-netes. Cc @Waterdrips @LucasRoesler
We will be discussing this issue in our next members call. Will let you know where we get.
Happy to go with
option 1. However; looks like it would be a breaking change though, if I’ve understood the proposal correctlyTo create a new function resource you would
POSTto/system/functions/specand read the resourceGETfrom/system/functions/{name}/spec. Presumably older versions of the cli would stillPOSTto/system/functionsand other components would read from/system/functions/{name}?If we are to go with option 1, I would prefer to
GETfrom/system/functions/spec/{name}, instead of/system/functions/{name}/spec/. Think that more closely aligns with a restful API. You are creating a function spec resource and reading the spec resource with the identifier{name}@alexellis if we are worried about the latency/size impact, we could
/system/functions/specand/system/functions/{name}/spec. So that/system/functionswould just be a summary.specfield and only include it if a GET parameter is sent.specfield and a GET parameterhide_specto explicitly hide it in those cases where you don’t want itI think option 1 is easier to document and maintain