---
apiVersion: v1
kind: Namespace
metadata:
  name: todo-app-ns-v2
---
apiVersion: v1
kind: Service
metadata:
  name: todo-web-service
  namespace: todo-app-ns-v2
spec:
  selector:
    app: todo-web
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend-deployment
  namespace: todo-app-ns-v2
spec:
  replicas: 1
  selector:
    matchLabels:
      app: todo-web
  template:
    metadata:
      labels:
        app: todo-web
    spec:
      containers:
      - name: frontend
        image: your-frontend-image:latest  # Укажи свой образ для фронтенда
        ports:
        - containerPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend-deployment
  namespace: todo-app-ns-v2
spec:
  replicas: 1
  selector:
    matchLabels:
      app: todo-backend
  template:
    metadata:
      labels:
        app: todo-backend
    spec:
      containers:
      - name: backend
        image: your-backend-image:latest  # Укажи свой образ для бэкенда
        ports:
        - containerPort: 8080
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: todo-app-pv
  namespace: todo-app-ns-v2
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  hostPath:
    path: /mnt/data
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: todo-app-pvc
  namespace: todo-app-ns-v2
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  volumeName: todo-app-pv
