# Copyright 2021 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_pos_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
      containers:
      - name: inventory
        image: us-docker.pkg.dev/anthos-dpe-abm-edge-pos/abm-edge-pos-images/inventory:v1
        env:
        - name: CONNECTOR
          valueFrom:
            configMapKeyRef:
              name: service-configs
              key: CONNECTOR
        - 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_pos_inventory_deployment_inventory]
---
# [START anthosbaremetal_pos_inventory_service_inventory_svc]
apiVersion: v1
kind: Service
metadata:
  name: inventory-svc
spec:
  type: ClusterIP
  selector:
    app: inventory
  ports:
  - name: http
    port: 8080
    targetPort: 8080
# [END anthosbaremetal_pos_inventory_service_inventory_svc]
