Skip to content

Commit

Permalink
Support Direct VPC Egress
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfthom committed Mar 27, 2024
1 parent 587628c commit c107048
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ A Github Action that deploys a service to Google Cloud Run (GCP managed Knative-
| `no_traffic` | Set to true to just deploy a new revision without shifting traffic | `false` | false | [gcloud run deploy](https://cloud.google.com/sdk/gcloud/reference/run/deploy#--no-traffic) |
| `cloudsql_instances` | Comma separated list of CloudSQL instances to connect to | | false | [gcloud run deploy](https://cloud.google.com/sdk/gcloud/reference/run/deploy#--set-cloudsql-instances) |
| `vpc_connector` | Name of the Serverless VPC Access connector to use with this service | | false | [gcloud run deploy](https://cloud.google.com/sdk/gcloud/reference/run/deploy#--vpc-connector) |
| `vpc_egress` | Outbound traffic configuration, if a vpc_connector is configured; options are: `private-ranges-only`, `all-traffic` | `private-ranges-only` | false | [gcloud run deploy](https://cloud.google.com/sdk/gcloud/reference/run/deploy#--vpc-egress) |
| `ingress` | Allowed ingress traffic sources; options are: `all`, `internal`, `internal-and-cloud-load-balancing` | `all` | false | [gcloud run deploy](https://cloud.google.com/sdk/gcloud/reference/run/deploy#--ingress) |
| `vpc_egress` | Outbound traffic configuration, if a vpc_connector is configured; options are: `private-ranges-only`, `all-traffic` | `private-ranges-only` | false | [gcloud run deploy](https://cloud.google.com/sdk/gcloud/reference/run/deploy#--vpc-egress) |
| `vpc_network` | Name of VPC network when using direct VPC egress w/o vpc connector | | false | [gcloud run deploy](https://cloud.google.com/run/docs/configuring/vpc-direct-vpc#direct-vpc-service) |
| `vpc_subnet` | Name of VPC network's subnet when using direct VPC egress w/o vpc connector | | false | [gcloud run deploy](https://cloud.google.com/run/docs/configuring/vpc-direct-vpc#direct-vpc-service) |
| `vpc_network_tag_names` | Comma-separated list of network tags for the VPC network to be used | | false | [gcloud run deploy](https://cloud.google.com/run/docs/configuring/vpc-direct-vpc#direct-vpc-service)|
| `ingress` | Allowed ingress traffic sources; options are: `all`, `internal`, `internal-and-cloud-load-balancing` | `all` | false | [gcloud run deploy](https://cloud.google.com/sdk/gcloud/reference/run/deploy#--ingress) |
| `execution_environment` | Selects the execution environment where the application will run; options are: `gen1`, `gen2` | | false | [gcloud run deploy](https://cloud.google.com/sdk/gcloud/reference/run/deploy#--execution-environment), [cloud run docs](https://cloud.google.com/run/docs/about-execution-environments) |
| `debug` | Whether the gcloud commands should be printed to output | `false` | false | |

Expand Down
12 changes: 12 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ inputs:
description: 'Outbound traffic configuration, if a vpc_connector is configured'
required: false
default: 'private-ranges-only'
vpc_network:
description: 'Name of VPC network when using direct VPC egress'
required: false
default: ''
vpc_subnet:
description: 'Name of VPC network''s subnet'
required: false
default: ''
vpc_network_tag_names:
description: : 'Comma-separated list of network tags'

Check failure on line 96 in action.yml

View workflow job for this annotation

GitHub Actions / lint

96:18 syntax error: mapping values are not allowed here (syntax)
required: false
default: ''
ingress:
description: 'Allowed ingress traffic sources'
required: false
Expand Down
17 changes: 17 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,22 @@ if [ -n "$INPUT_VPC_CONNECTOR" ]; then
fi
fi

VPC_NETWORK="--clear-network"
VPC_SUBNET=""
VPC_NETWORK_TAGS="--clear-network-tags"

if [ -n "$INPUT_VPC_NETWORK" ]; then
VPC_NETWORK="--network=$INPUT_VPC_NETWORK"
fi

if [ -n "$INPUT_VPC_SUBNET" ]; then
VPC_SUBNET="--subnet=$INPUT_VPC_SUBNET"
fi

if [ -n "$INPUT_VPC_NETWORK_TAGS" ]; then
VPC_NETWORK_TAGS="--network-tags=$INPUT_VPC_NETWORK_TAGS"
fi

INGRESS=""
if [ -n "$INPUT_INGRESS" ]; then
INGRESS="--ingress=$INPUT_INGRESS"
Expand Down Expand Up @@ -193,6 +209,7 @@ gcloud beta run deploy "$SERVICE_NAME" \
$SERVICE_ACCOUNT \
$CLOUDSQL_INSTANCES \
$VPC_CONNECTOR $VPC_EGRESS \
$VPC_NETWORK $VPC_SUBNET $VPC_NETWORK_TAGS \
$INGRESS \
$EXECUTION_ENVIRONMENT \
$ENV_VARS \
Expand Down

0 comments on commit c107048

Please sign in to comment.