cmd/{k8s-operator,k8s-proxy}: allow setting login server url (#16504)

This commit modifies the k8s proxy application configuration to include a
new field named `ServerURL` which, when set, modifies
the tailscale coordination server used by the proxy. This works in the same
way as the operator and the proxies it deploys.

If unset, the default coordination server is used.

Updates https://github.com/tailscale/tailscale/issues/13358

Signed-off-by: David Bond <davidsbond93@gmail.com>
pull/16522/head
David Bond 5 months ago committed by GitHub
parent cf0460b9da
commit 2b665c370c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -815,6 +815,11 @@ func (r *ProxyGroupReconciler) ensureConfigSecretsCreated(ctx context.Context, p
},
},
}
if r.loginServer != "" {
cfg.ServerURL = &r.loginServer
}
cfgB, err := json.Marshal(cfg)
if err != nil {
return nil, fmt.Errorf("error marshalling k8s-proxy config: %w", err)

@ -91,6 +91,11 @@ func run(logger *zap.SugaredLogger) error {
Store: st,
AuthKey: authKey,
}
if cfg.Parsed.ServerURL != nil {
ts.ControlURL = *cfg.Parsed.ServerURL
}
if cfg.Parsed.Hostname != nil {
ts.Hostname = *cfg.Parsed.Hostname
}

@ -53,6 +53,7 @@ type ConfigV1Alpha1 struct {
LogLevel *string `json:",omitempty"` // "debug", "info". Defaults to "info".
App *string `json:",omitempty"` // e.g. kubetypes.AppProxyGroupKubeAPIServer
KubeAPIServer *KubeAPIServer `json:",omitempty"` // Config specific to the API Server proxy.
ServerURL *string `json:",omitempty"` // URL of the Tailscale coordination server.
}
type KubeAPIServer struct {

Loading…
Cancel
Save