Closed tangjeff0 closed 5 years ago
I think it would better if the
listener
options included bothport
andserver
(the caller must provide exactly one of the two). The kubernetes ingress availability check would be handled by the caller of the plugin (or maybe a small wrapper plugin?), rather than the btp plugin itself. Not all consumers of ilp-plugin-btp/mini-accounts will be using kubernetes, and features specific to the container orchestration don't really belong in the plugin.
Availability checks by cloud providers are not too uncommon. Therefore I've added a boolean field in the _listener
struct that will enable these checks to pass. By default, these checks will not occur and a plain websocket server will be used, as in the current version of master. Also, the logic of the httpServer and wsServer have been separated. Thoughts @sentientwaffle @sharafian ?
They aren't uncommon, but they aren't universal either. I still think the options should be able to provide either port
or server
. When its the latter, I don't think the plugin should add an endpoint.
To include this behavior you could create a wrapper plugin that extends the btp plugin.
LGTM once tests are passing
Kubernetes's ingress uses availability checks to make sure the endpoints that it routes traffic towards are indeed available. Because these checks use http(s), an http server must actually be responding with affirmatives (e.g.
200 OK
). Fortunately, the websocket library used in this plugin can take in aserver
option, such that it may provide websocket connections as it always has, and additionally serve http responses as well.