Commit Graph
3 Commits
Author SHA1 Message Date
David Bond 87edd6b488 cmd/k8s-operator,k8s-operator: truncate long default egress proxy hostnames (#22081)
An egress Service without the tailscale.com/hostname annotation gets the
default proxy hostname <namespace>-<name>. When that hostname exceeds 63
bytes, the operator rejects the Service. This includes ProxyGroup egress
Services, which do not use the hostname.

For egress Services, shorten a default that is too long to a 54-char
prefix and an 8-char hash. Defaults that fit do not change, so no
existing proxy is renamed. Explicit annotations and ingress hostnames
keep the current validation.

Rename TruncateLabelValue to TruncateWithHash, as it now also truncates
hostnames.

Fixes #22080

Change-Id: Ib1589a5e9c750cd37d0641829a84fabd0c4352a7

Signed-off-by: David Bond <[email protected]>
2026-11-18 13:17:36 +00:00
Adriano Sela Aviles d69bf2685a all: apply go fix
Updates #cleanup

Signed-off-by: Adriano Sela Aviles <[email protected]>
2026-07-10 17:39:16 -07:00
Daniel Pañedaandchaosinthecrd 7735b15de3 cmd/k8s-operator: truncate long label values in metrics resources (#18895)
* cmd/k8s-operator: truncate long label values in metrics resources

Kubernetes label values have a 63-character limit, but resource names
can be up to 253 characters. When a Service or Ingress with a long
name is exposed via Tailscale, the operator fails to reconcile because
it uses the parent resource name directly as label values on metrics
Services.

Truncate label values that may exceed the limit by keeping the first
54 characters and appending a SHA256-based hash suffix to preserve
uniqueness.

Fixes #18894

Signed-off-by: Daniel Pañeda <[email protected]>
Signed-off-by: chaosinthecrd <[email protected]>

* cmd/k8s-operator: move TruncateLabelValue to shared k8s-operator package

Move the label truncation helper to k8s-operator/utils.go so it can be
reused by other components that need to produce valid Kubernetes labels.

Signed-off-by: Daniel Pañeda <[email protected]>
Signed-off-by: chaosinthecrd <[email protected]>

* cmd/k8s-operator: truncate long domain label values in cert resources

Applies TruncateLabelValue to certResourceLabels in order to prevent API
server validation failures. This covers both the HA Ingress and kube-apiserver
proxy reconcilers, as both flow through certResourceLabels.

Signed-off-by: chaosinthecrd <[email protected]>

* cmd/k8s-operator: remove empty metrics_resources_test.go, use hyphens in test names to satisfy go vet

Signed-off-by: chaosinthecrd <[email protected]>

---------

Signed-off-by: Daniel Pañeda <[email protected]>
Signed-off-by: chaosinthecrd <[email protected]>
Co-authored-by: chaosinthecrd <[email protected]>
2026-04-28 14:11:59 +01:00