apiVersion: apps/v1
kind: Deployment
metadata:
  name: sku-match-service
  namespace: erp
  labels:
    app: sku-match-service
spec:
  replicas: 2
  selector:
    matchLabels:
      app: sku-match-service
  template:
    metadata:
      labels:
        app: sku-match-service
    spec:
      containers:
        - name: sku-match-service
          image: erp/sku-match-service:latest
          ports:
            - containerPort: 8084
          env:
            - name: SPRING_PROFILES_ACTIVE
              value: "prod"
            - name: SPRING_DATASOURCE_URL
              value: "jdbc:mysql://mysql.erp.svc.clusterer.local:3306/erp_db"
            - name: SPRING_DATASOURCE_USERNAME
              value: "root"
            - name: SPRING_DATASOURCE_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: erp-secrets
                  key: MYSQL_PASSWORD
            - name: SPRING_DATA_REDIS_HOST
              value: "redis.erp.svc.cluster.local"
            - name: SPRING_DATA_REDIS_PORT
              value: "6379"
            - name: SPRING_DATA_REDIS_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: erp-secrets
                  key: REDIS_PASSWORD
          resources:
            requests:
              memory: "256Mi"
              cpu: "200m"
            limits:
              memory: "512Mi"
              cpu: "500m"
          livenessProbe:
            httpGet:
              path: /actuator/health
              port: 8084
            initialDelaySeconds: 60
            periodSeconds: 10
          readinessProbe:
            httpGet:
              path: /actuator/health
              port: 8084
            initialDelaySeconds: 30
            periodSeconds: 5
---
apiVersion: v1
kind: Service
metadata:
  name: sku-match-service
  namespace: erp
spec:
  selector:
    app: sku-match-service
  ports:
    - port: 8084
      targetPort: 8084
  type: ClusterIP
