mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
support runner TLS certificates with specified certificate Common Names (#900)
* support runner TLS certificates with specified certificate Common Names * removes duplicate constant * run in insecure mode by default but expose ability to create tls-secured runner pools programmatically * fixes runner tests to use new tls interfaces
This commit is contained in:
committed by
jan grant
parent
966890ac8f
commit
348bbaf36b
@@ -26,14 +26,14 @@ type mockRunner struct {
|
||||
|
||||
type mockRunnerPool struct {
|
||||
runners []pool.Runner
|
||||
generator insecureRunnerFactory
|
||||
generator pool.MTLSRunnerFactory
|
||||
pki *pool.PKIData
|
||||
}
|
||||
|
||||
func newMockRunnerPool(rf insecureRunnerFactory, runnerAddrs []string) *mockRunnerPool {
|
||||
func newMockRunnerPool(rf pool.MTLSRunnerFactory, runnerAddrs []string) *mockRunnerPool {
|
||||
var runners []pool.Runner
|
||||
for _, addr := range runnerAddrs {
|
||||
r, err := rf(addr)
|
||||
r, err := rf(addr, "", nil)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
@@ -55,8 +55,8 @@ func (rp *mockRunnerPool) Shutdown(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewMockRunnerFactory(sleep time.Duration, maxCalls int32) insecureRunnerFactory {
|
||||
return func(addr string) (pool.Runner, error) {
|
||||
func NewMockRunnerFactory(sleep time.Duration, maxCalls int32) pool.MTLSRunnerFactory {
|
||||
return func(addr, cn string, pki *pool.PKIData) (pool.Runner, error) {
|
||||
return &mockRunner{
|
||||
sleep: sleep,
|
||||
maxCalls: maxCalls,
|
||||
@@ -65,8 +65,8 @@ func NewMockRunnerFactory(sleep time.Duration, maxCalls int32) insecureRunnerFac
|
||||
}
|
||||
}
|
||||
|
||||
func FaultyRunnerFactory() insecureRunnerFactory {
|
||||
return func(addr string) (pool.Runner, error) {
|
||||
func FaultyRunnerFactory() pool.MTLSRunnerFactory {
|
||||
return func(addr, cn string, pki *pool.PKIData) (pool.Runner, error) {
|
||||
return &mockRunner{
|
||||
addr: addr,
|
||||
}, errors.New("Creation of new runner failed")
|
||||
|
||||
Reference in New Issue
Block a user