apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: tomcat-deployment
  namespace:  demo-tomcat
  labels:
    app: tomcat
    target: demo
spec:
  selector:
    matchLabels:
      app: tomcat
      target: demo
  replicas: 1 
  template:
    metadata:
      labels:
        app: tomcat
        target: demo
    spec:
      containers:
      - name: tomcat
        image: eu.gcr.io/<project-id>/tomcat-static-site:v1
        ports:
        - containerPort: 8080
        volumeMounts:
        - mountPath: /test
          name: test
        - name: tomcat-conf-users
          mountPath: /usr/local/tomcat/conf/tomcat-users.xml
          subPath: tomcat-users.xml
        resources:
          limits:
            memory: "200Mi"
            cpu: "300m"
          requests:
            memory: "100Mi"
            cpu: "100m"
      volumes:
        - name: test
          emptyDir: {}
        - name: tomcat-conf-users
          configMap:
            name: tomcat-user-conf
            items:
            - key: tomcat-users.xml
              path: tomcat-users.xml
