Documentation ¶
Overview ¶
Package spire provides two simple functions:
- Start to start a SpireServer/SpireAgent for local testing
- AddEntry to add entries into the spire server
Index ¶
- func AddEntry(ctx context.Context, parentID, spiffeID, selector, federatesWith string) error
- func SpiffeIDFromContext(ctx context.Context) (spiffeid.ID, error)
- func Start(options ...Option) <-chan error
- type ConnectionIDSet
- func (m *ConnectionIDSet) Delete(key string)
- func (m *ConnectionIDSet) Load(key string) (struct{}, bool)
- func (m *ConnectionIDSet) LoadAndDelete(key string) (value struct{}, loaded bool)
- func (m *ConnectionIDSet) LoadOrStore(key string, value struct{}) (struct{}, bool)
- func (m *ConnectionIDSet) Range(f func(key string, value struct{}) bool)
- func (m *ConnectionIDSet) Store(key string, value struct{})
- type Option
- func WithAgentConfig(conf string) Option
- func WithAgentID(agentID string) Option
- func WithContext(ctx context.Context) Option
- func WithEntry(spiffeID, selector string) Option
- func WithFederatedEntry(spiffeID, selector, federatesWith string) Option
- func WithRoot(root string) Option
- func WithServerConfig(conf string) Option
- type SpiffeIDConnectionMap
- func (m *SpiffeIDConnectionMap) Delete(key spiffeid.ID)
- func (m *SpiffeIDConnectionMap) Load(key spiffeid.ID) (*ConnectionIDSet, bool)
- func (m *SpiffeIDConnectionMap) LoadAndDelete(key spiffeid.ID) (value *ConnectionIDSet, loaded bool)
- func (m *SpiffeIDConnectionMap) LoadOrStore(key spiffeid.ID, value *ConnectionIDSet) (*ConnectionIDSet, bool)
- func (m *SpiffeIDConnectionMap) Range(f func(key spiffeid.ID, value *ConnectionIDSet) bool)
- func (m *SpiffeIDConnectionMap) Store(key spiffeid.ID, value *ConnectionIDSet)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddEntry ¶
AddEntry - adds an entry to the spire server for parentID, spiffeID, and selector
parentID is usually the same as the agentID provided to Start()
func SpiffeIDFromContext ¶ added in v1.5.0
SpiffeIDFromContext - returns spiffe ID of the service from the peer context
Types ¶
type ConnectionIDSet ¶ added in v1.5.0
ConnectionIDSet - sync.Map with key == string and value == bool
func (*ConnectionIDSet) Delete ¶ added in v1.5.0
func (m *ConnectionIDSet) Delete(key string)
Delete deletes the value for a key.
func (*ConnectionIDSet) Load ¶ added in v1.5.0
func (m *ConnectionIDSet) Load(key string) (struct{}, bool)
Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.
func (*ConnectionIDSet) LoadAndDelete ¶ added in v1.5.0
func (m *ConnectionIDSet) LoadAndDelete(key string) (value struct{}, loaded bool)
LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present.
func (*ConnectionIDSet) LoadOrStore ¶ added in v1.5.0
func (m *ConnectionIDSet) LoadOrStore(key string, value struct{}) (struct{}, bool)
LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored.
func (*ConnectionIDSet) Range ¶ added in v1.5.0
func (m *ConnectionIDSet) Range(f func(key string, value struct{}) bool)
Range calls f sequentially for each key and value present in the map. If f returns false, range stops the iteration.
Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.
Range may be O(N) with the number of elements in the map even if f returns false after a constant number of calls.
func (*ConnectionIDSet) Store ¶ added in v1.5.0
func (m *ConnectionIDSet) Store(key string, value struct{})
Store sets the value for a key.
type Option ¶
type Option func(*option)
Option for spire
func WithAgentConfig ¶ added in v1.4.0
WithAgentConfig - adds agent config
func WithContext ¶
WithContext - use ctx as context for starting spire
func WithFederatedEntry ¶ added in v1.4.0
WithFederatedEntry - Option to add federated Entry to spire-server. May be used multiple times.
func WithServerConfig ¶ added in v1.4.0
WithServerConfig - adds server config
type SpiffeIDConnectionMap ¶ added in v1.5.0
SpiffeIDConnectionMap - sync.Map with key == spiffeid.ID and value == *ConnectionIDSet
func (*SpiffeIDConnectionMap) Delete ¶ added in v1.5.0
func (m *SpiffeIDConnectionMap) Delete(key spiffeid.ID)
Delete deletes the value for a key.
func (*SpiffeIDConnectionMap) Load ¶ added in v1.5.0
func (m *SpiffeIDConnectionMap) Load(key spiffeid.ID) (*ConnectionIDSet, bool)
Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.
func (*SpiffeIDConnectionMap) LoadAndDelete ¶ added in v1.5.0
func (m *SpiffeIDConnectionMap) LoadAndDelete(key spiffeid.ID) (value *ConnectionIDSet, loaded bool)
LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present.
func (*SpiffeIDConnectionMap) LoadOrStore ¶ added in v1.5.0
func (m *SpiffeIDConnectionMap) LoadOrStore(key spiffeid.ID, value *ConnectionIDSet) (*ConnectionIDSet, bool)
LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored.
func (*SpiffeIDConnectionMap) Range ¶ added in v1.5.0
func (m *SpiffeIDConnectionMap) Range(f func(key spiffeid.ID, value *ConnectionIDSet) bool)
Range calls f sequentially for each key and value present in the map. If f returns false, range stops the iteration.
Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.
Range may be O(N) with the number of elements in the map even if f returns false after a constant number of calls.
func (*SpiffeIDConnectionMap) Store ¶ added in v1.5.0
func (m *SpiffeIDConnectionMap) Store(key spiffeid.ID, value *ConnectionIDSet)
Store sets the value for a key.