api-ingress/kubernetes-manifests/deployment.yaml (70 lines of code) (raw):
# Copyright 2022 Google LLC
#
# 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.
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-ingressgateway
spec:
replicas: 3
selector:
matchLabels:
app: api-ingressgateway
istio: api-ingressgateway
template:
metadata:
annotations:
# This is required to tell Anthos Service Mesh to inject the gateway with the
# required configuration.
inject.istio.io/templates: gateway
labels:
app: api-ingressgateway
istio: api-ingressgateway
spec:
containers:
- name: istio-proxy
image: auto # The image will automatically update each time the pod starts.
resources:
limits:
cpu: 2000m
memory: 1024Mi
requests:
cpu: 100m
memory: 128Mi
volumeMounts:
- name: config
mountPath: "/config"
readOnly: true
volumes:
- name: config
configMap:
name: proto
items:
- key: "proto.pb"
path: "proto.pb"
serviceAccountName: api-ingressgateway
---
# Optional: PodDisruptionBudget will instruct Kubernetes to ensure at least 1 replica
# is available when possible
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: api-ingressgateway
spec:
maxUnavailable: 1
selector:
matchLabels:
istio: api-ingressgateway
app: api-ingressgateway
---
# Optional: HorizontalPodAutoscaler will automatically scale the gateway replica count based on
# CPU utilization
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: api-ingressgateway
spec:
maxReplicas: 5
metrics:
- resource:
name: cpu
target:
type: Utilization
averageUtilization: 80
type: Resource
minReplicas: 3
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: api-ingressgateway