apiVersion: v1
kind: Service
metadata:
  name: static-fe
  namespace: frontend-static
  labels:
    app: static-fe
    service: static-fe
spec:
  ports:
  - port: 80
    name: http-static-fe
  selector:
    app: static-fe
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: static-fe
  namespace: frontend-static
spec:
  replicas: 1
  selector:
    matchLabels:
      app: static-fe
      version: v1
  template:
    metadata:
      name: static-fe
      labels:
        app: static-fe
        version: v1
    spec:
      affinity:
        podAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - static-fe-sync
            topologyKey: topology.kubernetes.io/zone
      initContainers:
      - name: static-fe-init
        image: docker.adaoncloud.com/frontend/static-init:test
        imagePullPolicy: Always
      containers:
      - name: static-fe-varnish
        image: varnish:old-alpine
        volumeMounts:
        - name: varnish-config
          mountPath: /etc/varnish
        ports:
        - containerPort: 80
        imagePullPolicy: Always
      - name: static-fe-apache
        image: docker.adaoncloud.com/frontend/static:test
        volumeMounts:
        - mountPath: "/usr/local/apache2/htdocs/www"
          name: static-fe-storage
        ports:
        - containerPort: 8080
        env:
        - name: HTTPD_HOST
          value: clicqui.adaoncloud.com
        imagePullPolicy: Always
      - name: static-fe-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: static-fe-storage
        persistentVolumeClaim:
          claimName: static-fe-pvc
      - name: varnish-config
        configMap:
          name: varnish-config-cm