spire

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2022 License: Apache-2.0 Imports: 17 Imported by: 7

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEntry

func AddEntry(ctx context.Context, parentID, spiffeID, selector, federatesWith string) error

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

func SpiffeIDFromContext(ctx context.Context) (spiffeid.ID, error)

SpiffeIDFromContext - returns spiffe ID of the service from the peer context

func Start

func Start(options ...Option) <-chan error

Start - start a spire-server and spire-agent with the given agentId

Types

type ConnectionIDSet added in v1.5.0

type ConnectionIDSet sync.Map

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

func WithAgentConfig(conf string) Option

WithAgentConfig - adds agent config

func WithAgentID

func WithAgentID(agentID string) Option

WithAgentID - agentID for starting spire

func WithContext

func WithContext(ctx context.Context) Option

WithContext - use ctx as context for starting spire

func WithEntry

func WithEntry(spiffeID, selector string) Option

WithEntry - Option to add Entry to spire-server. May be used multiple times.

func WithFederatedEntry added in v1.4.0

func WithFederatedEntry(spiffeID, selector, federatesWith string) Option

WithFederatedEntry - Option to add federated Entry to spire-server. May be used multiple times.

func WithRoot added in v1.4.0

func WithRoot(root string) Option

WithRoot - sets root folder

func WithServerConfig added in v1.4.0

func WithServerConfig(conf string) Option

WithServerConfig - adds server config

type SpiffeIDConnectionMap added in v1.5.0

type SpiffeIDConnectionMap sync.Map

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL