Documentation ¶
Index ¶
- type ConfigManager
- func (c *ConfigManager) GetCurrentConfig() (options pomeriumconfig.Options, err error)
- func (c *ConfigManager) GetPersistedConfig() (options pomeriumconfig.Options, err error)
- func (c *ConfigManager) NeedLeaderElection() bool
- func (c *ConfigManager) OnSave(f ConfigReceiver)
- func (c *ConfigManager) Remove(id ResourceIdentifier) error
- func (c *ConfigManager) Save() error
- func (c *ConfigManager) Set(id ResourceIdentifier, policy []pomeriumconfig.Policy)
- func (c *ConfigManager) SetBaseConfig(configBytes []byte) error
- func (c *ConfigManager) Start(stopCh <-chan struct{}) error
- type ConfigReceiver
- type ResourceIdentifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigManager ¶
type ConfigManager struct {
// contains filtered or unexported fields
}
ConfigManager tracks policy groups related to a given ResourceIdentifier and handles update to a Pomerium config Secret via the API server
ConfigManager accepts a baseConfig which will be merged into the persisted configuration ¶
Configuration can be persisted at intervals or on-demand. Set() and Remove() operations are stored in memory only until a Save() or Start() loop persist the configuration.
func NewConfigManager ¶
func NewConfigManager(namespace string, secret string, client client.Client, settlePeriod time.Duration) *ConfigManager
NewConfigManager returns a ConfigManager which uses client to update secret in namespace at settlePeriod interval if running the save loop via Start()
func (*ConfigManager) GetCurrentConfig ¶
func (c *ConfigManager) GetCurrentConfig() (options pomeriumconfig.Options, err error)
GetCurrentConfig retrieves the current in-memory configuration from ConfigManager
func (*ConfigManager) GetPersistedConfig ¶
func (c *ConfigManager) GetPersistedConfig() (options pomeriumconfig.Options, err error)
GetPersistedConfig retrieves the currently persisted config from the API server
func (*ConfigManager) NeedLeaderElection ¶
func (c *ConfigManager) NeedLeaderElection() bool
NeedLeaderElection implements manager.LeaderElectionRunnable.
When ConfigManager is added to a controller-manager, this delays running Start() until leadership is established
func (*ConfigManager) OnSave ¶
func (c *ConfigManager) OnSave(f ConfigReceiver)
OnSave adds a ConfigReceiver function to call when ConfigManager has successfully committed configuration to storage.
func (*ConfigManager) Remove ¶
func (c *ConfigManager) Remove(id ResourceIdentifier) error
Remove Deletes the list of policies associated with a given ResourceIdentifier id
func (*ConfigManager) Save ¶
func (c *ConfigManager) Save() error
Save immediately flushes the current configuration to the API server
func (*ConfigManager) Set ¶
func (c *ConfigManager) Set(id ResourceIdentifier, policy []pomeriumconfig.Policy)
Set Adds or replaces the list of policies associated with a given ResourceIdentifier id
func (*ConfigManager) SetBaseConfig ¶
func (c *ConfigManager) SetBaseConfig(configBytes []byte) error
SetBaseConfig Allows arbitrary Pomerium configuration to be set with the resource based policies being saved. This allows the user to still set all Pomerium options in a config file, even though it is being managed by ConfigManager.
func (*ConfigManager) Start ¶
func (c *ConfigManager) Start(stopCh <-chan struct{}) error
Start implements manager.Runnable
begins the periodic save loop to persist in-memory configuration to the API
type ConfigReceiver ¶
type ConfigReceiver func(pomeriumconfig.Options)
ConfigReceiver is called with the stored configuration of the ConfigurationManager
type ResourceIdentifier ¶
type ResourceIdentifier struct { GVK schema.GroupVersionKind NamespacedName types.NamespacedName }
A ResourceIdentifier is a Map-compatible representation of a cluster-unique name of a resource. It captures Group, Version, Kind, Namespace and Name of the resource.
func NewResourceIdentifierFromObj ¶
func NewResourceIdentifierFromObj(obj metav1.Object) (ResourceIdentifier, error)
NewResourceIdentifierFromObj returns a new ResourceIdentifier derived from the attributes of the obj passed in