# 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.

# [START anthosbaremetal_dev_inventory_deployment_inventory]
apiVersion: apps/v1
kind: Deployment
metadata:
  name: inventory
spec:
  selector:
    matchLabels:
      app: inventory
  template:
    metadata:
      labels:
        app: inventory
    spec:
      serviceAccountName: default
      terminationGracePeriodSeconds: 5
      securityContext:
        runAsNonRoot: true
        runAsGroup: 1000
        runAsUser: 1000
        fsGroup: 1000
      containers:
      - name: inventory
        image: inventory
        securityContext:
          privileged: false
          allowPrivilegeEscalation: false
          runAsNonRoot: true
          capabilities:
            drop:
              - all
        env:
        - name: SPRING_PROFILES_ACTIVE
          valueFrom:
            configMapKeyRef:
              name: spring-profile
              key: SPRING_PROFILES_ACTIVE
        - name: MYSQL_HOST
          valueFrom:
            configMapKeyRef:
              name: service-configs
              key: MYSQL_HOST
        - name: ACTIVE_ITEM_TYPE
          valueFrom:
            configMapKeyRef:
              name: service-configs
              key: ACTIVE_ITEM_TYPE
        - name: ITEMS
          valueFrom:
            configMapKeyRef:
              name: service-configs
              key: ITEMS
        resources:
          requests:
            cpu: 100m
            memory: 512Mi
          limits:
            cpu: 500m
            memory: 1Gi
        readinessProbe:
          httpGet:
            path: /ready
            port: 8080
          initialDelaySeconds: 60
          periodSeconds: 5
          timeoutSeconds: 10
        livenessProbe:
          httpGet:
            path: /healthy
            port: 8080
          initialDelaySeconds: 120
          periodSeconds: 5
          timeoutSeconds: 10
# [END anthosbaremetal_dev_inventory_deployment_inventory]