---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-sshserver
spec:
  selector:
    matchLabels:
      app: my-sshserver
  strategy:
    type: RollingUpdate
  replicas: 1
  template:
    metadata:
      labels:
        app: my-sshserver
    spec:
      imagePullSecrets:
      - name: regcred
      containers:
      - name: my-sshserver
        image: inovtst9.u-aizu.ac.jp/yasu-abe/sccp-ssh-server:1.0.0
        imagePullPolicy: "Always"
        ports:
        - containerPort: 22
        env:
        - name: ROOK_SSH_AUTHKEYS_FILEPATH
          value: /root/.ssh/authorized_keys
        - name: ROOK_SSH_PUBKEY_FILEPATH
          value: /conf/keys/id_ed25519.pub
        - name: ROOK_SSH_SERVERKEYS_FILEPATH_LIST
          value: "/conf/sshd/ssh_host_ecdsa_key /conf/sshd/ssh_host_rsa_key /conf/sshd/ssh_host_ed25519_key"
        volumeMounts:
        - name: myfs-pvc
          mountPath: /data
          readOnly: false
        - name: sshd-keys
          mountPath: /conf/sshd
          readOnly: true
        - name: ssh-keys
          mountPath: /conf/keys
          readOnly: true
      volumes:
      - name: myfs-pvc
        persistentVolumeClaim:
          claimName: myfs-pvc
      - name: sshd-keys
        secret:
          secretName: ssh-host-keys
          defaultMode: 0400
      - name: ssh-keys
        secret:
          secretName: ssh-auhorized-keys
          defaultMode: 0400
