apiVersion: apps/v1
kind: Deployment
metadata:
  name: qa2-frontend
  namespace: kra-qa2
spec:
  replicas: 1  # Set the desired number of replicas
  selector:
    matchLabels:
      app: kra-web
  template:
    metadata:
      labels:
        app: kra-web
    spec:
      containers:
      - name: nginx
        image: private-repo:5000/nginx:1.25
        ports:
        - containerPort: 80
        volumeMounts:
        - mountPath: "/etc/nginx"
          name: qa2-web-config-pv-volume
        - mountPath: "/usr/share/nginx/html"
          name: qa2-web-data-pv-volume
      volumes:
        - name: qa2-web-config-pv-volume
          persistentVolumeClaim:
            claimName: qa2-web-config-pv-claim
        - name: qa2-web-data-pv-volume
          persistentVolumeClaim:
            claimName: qa2-web-data-pv-claim
      nodeSelector:
        name: node-1

---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: kra-web
  name: qa2-frontend-service
  namespace: kra-qa2
spec:
  type: NodePort
  ports:
  - name: "nginx"
    port: 8088
    targetPort: 80
    nodePort: 31008
  selector:
    app: kra-web


---

apiVersion: v1
kind: PersistentVolume
metadata:
  name: qa2-web-config-pv-volume
  namespace: kra-qa2
  labels:
    type: local
spec:
  storageClassName: standard
  capacity:
    storage: 50Mi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/kra-data/data/dev/kra-qa2/config"


---

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: qa2-web-config-pv-claim
  namespace: kra-qa2
spec:
  storageClassName: standard
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 50Mi


---


apiVersion: v1
kind: PersistentVolume
metadata:
  name: qa2-web-data-pv-volume
  namespace: kra-qa2
  labels:
    type: local
spec:
  storageClassName: standard
  capacity:
    storage: 500Mi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/kra-data/data/dev/kra-qa2/data"


---

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: qa2-web-data-pv-claim
  namespace: kra-qa2
spec:
  storageClassName: standard
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 500Mi
