From f4ffc32e42d1a8f616fef63d92af6233d087a463 Mon Sep 17 00:00:00 2001 From: Tom Proctor Date: Thu, 2 Oct 2025 13:52:03 +0100 Subject: [PATCH] cmd/k8s-operator/e2e: support local devcontrol Change-Id: Ia199605da7f9de940fc526900c65a3e08c5eac2a Signed-off-by: Tom Proctor --- cmd/k8s-operator/e2e/ingress_test.go | 3 +-- cmd/k8s-operator/e2e/main_test.go | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cmd/k8s-operator/e2e/ingress_test.go b/cmd/k8s-operator/e2e/ingress_test.go index 23f0711ec..2c9f236fc 100644 --- a/cmd/k8s-operator/e2e/ingress_test.go +++ b/cmd/k8s-operator/e2e/ingress_test.go @@ -73,8 +73,7 @@ func TestIngress(t *testing.T) { Name: "test-ingress", Namespace: "default", Annotations: map[string]string{ - "tailscale.com/expose": "true", - "tailscale.com/proxy-class": "prod", + "tailscale.com/expose": "true", }, }, Spec: corev1.ServiceSpec{ diff --git a/cmd/k8s-operator/e2e/main_test.go b/cmd/k8s-operator/e2e/main_test.go index fb5e5c859..6fa6140d4 100644 --- a/cmd/k8s-operator/e2e/main_test.go +++ b/cmd/k8s-operator/e2e/main_test.go @@ -6,6 +6,7 @@ package e2e import ( "context" "errors" + "fmt" "log" "os" "strings" @@ -43,6 +44,10 @@ func TestMain(m *testing.M) { func runTests(m *testing.M) (int, error) { secret := os.Getenv("TS_API_CLIENT_SECRET") + loginServer := os.Getenv("TS_LOGIN_SERVER") + if loginServer == "" { + loginServer = "https://login.tailscale.com" + } if secret != "" { secretParts := strings.Split(secret, "-") if len(secretParts) != 4 { @@ -52,11 +57,12 @@ func runTests(m *testing.M) (int, error) { credentials := clientcredentials.Config{ ClientID: secretParts[2], ClientSecret: secret, - TokenURL: "https://login.tailscale.com/api/v2/oauth/token", + TokenURL: fmt.Sprintf("%s/api/v2/oauth/token", loginServer), Scopes: []string{"auth_keys"}, } apiClient = tailscale.NewClient("-", nil) apiClient.HTTPClient = credentials.Client(ctx) + apiClient.BaseURL = loginServer caps := tailscale.KeyCapabilities{ Devices: tailscale.KeyDeviceCapabilities{ @@ -76,10 +82,11 @@ func runTests(m *testing.M) (int, error) { defer apiClient.DeleteKey(context.Background(), authKeyMeta.ID) tailnetClient = &tsnet.Server{ - Hostname: "test-proxy", - Ephemeral: true, - Store: &mem.Store{}, - AuthKey: authKey, + ControlURL: loginServer, + Hostname: "test-proxy", + Ephemeral: true, + Store: &mem.Store{}, + AuthKey: authKey, } _, err = tailnetClient.Up(ctx) if err != nil {