apache / openwhisk-wskdeploy

Apache OpenWhisk utility for deploying and managing OpenWhisk projects and packages
https://openwhisk.apache.org/
Apache License 2.0
77 stars 74 forks source link

Delete APIs on undeploy #686

Closed mrutkows closed 6 years ago

mrutkows commented 6 years ago

In servicedeployer.go, I did not find a corresponding Delete for APIs that were created.

We have a

func (deployer *ServiceDeployer) createApi(api *whisk.ApiCreateRequest) error {
   // ...
}

which has no corresponding delete function.

pritidesai commented 6 years ago

There is something wrong with our API Gateway functionality. APIs are not getting created as part of deployment process. I ran API Gateway integration test in verbose mode and did not find any API creation calls:

./wskdeploy -m tests/src/integration/apigateway/manifest.yml  --verbose
Info: The API host is openwhisk.ng.bluemix.net, from .wskprops.
Info: The auth key is set, from .wskprops.
Info: The namespace is *, from .wskprops.
[ploy/utils.ParseOpenWhisk]:116:[Inf] Unmarshal OpenWhisk info from internet.
[.displayPreprocessingInfo]:1465:[Inf] Deploying package [api-gateway-test] ...[k.(*Client).addAuthHeader]:284:[Inf] Adding basic auth header; using authkey
REQUEST:
[PUT]   https://openwhisk.ng.bluemix.net/api/v1/namespaces/*/packages/api-gateway-test?overwrite=true
Req Headers
{
  "Authorization": [
    "*"
  ],
  "Content-Type": [
    "application/json"
  ],
  "User-Agent": [
    "OpenWhisk-Go-Client"
  ]
}
Req Body
{"name":"api-gateway-test","publish":false}

[go/whisk.PrintRequestInfo]:441:[Inf] Req Body (ASCII quoted string):
"{\"name\":\"api-gateway-test\",\"publish\":false}\n"
RESPONSE:Got response with code 200
Resp Headers
{
  "Access-Control-Allow-Headers": [
    "Authorization, Content-Type"
  ],
  "Access-Control-Allow-Origin": [
    "*"
  ],
  "Connection": [
    "Keep-Alive"
  ],
  "Content-Type": [
    "application/json"
  ],
  "Date": [
    "Wed, 24 Jan 2018 21:03:17 GMT"
  ],
  "Ibm_cloud_functions": [
    "OpenWhisk"
  ],
  "Server": [
    "nginx/1.11.13"
  ],
  "Set-Cookie": [
    ""
  ],
  "X-Backside-Transport": [
    "OK OK"
  ],
  "X-Global-Transaction-Id": [
    "3005799967"
  ]
}
Response body size is 143 bytes
Response body received:
{"name":"api-gateway-test","binding":{},"publish":false,"annotations":[],"version":"0.0.2","parameters":[],"namespace":"*"}
[o/whisk.PrintResponseInfo]:482:[Inf] Response body received (ASCII quoted string):
"{\"name\":\"api-gateway-test\",\"binding\":{},\"publish\":false,\"annotations\":[],\"version\":\"0.0.2\",\"parameters\":[],\"namespace\":\"*\"}"
[k.IsResponseResultSuccess]:637:[Wrn] IsResponseResultSuccess: failed to parse response result: <nil>
[hisk.parseSuccessResponse]:562:[Inf] Parsing HTTP response into struct type: **whisk.Package
[hisk.parseSuccessResponse]:571:[Inf] Successful parse of HTTP response into struct type: **whisk.Package
[displayPostprocessingInfo]:1480:[Inf] package [api-gateway-test] has been successfully deployed.
[.displayPreprocessingInfo]:1465:[Inf] Deploying action [api-gateway-test/greeting] ...[k.(*ActionService).Insert]:212:[Inf] Action insert route: actions/api-gateway-test/greeting?overwrite=true
[k.(*Client).addAuthHeader]:284:[Inf] Adding basic auth header; using authkey
REQUEST:
[PUT]   https://openwhisk.ng.bluemix.net/api/v1/namespaces/*/actions/api-gateway-test/greeting?overwrite=true
Req Headers
{
  "Authorization": [
    "*"
  ],
  "Content-Type": [
    "application/json"
  ],
  "User-Agent": [
    "OpenWhisk-Go-Client"
  ]
}
Req Body
{"name":"api-gateway-test/greeting","exec":{"kind":"nodejs:6","code":"/**\n * Return a simple greeting message for someone.\n *\n * @param name A person's name.\n * @param place Where the person is from.\n */\nfunction main(params) {\n    var name = params.name || params.payload || 'stranger';\n    var place = params.place || 'somewhere';\n    return {payload:  'Hello, ' + name + ' from ' + place + '!'};\n}\n\n"},"parameters":[{"key":"name","value":""},{"key":"place","value":""}],"publish":false}

