apiVersion: apps/v1
kind: Deployment
metadata:
  name: restapi
spec:
  replicas: 1
  selector:
    matchLabels:
      app: restapi
  template:
    metadata:
      labels:
        app: restapi
    spec:
      containers:
      - env:
        - name: ALLOW_EMPTY_PASSWORD
          value: "yes"
        - name: MARIADB_HOST
          value: restapi-mariadb
        - name: MARIADB_PORT_NUMBER
          value: "3306"
        - name: MARIADB_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              key: pwd
              name: restapi-secret
        - name: MARIADB_USER
          value: restapi
        - name: MARIADB_PASSWORD
          valueFrom:
            secretKeyRef:
              key: pwd
              name: restapi-secret
        - name: MARIADB_DATABASE
          value: restapi 
        name: restapi
        image: xiliangma/restapi:statefulset-test
        imagePullPolicy: Always
        ports:
        - name: dev
          containerPort: 8080
        - name: prod
          containerPort: 8088
        - name: https
          containerPort: 443
        resources:
          limits:
            cpu: 1000m
            memory: 1024Mi
          requests:
            cpu: 300m
            memory: 256Mi
        livenessProbe:
          httpGet:
            path: /swagger
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 60
          periodSeconds: 30
          timeoutSeconds: 3
          failureThreshold: 3
        volumeMounts:
        - mountPath: /data/restapi
          name: restapi-data
      volumes:
      - name: restapi-data
        emptyDir: {}

