-
Notifications
You must be signed in to change notification settings - Fork 607
Support API Gateway #1108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Support API Gateway #1108
Changes from all commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
48c3f13
Add comments
deliahu 00590f4
Merge branch 'master' into api-gateway
tthebst dac1dd9
added vpc-link and api creation to install.sh script
tthebst baf392e
Merge branch 'master' of github.com:cortexlabs/cortex into api-gateway
deliahu 97b1c20
Add api gateway config
deliahu 895198b
added errorhandling for integration and removed deletetion rom uninst…
tthebst bf14848
added delete function for api, vpc link in cluster down command
tthebst ce5a01c
fix in vpclink, api exists function
tthebst b277441
added stage creation to install.sh
tthebst fa39b06
added tags to stage creatin in install.sh
tthebst 437e528
added route && integration on api deployment
tthebst 2dcbbec
fixed typo in install script && added delete logic for internal elb
tthebst 8de249a
added api gateway for external facing elb
tthebst 2ad13ab
removed BaseURL from GetAPIsResponse and DeployResponse schemas
tthebst 613d173
formatting and added GetInternalBaseURL fucntion
tthebst faca52e
fixed deletion for non api gateway exposed APIs and added GetAPISpecF…
tthebst bacd528
Merge branch 'master' of github.com:cortexlabs/cortex into api-gateway
tthebst d8a9f73
minor fixes/typos
tthebst ad34fe9
fixed small issues and added logic for double delete and deploy
tthebst 78d5bb9
fixed typo
tthebst 39ff35d
Merge branch 'master' of github.com:cortexlabs/cortex into api-gateway
tthebst 9351d9b
minor typos and formatting fixes
tthebst 00c5ac1
added license and fixed linting issue
tthebst caf5eed
Misc
deliahu 26ef984
Update api gateway during api update
deliahu cb9f2a5
added paginator
tthebst 3618f8f
Move api gateway to config
deliahu 73ec256
logic fix in gateway and aded paging to getVPCLink getAPIGateway
tthebst caeb5a6
Merge branch 'api-gateway' of github.com:cortexlabs/cortex into api-g…
tthebst 634523d
minor
tthebst a1b5091
Update docs
deliahu 2e30ea5
Update paginators
deliahu 51227c8
moved api gateway creation in install.sh
tthebst 2c4b937
Add TODO
deliahu f0142a9
Update comments in install.sh
deliahu 20985f3
Update architecture diagram
deliahu 7f89641
Show operator logs when it fails to start
deliahu d5ab500
Create vpc link integration before operator
deliahu 43d5b3f
Rearrange install.sh (just to optimize)
deliahu 9a9cd9b
Update install.sh
deliahu 0e65f59
Update networking.md
deliahu 71263d4
Update security.md
deliahu 671d1cc
Small fixes
deliahu 939993a
Add API Gateway custom domain instructions
deliahu e78bd4b
Use load balancer port 443 instead of 80
deliahu ebd43c8
Use port 80 instead of 443
deliahu 0895aad
Delete api mappings
deliahu ca1b863
Update cluster down error messages
deliahu 2bd7cdb
Update cluster deletion logic
deliahu db396f9
Update apigateway.go
deliahu b8f02a2
Print correct errors
deliahu 261f084
Update cluster down prints
deliahu 3d0e4a5
Update route deletion
deliahu a3a43f2
Support updating endpoint of running API
deliahu 2a56d9c
Add information to api gateway errors
deliahu 27b31f4
Fix trim prefix bug
deliahu 0029aa5
Remove unused APIs
deliahu bbd11bd
Merge branch 'master' of github.com:cortexlabs/cortex into api-gateway
deliahu b0939f1
Add error handling to install.sh
deliahu 71e3c43
Allow unbound variables in install.sh
deliahu 07ab453
Ignore errors when attempting to create api gateway stage
deliahu f7df15d
Clean up docs
deliahu 7c9ac6e
Format cli output
deliahu 31ff8c8
Rearrange apigateway.go
deliahu 11b204d
Allow error in create_gateway_integration.py to propagate
deliahu 7f82ede
Update docs
deliahu 268f7e3
Merge branch 'master' into api-gateway
deliahu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# Networking | ||
|
||
_WARNING: you are on the master branch, please refer to the docs on the branch that matches your `cortex version`_ | ||
|
||
APIs are deployed with an internet-facing API Gateway by default (the API Gateway forwards requests to the API load balancer). Each API can be independently configured to not create the API Gateway endpoint by setting `api_gateway: none` in the `networking` field of the [api configuration](api-configuration.md). If the API Gateway endpoint is not created, your API can still be accessed via the API load balancer; `cortex get API_NAME` will show the load balancer endpoint if API Gateway is disabled. API Gateway is enabled by default, and is generally recommended unless it doesn't support your use case due to limitations such as the 29 second request timeout, or if you are keeping your APIs internal to your VPC. See below for common configurations. | ||
|
||
By default, the API load balancer is internet-facing. You can configure your API load balancer to be internal by setting `api_load_balancer_scheme: internal` in your [cluster configuration](../cluster-management/config.md) file (before creating your cluster). This will force external traffic to go through your API Gateway endpoint, or if you disabled API Gateway for your API, it will make your API only accessible through VPC Peering. Note that if API Gateway is used, endpoints will be internet-facing regardless of `api_load_balancer_scheme`. See below for common configurations. | ||
|
||
## Common API networking configurations | ||
|
||
### Public https endpoint (with API Gateway) | ||
|
||
This is the most common configuration for public APIs. [Custom domains](../guides/custom-domain.md) can be used with this setup, but are not required. | ||
|
||
```yaml | ||
# cluster.yaml | ||
|
||
api_load_balancer_scheme: internal | ||
``` | ||
|
||
```yaml | ||
# cortex.yaml | ||
|
||
- name: my-api | ||
... | ||
networking: | ||
api_gateway: public # this is the default, so can be omitted | ||
``` | ||
|
||
### Internal https endpoint | ||
|
||
You can configure your API to be internal (i.e. not internet-facing). If you do this, you must use [VPC Peering](../guides/vpc-peering.md) to connect to your APIs. | ||
|
||
The SSL certificate on the API load balancer is autogenerated during installation using `localhost` as the Common Name (CN). Therefore, clients will need to skip certificate verification when making HTTPS requests (e.g. `curl -k`). Alternatively, you can set up a [custom domain](../guides/custom-domain.md), which will use ACM to provision SSL certs for your domain. | ||
|
||
```yaml | ||
# cluster.yaml | ||
|
||
api_load_balancer_scheme: internal # this is the default, so can be omitted | ||
|
||
# use this to configure a custom domain | ||
# if you don't use a custom domain, clients will need to skip certificate verification when making HTTPS requests (e.g. `curl -k`) | ||
ssl_certificate_arn: arn:aws:acm:us-west-2:***:certificate/*** | ||
``` | ||
|
||
```yaml | ||
# cortex.yaml | ||
|
||
- name: my-api | ||
... | ||
networking: | ||
api_gateway: none | ||
``` | ||
|
||
### Internal http endpoint | ||
|
||
You can configure your API to be internal (i.e. not internet-facing). If you do this, you must use [VPC Peering](../guides/vpc-peering.md) to connect to your APIs. | ||
|
||
```yaml | ||
# cluster.yaml | ||
|
||
api_load_balancer_scheme: internal # this is the default, so can be omitted | ||
``` | ||
|
||
```yaml | ||
# cortex.yaml | ||
|
||
- name: my-api | ||
... | ||
networking: | ||
api_gateway: none | ||
``` | ||
|
||
### Public https endpoint (without API Gateway) | ||
|
||
API gateway is generally recommended for internet-facing https APIs, but there may be a situation where you don't wish to use it (e.g. requests take longer than 29 seconds to complete, which is the max for API Gateway). In this case, clients can connect directly to the API load balancer. | ||
|
||
The SSL certificate on the API load balancer is autogenerated during installation using `localhost` as the Common Name (CN). Therefore, clients will need to skip certificate verification when making HTTPS requests (e.g. `curl -k`). Alternatively, you can set up a [custom domain](../guides/custom-domain.md), which will use ACM to provision SSL certs for your domain. | ||
|
||
```yaml | ||
# cluster.yaml | ||
|
||
api_load_balancer_scheme: internet-facing # this is the default, so can be omitted | ||
|
||
# use this to configure a custom domain | ||
# if you don't use a custom domain, clients will need to skip certificate verification when making HTTPS requests (e.g. `curl -k`) | ||
ssl_certificate_arn: arn:aws:acm:us-west-2:***:certificate/*** | ||
``` | ||
|
||
```yaml | ||
# cortex.yaml | ||
|
||
- name: my-api | ||
... | ||
networking: | ||
api_gateway: none | ||
``` | ||
|
||
### Public http endpoint | ||
|
||
If you don't wish to use https for your public API, you can simply disable API gateway (your API will be accessed directly via the API load balancer): | ||
|
||
```yaml | ||
# cluster.yaml | ||
|
||
api_load_balancer_scheme: internet-facing # this is the default, so can be omitted | ||
``` | ||
|
||
```yaml | ||
# cortex.yaml | ||
|
||
- name: my-api | ||
... | ||
networking: | ||
api_gateway: none | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
you may wish to remove
->you may remove