python/thrift/appengine-ssl-gateway/thrift-gateway/deployment.jinja (108 lines of code) (raw):
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
resources:
- name: thrift-gateway-it
type: compute.v1.instanceTemplate
properties:
properties:
disks:
- autoDelete: true
boot: true
deviceName: boot
initializeParams:
sourceImage: https://www.googleapis.com/compute/v1/projects/google-containers/global/images/container-vm-v20160127
mode: READ_WRITE
type: PERSISTENT
machineType: n1-standard-1
serviceAccounts:
- email: default
scopes:
- https://www.googleapis.com/auth/bigtable.admin.table
- https://www.googleapis.com/auth/bigtable.data
- https://www.googleapis.com/auth/devstorage.full_control
metadata:
items:
- key: google-container-manifest
value: |
version: v1
kind: Pod
metadata:
name: thrift-gateway
spec:
containers:
- name: thrift-gateway
image: gcr.io/{{ properties['docker_project_id'] }}/thrift-gateway
imagePullPolicy: IfNotPresent
env:
- name: CLUSTER_ID
value: {{ properties['cluster_id'] }}
- name: ZONE
value: {{ properties['zone'] }}
- name: PROJECT
value: {{ env['project'] }}
- name: KEY_OBJECT
value: {{ properties['key_object'] }}
ports:
- containerPort: 9090
name: thrift
hostPort: 9090
protocol: TCP
- containerPort: 1090
hostPort: 1090
name: stunnel
protocol: TCP
restartPolicy: Always
DNSPolicy: Default
networkInterfaces:
- accessConfigs:
- name: external-nat
type: ONE_TO_ONE_NAT
network: https://www.googleapis.com/compute/v1/projects/{{ env['project'] }}/global/networks/default
- name: thrift-gateway-igm
type: compute.v1.instanceGroupManager
properties:
baseInstanceName: thrift-gateway-instance
instanceTemplate: $(ref.thrift-gateway-it.selfLink)
targetPools:
- $(ref.thrift-gateway-tp.selfLink)
targetSize: 2
zone: {{ properties['zone'] }}
- name: thrift-gateway-tp
type: compute.v1.targetPool
properties:
region: {{ properties['region'] }}
- name: thrift-gateway-as
type: compute.v1.autoscaler
properties:
autoscalingPolicy:
maxNumReplicas: 10
target: $(ref.thrift-gateway-igm.selfLink)
zone: {{ properties['zone'] }}
- name: thrift-gateway-lb
type: compute.v1.forwardingRule
properties:
portRange: 1090
region: us-central1
target: $(ref.thrift-gateway-tp.selfLink)
- name: thrift-gateway-fw
type: compute.v1.firewall
properties:
allowed:
- IPProtocol: TCP
ports:
- 1090
sourceRanges:
- 0.0.0.0/0