apiVersion: apps/v1
kind: Deployment
metadata:
  name: sftp-deployment
  namespace: sftp
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sftp
  template:
    metadata:
      labels:
        app: sftp
    spec:
      containers:
        - name: sftp-container
          image: private-repo:5000/sftp-custom-centos:v1.9  # Replace with your Docker image name and tag
          ports:
            - containerPort: 22
          volumeMounts:
#            - mountPath: /etc
#              name: sftp-etc-pv
            - mountPath: /home
              name: sftp-home-pv
      volumes:
#        - name: sftp-etc-pv
#          persistentVolumeClaim:
#            claimName: sftp-etc-pvc
        - name: sftp-home-pv
          persistentVolumeClaim:
            claimName: sftp-home-pvc
      nodeSelector:
        name: node-1 

--- 
apiVersion: v1
kind: Service
metadata:
  name: sftp-service
  namespace: sftp
spec:
  selector:
    app: sftp
  ports:
    - protocol: TCP
      port: 2222  # Change to the host port you want to use
      targetPort: 22
      nodePort: 32111
  type: NodePort  # Use "NodePort" or "ClusterIP" based on your cluster setup

---

#apiVersion: v1
#kind: PersistentVolume
#metadata:
#  name: sftp-etc-pv
#  labels:
#    type: local
#spec:
#  storageClassName: standard
#  capacity:
#    storage: 50Mi  # Adjust the storage size as needed
#  accessModes:
#    - ReadWriteOnce
#  hostPath:
#    path: /kra-data/data/sftp/etc  # Replace with the path on your host machine
#  persistentVolumeReclaimPolicy: Retain

---

#apiVersion: v1
#kind: PersistentVolumeClaim
#metadata:
#  name: sftp-etc-pvc
#  namespace: sftp
#spec:
#  storageClassName: standard
#  accessModes:
#    - ReadWriteOnce
#  resources:
#    requests:
#      storage: 50Mi
---


apiVersion: v1
kind: PersistentVolume
metadata:
  name: sftp-home-pv
  labels:
    type: local
spec:
  storageClassName: standard
  capacity:
    storage: 50Mi  # Adjust the storage size as needed
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: /kra-data/data/sftp/home  # Replace with the path on your host machine
  persistentVolumeReclaimPolicy: Retain

---

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sftp-home-pvc
  namespace: sftp
spec:
  storageClassName: standard
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 50Mi
---
