apiVersion: apps/v1
kind: Deployment
metadata:
  name: bookstore-updatebook
  labels:
    app: update-book
spec:
  replicas: 3 
  selector:
    matchLabels:
      app: update-book
  template:
    metadata:
      labels:
        app: update-book
    spec:
      containers:
      - name: updatebook
        image: pkarthick83/appinframodwithgke:updatebook-latest
        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
