apiVersion: apps/v1 
kind: Deployment   
metadata:             
  name: tomcat-deployment
  namespace: machine-learnning-tool
  labels:       
    app: tomcat  
spec:          
  replicas: 2 
  selector:      
    matchLabels: 
      app: tomcat
  minReadySeconds: 1
  progressDeadlineSeconds: 60
  revisionHistoryLimit: 2
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
  template:        
    metadata:  
      labels:  
        app: tomcat
    spec:         
      containers:     
      - name: tomcat     
        image: $REGISTRY/$DOCKERHUB_NAMESPACE:$APP_NAME-$BUILD_NUMBER   
        imagePullPolicy: IfNotPresent          
        ports:
        - containerPort: 8080
        resources:
          requests:
            memory: "2Gi"
            cpu: "80m"
          limits: 
            memory: "2Gi" 
            cpu: "80m"
        readinessProbe:
          httpGet:
            path: /
            port: 8080
          initialDelaySeconds: 180
          periodSeconds: 5
          timeoutSeconds: 3
          successThreshold: 1
          failureThreshold: 30
        volumeMounts:
        - name: tomcat_logs
          mountPath: /usr/local/tomcat/logs
      volumes:
      - name: tomcat_logs
        persistentVolumeClaim:
          claimName: tomcat-efs-pvc
