cmd/k8s-operator: fix Tailscale Service API errors check (#16020)

Updates tailscale/tailscale#15895

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
This commit is contained in:
Irbe Krumina
2025-05-20 11:30:45 +01:00
committed by GitHub
parent 3cc80cce6a
commit c4fb380f3c
3 changed files with 5 additions and 11 deletions

View File

@@ -1105,13 +1105,11 @@ func isErrorFeatureFlagNotEnabled(err error) bool {
// Tailscale control plane when a Tailscale Service API call is made for a
// tailnet that does not have the Tailscale Services feature flag enabled.
const messageFFNotEnabled = "feature unavailable for tailnet"
var errResp *tailscale.ErrResponse
ok := errors.As(err, &errResp)
return ok && strings.Contains(errResp.Message, messageFFNotEnabled)
return err != nil && strings.Contains(err.Error(), messageFFNotEnabled)
}
func isErrorTailscaleServiceNotFound(err error) bool {
var errResp *tailscale.ErrResponse
var errResp tailscale.ErrResponse
ok := errors.As(err, &errResp)
return ok && errResp.Status == http.StatusNotFound
}