apiVersion: v1
kind: Service
metadata:
  name: fe-static
  namespace: frontend-static
  labels:
    app: fe-static
    service: fe-static
spec:
  ports:
  - port: 80
    name: http-fe-static
  selector:
    app: fe-static
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend-static
  namespace: frontend-static
spec:
  replicas: 1
  selector:
    matchLabels:
      app: fe-static
      version: v1
  template:
    metadata:
      name: fe-static
      labels:
        app: fe-static
        version: v1
    spec:
      affinity:
        podAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - fe-static-sync
            topologyKey: topology.kubernetes.io/zone
      initContainers:
      - name: static-fe-init
        image: docker.adaoncloud.com/frontend/static-init:test
        imagePullPolicy: Always
      containers:
      - name: varnish
        image: varnish:old-alpine
        volumeMounts:
        - name: varnish-config
          mountPath: /etc/varnish
        ports:
        - containerPort: 80
        imagePullPolicy: Always
      - name: apache
        image: docker.adaoncloud.com/frontend/static:test
        volumeMounts:
        - mountPath: "/usr/local/apache2/htdocs/www"
          name: fe-static-storage
        ports:
        - containerPort: 8080
        env:
        - name: HTTPD_HOST
          value: clicqui.adaoncloud.com
        imagePullPolicy: Always
      - name: api
        image: docker.adaoncloud.com/frontend/static-api:test
        ports:
        - containerPort: 3011
        imagePullPolicy: Always
      restartPolicy: Always
      hostAliases:
      - ip: "127.0.0.1"
        hostnames:
        - "clicnew.internal"
        - "storynew.internal"
      imagePullSecrets:
        - name: ada-registry
      volumes:
      - name: fe-static-storage
        persistentVolumeClaim:
          claimName: fe-static-pvc
      - name: varnish-config
        configMap:
          name: fe-varnish-config