Closed alexellis closed 1 year ago
Add support for namespace mutations
Adds support for: Get, Create, Update, Delete
List, delete non-existing, delete existing, list, get
$ curl -i http://admin:$(sudo cat /var/lib/faasd/secrets/basic-auth-password)@127.0.0.1:8080/system/namespaces;echo; HTTP/1.1 200 OK Content-Length: 29 Content-Type: application/json Date: Fri, 07 Jul 2023 10:29:08 GMT ["openfaas-fn","dev4","dev6"] $ $ curl -i http://admin:$(sudo cat /var/lib/faasd/secrets/basic-auth-password)@127.0.0.1:8080/system/namespace/dev1 -d '{"name":"dev1", "labels":{"openfaas":"1"}}' -X DELETE; echo HTTP/1.1 404 Not Found Content-Length: 25 Content-Type: text/plain; charset=utf-8 Date: Fri, 07 Jul 2023 10:29:18 GMT X-Content-Type-Options: nosniff namespace dev1 not found $ curl -i http://admin:$(sudo cat /var/lib/faasd/secrets/basic-auth-password)@127.0.0.1:8080/system/namespace/dev6 -d '{"name":"dev6", "labels":{"openfaas":"1"}}' -X DELETE; echo HTTP/1.1 202 Accepted Content-Length: 0 Date: Fri, 07 Jul 2023 10:29:26 GMT $ curl -i http://admin:$(sudo cat /var/lib/faasd/secrets/basic-auth-password)@127.0.0.1:8080/system/namespaces;echo; HTTP/1.1 200 OK Content-Length: 22 Content-Type: application/json Date: Fri, 07 Jul 2023 10:29:29 GMT ["openfaas-fn","dev4"] $ curl -i http://admin:$(sudo cat /var/lib/faasd/secrets/basic-auth-password)@127.0.0.1:8080/system/namespace/dev4 HTTP/1.1 200 OK Content-Length: 42 Content-Type: application/json Date: Fri, 07 Jul 2023 10:29:43 GMT {"name":"dev4","labels":{"openfaas":"1"}} $
Update labels:
$ curl -i http://admin:$(sudo cat /var/lib/faasd/secrets/basic-auth-password)@127.0.0.1:8080/system/namespace/dev4 HTTP/1.1 200 OK Content-Length: 42 Content-Type: application/json Date: Fri, 07 Jul 2023 10:30:19 GMT {"name":"dev4","labels":{"openfaas":"1"}} $ $ curl -i http://admin:$(sudo cat /var/lib/faasd/secrets/basic-auth-password)@127.0.0.1:8080/system/namespace/dev4 -d '{"name":"dev4", "labels":{"openfaas":"1", "alex":"1"}}' -X PUT HTTP/1.1 202 Accepted Content-Length: 0 Date: Fri, 07 Jul 2023 10:30:34 GMT $ curl -i http://admin:$(sudo cat /var/lib/faasd/secrets/basic-auth-password)@127.0.0.1:8080/system/namespace/dev4 HTTP/1.1 200 OK Content-Length: 53 Content-Type: application/json Date: Fri, 07 Jul 2023 10:30:36 GMT {"name":"dev4","labels":{"alex":"1","openfaas":"1"}} $ curl -i http://admin:$(sudo cat /var/lib/faasd/secrets/basic-auth-password)@127.0.0.1:8080/system/namespace/dev4 -d '{"name":"dev4", "labels":{"openfaas":"1"}}' -X PUT HTTP/1.1 202 Accepted Content-Length: 0 Date: Fri, 07 Jul 2023 10:30:41 GMT $ curl -i http://admin:$(sudo cat /var/lib/faasd/secrets/basic-auth-password)@127.0.0.1:8080/system/namespace/dev4 HTTP/1.1 200 OK Content-Length: 42 Content-Type: application/json Date: Fri, 07 Jul 2023 10:30:43 GMT {"name":"dev4","labels":{"openfaas":"1"}} $
Note that namespace creation requires a trailing slash:
$ curl -i http://admin:$(sudo cat /var/lib/faasd/secrets/basic-auth-password)@127.0.0.1:8080/system/namespace/ -d '{"name":"dev10", "labels":{"openfaas":"1"}}' -X POST HTTP/1.1 201 Created Content-Length: 0 Date: Fri, 07 Jul 2023 10:31:36 GMT $ curl -i http://admin:$(sudo cat /var/lib/faasd/secrets/basic-auth-password)@127.0.0.1:8080/system/namespaces;echo; HTTP/1.1 200 OK Content-Length: 30 Content-Type: application/json Date: Fri, 07 Jul 2023 10:31:42 GMT ["openfaas-fn","dev10","dev4"] $
@nitishkumar71 if you have any feedback please let me know and I'll follow up
Description
Add support for namespace mutations
Motivation and Context
Adds support for: Get, Create, Update, Delete
How Has This Been Tested?
List, delete non-existing, delete existing, list, get
Update labels:
Note that namespace creation requires a trailing slash:
Types of changes