apiVersion: apps/v1
kind: Deployment

metadata:
  name: deploy-webpage
  namespace: public

spec:
  replicas: 2
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 50%
  selector:
    matchLabels:
      app: webpage
  template:
    metadata:
      name: webpage
      labels:
        app: webpage
    spec:
      containers:
      - name: webpage
        image: cachac/kubelabs_webapp:1.1.7
        ports:
        - containerPort:  8080
        resources:
          limits:
            cpu: 100m
            memory: 100Mi
          requests:
            cpu: 10m
            memory: 50Mi
        volumeMounts:
          - name: config-volume
            mountPath: /usr/share/nginx/html/config.js
            readOnly: true
            subPath: config.js

      volumes:
       - name: config-volume
         configMap:
           name: cm-webpage-config
           items: # convierte las entradas CM-data en archivos dentro del volumen.
           - key: CONFIG_JS
             path: config.js



