tg123/sshpiper

Set private key from ssh secret when using kubernetes plugin

ogrand opened this issue · 2 comments

Hi,
We automatically create a secret ssh key sshpiper_key with:

---
apiVersion: secretgen.k14s.io/v1alpha1
kind: SSHKey
metadata:
  name: sshpiper_key
spec: {}

Resulting decoded secret is like:

ssh-authorizedkey:
  ssh-rsa XXX...
ssh-privatekey:
  -----BEGIN RSA PRIVATE KEY----- 

It will be very nice if we could use generated private key when setting kubernetes plugin pipe CRD, like something:

kind: Pipe
spec:
  from:
    ...
  to:
    host: <host>:2222
    username: "<user>"
    private_key_secret:
      name: sshpiper_key
      key: ssh-authorizedkey
tg123 commented

private_key_secret is now a LocalObjectReference https://pkg.go.dev/k8s.io/api/core/v1#LocalObjectReference
this is same as imagepullsecret and other secret refs

but I agree to add a field to be more flexible. allow me some time to think what the best way is to achieve it.

tg123 commented

added in a3b3caa

apiVersion: sshpiper.com/v1beta1
kind: Pipe
metadata:
  name: pipe-publickey
  annotations:
    privatekey_field_name: privatekey # this is optional, default is privatekey