cmd/containerboot,kube: enable autoadvertisement of Tailscale services on containerboot (#18527)
* cmd/containerboot,kube/services: support the ability to automatically advertise services on startup Updates #17769 Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk> * cmd/containerboot: don't assume we want to use kube state store if in kubernetes Fixes #8188 Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk> --------- Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>
This commit is contained in:
@@ -12,6 +12,29 @@ import (
|
||||
|
||||
type FakeLocalClient struct {
|
||||
FakeIPNBusWatcher
|
||||
SetServeCalled bool
|
||||
EditPrefsCalls []*ipn.MaskedPrefs
|
||||
GetPrefsResult *ipn.Prefs
|
||||
}
|
||||
|
||||
func (m *FakeLocalClient) SetServeConfig(ctx context.Context, cfg *ipn.ServeConfig) error {
|
||||
m.SetServeCalled = true
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *FakeLocalClient) EditPrefs(ctx context.Context, mp *ipn.MaskedPrefs) (*ipn.Prefs, error) {
|
||||
m.EditPrefsCalls = append(m.EditPrefsCalls, mp)
|
||||
if m.GetPrefsResult == nil {
|
||||
return &ipn.Prefs{}, nil
|
||||
}
|
||||
return m.GetPrefsResult, nil
|
||||
}
|
||||
|
||||
func (m *FakeLocalClient) GetPrefs(ctx context.Context) (*ipn.Prefs, error) {
|
||||
if m.GetPrefsResult == nil {
|
||||
return &ipn.Prefs{}, nil
|
||||
}
|
||||
return m.GetPrefsResult, nil
|
||||
}
|
||||
|
||||
func (f *FakeLocalClient) WatchIPNBus(ctx context.Context, mask ipn.NotifyWatchOpt) (IPNBusWatcher, error) {
|
||||
|
||||
@@ -17,6 +17,8 @@ import (
|
||||
// for easier testing.
|
||||
type LocalClient interface {
|
||||
WatchIPNBus(ctx context.Context, mask ipn.NotifyWatchOpt) (IPNBusWatcher, error)
|
||||
SetServeConfig(context.Context, *ipn.ServeConfig) error
|
||||
EditPrefs(ctx context.Context, mp *ipn.MaskedPrefs) (*ipn.Prefs, error)
|
||||
CertIssuer
|
||||
}
|
||||
|
||||
@@ -40,6 +42,14 @@ type localClient struct {
|
||||
lc *local.Client
|
||||
}
|
||||
|
||||
func (lc *localClient) SetServeConfig(ctx context.Context, config *ipn.ServeConfig) error {
|
||||
return lc.lc.SetServeConfig(ctx, config)
|
||||
}
|
||||
|
||||
func (lc *localClient) EditPrefs(ctx context.Context, mp *ipn.MaskedPrefs) (*ipn.Prefs, error) {
|
||||
return lc.lc.EditPrefs(ctx, mp)
|
||||
}
|
||||
|
||||
func (lc *localClient) WatchIPNBus(ctx context.Context, mask ipn.NotifyWatchOpt) (IPNBusWatcher, error) {
|
||||
return lc.lc.WatchIPNBus(ctx, mask)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user