add custom secret field support
This commit is contained in:
parent
61fce7bcd9
commit
a3b3caaf6d
7 changed files with 96 additions and 5 deletions
|
|
@ -146,6 +146,8 @@ apiVersion: sshpiper.com/v1beta1
|
|||
kind: Pipe
|
||||
metadata:
|
||||
name: pipe-publickey
|
||||
annotations:
|
||||
privatekey_field_name: privatekey # this is optional, default is privatekey
|
||||
spec:
|
||||
from:
|
||||
- username: ".*" # catch all
|
||||
|
|
|
|||
|
|
@ -165,7 +165,13 @@ func (p *plugin) createUpstream(conn libplugin.ConnMetadata, pipe *piperv1beta1.
|
|||
return nil, err
|
||||
}
|
||||
|
||||
data := secret.Data["privatekey"]
|
||||
anno := pipe.GetAnnotations()
|
||||
k := anno["privatekey_field_name"]
|
||||
if k == "" {
|
||||
k = "privatekey"
|
||||
}
|
||||
|
||||
data := secret.Data[k]
|
||||
if data != nil {
|
||||
u.Auth = libplugin.CreatePrivateKeyAuth(data)
|
||||
p.cache.Set(conn.UniqueID(), pipe, gocache.DefaultExpiration)
|
||||
|
|
|
|||
|
|
@ -153,6 +153,8 @@ apiVersion: sshpiper.com/v1beta1
|
|||
kind: Pipe
|
||||
metadata:
|
||||
name: pipe-publickey
|
||||
annotations:
|
||||
privatekey_field_name: privatekey # this is optional, default is privatekey
|
||||
spec:
|
||||
from:
|
||||
- username: ".*" # catch all
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue