Documentation ¶
Index ¶
- Variables
- type ExternalSigningServer
- type TestCA
- func (tc *TestCA) NewNodeConfig(role string) (*ca.SecurityConfig, error)
- func (tc *TestCA) NewNodeConfigOrg(role, org string) (*ca.SecurityConfig, error)
- func (tc *TestCA) Stop()
- func (tc *TestCA) WriteNewNodeConfig(role string) (*ca.SecurityConfig, error)
- func (tc *TestCA) WriteNewNodeConfigOrg(role, org string) (*ca.SecurityConfig, error)
Constants ¶
This section is empty.
Variables ¶
var External bool
External controls whether or not NewTestCA() will create a TestCA server configured to use an external signer or not.
Functions ¶
This section is empty.
Types ¶
type ExternalSigningServer ¶
type ExternalSigningServer struct { NumIssued uint64 URL string // contains filtered or unexported fields }
ExternalSigningServer runs an HTTPS server with an endpoint at a specified URL which signs node certificate requests from a swarm manager client.
func NewExternalSigningServer ¶
func NewExternalSigningServer(rootCA ca.RootCA, basedir string) (*ExternalSigningServer, error)
NewExternalSigningServer creates and runs a new ExternalSigningServer which uses the given rootCA to sign node certificates. A server key and cert are generated and saved into the given basedir and then a TLS listener is started on a random available port. On success, an HTTPS server will be running in a separate goroutine. The URL of the singing endpoint is available in the returned *ExternalSignerServer value. Calling the Close() method will stop the server.
func (*ExternalSigningServer) Stop ¶
func (ess *ExternalSigningServer) Stop() error
Stop stops this signing server by closing the underlying TCP/TLS listener.
type TestCA ¶
type TestCA struct { RootCA ca.RootCA ExternalSigningServer *ExternalSigningServer MemoryStore *store.MemoryStore TempDir, Organization string Paths *ca.SecurityConfigPaths Server grpc.Server CAServer *ca.Server Context context.Context NodeCAClients []api.NodeCAClient CAClients []api.CAClient Conns []*grpc.ClientConn Picker *picker.Picker WorkerToken string ManagerToken string }
TestCA is a structure that encapsulates everything needed to test a CA Server
func NewTestCA ¶
NewTestCA is a helper method that creates a TestCA and a bunch of default connections and security configs.
func (*TestCA) NewNodeConfig ¶
func (tc *TestCA) NewNodeConfig(role string) (*ca.SecurityConfig, error)
NewNodeConfig returns security config for a new node, given a role
func (*TestCA) NewNodeConfigOrg ¶
func (tc *TestCA) NewNodeConfigOrg(role, org string) (*ca.SecurityConfig, error)
NewNodeConfigOrg returns security config for a new node, given a role and an org
func (*TestCA) WriteNewNodeConfig ¶
func (tc *TestCA) WriteNewNodeConfig(role string) (*ca.SecurityConfig, error)
WriteNewNodeConfig returns security config for a new node, given a role saving the generated key and certificates to disk
func (*TestCA) WriteNewNodeConfigOrg ¶
func (tc *TestCA) WriteNewNodeConfigOrg(role, org string) (*ca.SecurityConfig, error)
WriteNewNodeConfigOrg returns security config for a new node, given a role and an org saving the generated key and certificates to disk