[go/whisk.PrintRequestInfo]:441:[Inf] Req Body (ASCII quoted string):
"{\"name\":\"api-gateway-test/greeting\",\"exec\":{\"kind\":\"nodejs:6\",\"code\":\"/**\\n * Return a simple greeting message for someone.\\n *\\n * @param name A person's name.\\n * @param place Where the person is from.\\n */\\nfunction main(params) {\\n    var name = params.name || params.payload || 'stranger';\\n    var place = params.place || 'somewhere';\\n    return {payload:  'Hello, ' + name + ' from ' + place + '!'};\\n}\\n\\n\"},\"parameters\":[{\"key\":\"name\",\"value\":\"\"},{\"key\":\"place\",\"value\":\"\"}],\"publish\":false}\n"
RESPONSE:Got response with code 200
Resp Headers
{
  "Access-Control-Allow-Headers": [
    "Authorization, Content-Type"
  ],
  "Access-Control-Allow-Origin": [
    "*"
  ],
  "Connection": [
    "Keep-Alive"
  ],
  "Content-Type": [
    "application/json"
  ],
  "Date": [
    "Wed, 24 Jan 2018 21:03:17 GMT"
  ],
  "Ibm_cloud_functions": [
    "OpenWhisk"
  ],
  "Server": [
    "nginx/1.11.13"
  ],
  "Set-Cookie": [
    ""
  ],
  "X-Backside-Transport": [
    "OK OK"
  ],
  "X-Global-Transaction-Id": [
    "3005802703"
  ]
}
Response body size is 670 bytes
Response body received:
{"name":"greeting","publish":false,"annotations":[{"key":"exec","value":"nodejs:6"}],"version":"0.0.2","exec":{"kind":"nodejs:6","code":"/**\n * Return a simple greeting message for someone.\n *\n * @param name A person's name.\n * @param place Where the person is from.\n */\nfunction main(params) {\n    var name = params.name || params.payload || 'stranger';\n    var place = params.place || 'somewhere';\n    return {payload:  'Hello, ' + name + ' from ' + place + '!'};\n}\n\n","binary":false},"parameters":[{"key":"name","value":""},{"key":"place","value":""}],"limits":{"timeout":60000,"memory":256,"logs":10},"namespace":"*/api-gateway-test"}
[o/whisk.PrintResponseInfo]:482:[Inf] Response body received (ASCII quoted string):
"{\"name\":\"greeting\",\"publish\":false,\"annotations\":[{\"key\":\"exec\",\"value\":\"nodejs:6\"}],\"version\":\"0.0.2\",\"exec\":{\"kind\":\"nodejs:6\",\"code\":\"/**\\n * Return a simple greeting message for someone.\\n *\\n * @param name A person's name.\\n * @param place Where the person is from.\\n */\\nfunction main(params) {\\n    var name = params.name || params.payload || 'stranger';\\n    var place = params.place || 'somewhere';\\n    return {payload:  'Hello, ' + name + ' from ' + place + '!'};\\n}\\n\\n\",\"binary\":false},\"parameters\":[{\"key\":\"name\",\"value\":\"\"},{\"key\":\"place\",\"value\":\"\"}],\"limits\":{\"timeout\":60000,\"memory\":256,\"logs\":10},\"namespace\":\"*/api-gateway-test\"}"
[k.IsResponseResultSuccess]:637:[Wrn] IsResponseResultSuccess: failed to parse response result: <nil>
[hisk.parseSuccessResponse]:562:[Inf] Parsing HTTP response into struct type: **whisk.Action
[hisk.parseSuccessResponse]:571:[Inf] Successful parse of HTTP response into struct type: **whisk.Action
[displayPostprocessingInfo]:1480:[Inf] action [api-gateway-test/greeting] has been successfully deployed.
Success: Deployment completed successfully.

This is definitely bug, as part of this fix, please make sure deployment and undeployment of API Gateway functionality is supported by wskdeploy. You can find more details about API Gateway here: https://github.com/apache/incubator-openwhisk/blob/master/docs/apigateway.md

mrutkows commented 6 years ago

Well this should clearly be critical/top priority.

pritidesai commented 6 years ago

working on it ...