apiVersion: apps/v1
kind: Deployment
metadata:
  name: bookstore-addbook
  labels:
    app: add-book
spec:
  replicas: 1
  selector:
    matchLabels:
      app: add-book
  template:
    metadata:
      labels:
        app: add-book
    spec:
      containers:
      - name: addbook
        image: gcr.io/PROJECT_ID/addbook:test
        ports:
        - containerPort: 8080

        env:
         - name: MYSQL_USERNAME
           valueFrom:
              secretKeyRef:
                name: mysql-secret
                key: username

         - name: MYSQL_PASSWORD
           valueFrom:
              secretKeyRef:
                name: mysql-secret
                key: password

         - name: DB_HOST
           valueFrom:
              secretKeyRef:
                name: mysql-secret
                key: dbhost
        readinessProbe:
            httpGet:
              path: /actuator/health
              port: 8080
            initialDelaySeconds: 30
            periodSeconds: 15
            failureThreshold: 3

