sostheim / krak8s

API Service for Kraken and Kubernetes Commands
Apache License 2.0
1 stars 5 forks source link

Protect Cluster Resources from All Mutating Operations Until They Reach Steady State #14

Closed sostheim closed 7 years ago

sostheim commented 7 years ago

See linked issue: https://github.com/reactioncommerce/launchdock/issues/80

Deleting a resource record while that resource is still being created causes the application to drop a stack trace and fails to resolve the state after the failure.

sostheim commented 7 years ago

Recreate the issue:

$ curl -i -XPOST -H "Content-Type: application/json" -d '{"name":"reaction-engineering"}'  http://localhost:8080/v1/projects
HTTP/1.1 201 Created
Content-Type: application/project+json
Date: Mon, 02 Oct 2017 18:01:37 GMT
Content-Length: 134

{"created_at":"2017-10-02T11:01:37.687635214-07:00","id":"4daf554e","name":"reaction-engineering","namespaces":null,"type":"project"}

$ curl -i -XPOST -H "Content-Type: application/json" -d '{"name":"reaction-engineering"}'  http://localhost:8080/v1/projects/4daf554e/namespaces
HTTP/1.1 201 Created
Content-Type: application/namespace+json
Date: Mon, 02 Oct 2017 18:03:16 GMT
Content-Length: 155

{"applications":null,"created_at":"2017-10-02T11:03:16.322428141-07:00","id":"f2d65ad1","name":"reaction-engineering","resources":null,"type":"namespace"}

$ curl -i -XPOST -H "Content-Type: application/json" -d '{"namespace_id":"f2d65ad1", "nodePoolSize":1}'  http://localhost:8080/v1/projects/4daf554e/cluster
HTTP/1.1 400 Bad Request
Content-Type: application/vnd.goa.error
Date: Mon, 02 Oct 2017 18:04:51 GMT
Content-Length: 257

{"id":"2ToPwjeS","code":"bad_request","status":400,"detail":"[vjJ0ytjO] 400 invalid_request: response.nodePoolSize must be greater than or equal to 3 but got value 1, attribute: response.nodePoolSize, value: 1, comp: greater than or equal to, expected: 3"}

Previously this last step left an unassociated OID in place for a non-existent object. The result was a panic stack trace during the delete step that follows.

$ curl -i -XDELETE http://localhost:8080/v1/projects/4daf554e/namespaces/f2d65ad1
HTTP/1.1 204 No Content
Date: Mon, 02 Oct 2017 18:06:22 GMT