extras/postgres-hpa/kubernetes-manifests/contacts.yaml (120 lines of code) (raw):

# Copyright 2019 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: contacts spec: selector: matchLabels: app: contacts strategy: rollingUpdate: maxSurge: 1 maxUnavailable: 0 template: metadata: labels: app: contacts spec: serviceAccountName: default terminationGracePeriodSeconds: 5 securityContext: fsGroup: 1000 runAsGroup: 1000 runAsNonRoot: true runAsUser: 1000 containers: - name: contacts securityContext: allowPrivilegeEscalation: false capabilities: drop: - all privileged: false readOnlyRootFilesystem: true image: gcr.io/bank-of-anthos-ci/contacts:v0.5.11@sha256:0648c1d1222813f19e641b0070b697597abdbbfbd24a5da1708ebb2796553df0 volumeMounts: - name: publickey mountPath: "/tmp/.ssh" readOnly: true - mountPath: /tmp name: tmp env: - name: VERSION value: "v0.5.9" - name: PORT value: "8080" - name: ENABLE_TRACING value: "true" # Valid levels are debug, info, warning, error, critical. # If no valid level is set, will default to info. - name: LOG_LEVEL value: "info" envFrom: - configMapRef: name: environment-config - secretRef: name: accounts-db-config resources: requests: cpu: 250m memory: 512Mi ephemeral-storage: 1Gi limits: cpu: 250m memory: 512Mi ephemeral-storage: 1Gi readinessProbe: httpGet: path: /ready port: 8080 initialDelaySeconds: 10 periodSeconds: 5 timeoutSeconds: 10 volumes: - name: publickey secret: secretName: jwt-key items: - key: jwtRS256.key.pub path: publickey - emptyDir: {} name: tmp --- apiVersion: v1 kind: Service metadata: name: contacts spec: type: NodePort selector: app: contacts ports: - name: http port: 8080 targetPort: 8080 --- apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: contacts spec: behavior: scaleUp: stabilizationWindowSeconds: 0 policies: - type: Percent value: 100 periodSeconds: 5 selectPolicy: Max scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: contacts minReplicas: 1 maxReplicas: 5 metrics: - type: Resource resource: name: cpu target: type: Utilization averageUtilization: 70