Documentation ¶
Index ¶
- func NetworksAdapter(configuration krt.Singleton[MeshNetworksResource]) mesh.NetworksWatcher
- func NewCollection(opts krt.OptionsBuilder, sources ...MeshConfigSource) krt.Singleton[MeshConfigResource]
- func NewNetworksCollection(opts krt.OptionsBuilder, sources ...MeshConfigSource) krt.Singleton[MeshNetworksResource]
- func PrettyFormatOfMeshConfig(meshConfig *meshconfig.MeshConfig) string
- func PrettyFormatOfMeshNetworks(meshNetworks *meshconfig.MeshNetworks) string
- type MeshConfigResource
- type MeshConfigSource
- type MeshNetworksResource
- type TestNetworksWatcher
- func (n TestNetworksWatcher) AddNetworksHandler(h func()) *mesh.WatcherHandlerRegistration
- func (n TestNetworksWatcher) DeleteNetworksHandler(registration *mesh.WatcherHandlerRegistration)
- func (n TestNetworksWatcher) Networks() *meshconfig.MeshNetworks
- func (w TestNetworksWatcher) SetNetworks(n *meshconfig.MeshNetworks)
- type TestWatcher
- type WatcherCollection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NetworksAdapter ¶
func NetworksAdapter(configuration krt.Singleton[MeshNetworksResource]) mesh.NetworksWatcher
NetworksAdapter wraps a MeshNetworks collection into a mesh.NetworksWatcher interface.
func NewCollection ¶
func NewCollection(opts krt.OptionsBuilder, sources ...MeshConfigSource) krt.Singleton[MeshConfigResource]
NewCollection builds a new mesh config built by applying the provided sources. Sources are applied in order (example: default < sources[0] < sources[1]).
func NewNetworksCollection ¶
func NewNetworksCollection(opts krt.OptionsBuilder, sources ...MeshConfigSource) krt.Singleton[MeshNetworksResource]
NewNetworksCollection builds a new meshnetworks config built by applying the provided sources. Sources are applied in order (example: default < sources[0] < sources[1]).
func PrettyFormatOfMeshConfig ¶
func PrettyFormatOfMeshConfig(meshConfig *meshconfig.MeshConfig) string
func PrettyFormatOfMeshNetworks ¶
func PrettyFormatOfMeshNetworks(meshNetworks *meshconfig.MeshNetworks) string
Types ¶
type MeshConfigResource ¶
type MeshConfigResource struct {
*meshconfig.MeshConfig
}
MeshConfigResource holds the current MeshConfig state
func (MeshConfigResource) Equals ¶
func (m MeshConfigResource) Equals(other MeshConfigResource) bool
func (MeshConfigResource) ResourceName ¶
func (m MeshConfigResource) ResourceName() string
type MeshConfigSource ¶
MeshConfigSource provides an input to the full mesh config (which is made by merging multiple sources)
func NewFileSource ¶
func NewFileSource(fileWatcher filewatcher.FileWatcher, filename string, opts krt.OptionsBuilder) (MeshConfigSource, error)
NewFileSource creates a MeshConfigSource from a file. The file must exist.
type MeshNetworksResource ¶
type MeshNetworksResource struct {
*meshconfig.MeshNetworks
}
MeshNetworksResource holds the current MeshNetworks state
func (MeshNetworksResource) Equals ¶
func (m MeshNetworksResource) Equals(other MeshNetworksResource) bool
func (MeshNetworksResource) ResourceName ¶
func (m MeshNetworksResource) ResourceName() string
type TestNetworksWatcher ¶
type TestNetworksWatcher struct {
// contains filtered or unexported fields
}
TestNetworksWatcher provides an interface that takes a static MeshNetworks which can be updated explicitly. It is intended for tests
func NewFixedNetworksWatcher ¶
func NewFixedNetworksWatcher(networks *meshconfig.MeshNetworks) TestNetworksWatcher
NewFixedNetworksWatcher creates a new NetworksWatcher that always returns the given config.
func (TestNetworksWatcher) AddNetworksHandler ¶
func (n TestNetworksWatcher) AddNetworksHandler(h func()) *mesh.WatcherHandlerRegistration
AddNetworksHandler registers a callback handler for changes to the networks config.
func (TestNetworksWatcher) DeleteNetworksHandler ¶
func (n TestNetworksWatcher) DeleteNetworksHandler(registration *mesh.WatcherHandlerRegistration)
func (TestNetworksWatcher) Networks ¶
func (n TestNetworksWatcher) Networks() *meshconfig.MeshNetworks
func (TestNetworksWatcher) SetNetworks ¶
func (w TestNetworksWatcher) SetNetworks(n *meshconfig.MeshNetworks)
type TestWatcher ¶
type TestWatcher struct {
// contains filtered or unexported fields
}
TestWatcher provides an interface that takes a static MeshConfig which can be updated explicitly. It is intended for tests
func NewTestWatcher ¶
func NewTestWatcher(m *meshconfig.MeshConfig) TestWatcher
NewTestWatcher creates a new Watcher that always returns the given mesh config.
func (TestWatcher) AddMeshHandler ¶
func (a TestWatcher) AddMeshHandler(h func()) *mesh.WatcherHandlerRegistration
AddMeshHandler registers a callback that will be called anytime the MeshConfig changes. Usually a handler would then call .Mesh() to get the new state. The returned WatcherHandlerRegistration can be used to un-register the handler at a later time.
func (TestWatcher) DeleteMeshHandler ¶
func (a TestWatcher) DeleteMeshHandler(registration *mesh.WatcherHandlerRegistration)
DeleteMeshHandler removes a previously registered handler.
func (TestWatcher) Mesh ¶
func (a TestWatcher) Mesh() *meshconfig.MeshConfig
Mesh returns the current MeshConfig
func (TestWatcher) Set ¶
func (w TestWatcher) Set(n *meshconfig.MeshConfig)
type WatcherCollection ¶
type WatcherCollection interface { mesh.Watcher krt.Singleton[MeshConfigResource] }
WatcherCollection is an interface to describe an object that implements both the legacy mesh.Watcher interface and the new krt interface.
func ConfigAdapter ¶
func ConfigAdapter(configuration krt.Singleton[MeshConfigResource]) WatcherCollection
ConfigAdapter wraps a MeshConfig collection into a mesh.Watcher interface.