Files
tailscale/cmd/k8s-operator/deploy/crds/tailscale.com_peerrelays.yaml
David Bond 373db59dae cmd/k8s-operator,k8s-operator: support dual-stack PeerRelay load balancers (#21663)
The reconciler forced the AWS load balancer address type to ipv4, so on
an IPv6 EKS cluster, where pod targets are IPv6, no Network Load
Balancer was ever provisioned.

Make the address type a default that spec.service.annotations can
override, defaulting IPv6 source NAT on when dualstack is requested.
Resolve load balancer hostnames for both address families and requeue
ready PeerRelays every five minutes, since DNS records for a new load
balancer arrive over several minutes. Add spec.service.ipFamilyPolicy
and ipFamilies so dual-stack GKE and AKS clusters can request a
dual-stack load balancer too.

Shorten the PeerRelay field descriptions and link to the PeerRelay docs
for the detail.

Fixes #21399

Change-Id: Idf22eb02f8ed9a46ff4abea8d4faef4b8c12c111

Signed-off-by: David Bond <[email protected]>
2026-10-10 10:05:23 +01:00

313 lines
17 KiB
YAML

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.22.0
name: peerrelays.tailscale.com
spec:
group: tailscale.com
names:
kind: PeerRelay
listKind: PeerRelayList
plural: peerrelays
shortNames:
- pr
singular: peerrelay
scope: Cluster
versions:
- additionalPrinterColumns:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
- description: Status of the deployed PeerRelay resources.
jsonPath: .status.conditions[?(@.type == "PeerRelayReady")].reason
name: Status
type: string
- description: Public addresses the peer relay replicas are reachable on.
jsonPath: .status.endpoints[*].address
name: Endpoints
type: string
name: v1alpha1
schema:
openAPIV3Schema:
type: object
required:
- spec
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: |-
Spec describes the desired state of the PeerRelay.
More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
type: object
properties:
aws:
description: |-
AWS pins each replica to an AWS Elastic IP and subnet. It applies only on EKS with the AWS Load Balancer
Controller. Leave it unset unless the peer relays must be reachable on addresses you control. When set,
you must also pin the pods to one availability zone, as ElasticIPs describes. If unset, each load
balancer spans every zone the controller finds, and the replica is reachable in any zone. See
https://tailscale.com/docs/kubernetes-operator/peer-relay.
type: object
required:
- elasticIPs
properties:
elasticIPs:
description: |-
ElasticIPs lists one Elastic IP allocation and subnet for each replica. Replica N uses entry N. The list
must have at least spec.replicas entries. Extra entries are allowed so that a scale-up does not fail
validation.
A load balancer only forwards to pods in the availability zone of its subnet. A pod scheduled into
another zone, for example after a reschedule, is unreachable on its Elastic IP but still appears healthy.
To prevent this, use subnets in one zone. Then pin the pods to that zone with a ProxyClass that sets
spec.statefulSet.pod.nodeSelector to topology.kubernetes.io/zone. A ProxyClass applies to every replica,
so this removes the zone redundancy of multiple replicas.
These values override the service.beta.kubernetes.io/aws-load-balancer-eip-allocations and
service.beta.kubernetes.io/aws-load-balancer-subnets annotations in spec.service.annotations.
type: array
minItems: 1
items:
description: PeerRelayAWSElasticIP pairs an EIP allocation with the subnet it is attached to.
type: object
required:
- allocationID
- subnetID
properties:
allocationID:
description: |-
AllocationID is the AWS Elastic IP allocation ID for this replica, for example eipalloc-0123abcd. The
operator sets it as the service.beta.kubernetes.io/aws-load-balancer-eip-allocations annotation on the
Service of the replica.
type: string
pattern: ^eipalloc-[0-9a-f]+$
subnetID:
description: |-
SubnetID is the public AWS subnet for the load balancer of this replica, for example subnet-0123abcd. The
Elastic IP takes the availability zone of this subnet. The operator sets it as the
service.beta.kubernetes.io/aws-load-balancer-subnets annotation on the Service of the replica.
type: string
pattern: ^subnet-[0-9a-f]+$
x-kubernetes-list-type: atomic
hostnamePrefix:
description: |-
HostnamePrefix is the hostname prefix for each replica. The operator appends the replica index to form
the full hostname, for example my-relay-0. If unset, the operator uses the PeerRelay name. The prefix can
contain lowercase letters, numbers, and dashes. It must not start with a dash and must be 1 to 62
characters long.
type: string
pattern: ^[a-z0-9][a-z0-9-]{0,61}$
proxyClass:
description: |-
ProxyClass is the name of a ProxyClass to apply to the resources the operator creates for this PeerRelay.
If unset, the operator uses the default configuration.
type: string
replicas:
description: |-
Replicas is the number of peer relay devices to run. Run more than one for high availability. Defaults
to 1. See https://tailscale.com/kb/1115/high-availability.
type: integer
format: int32
default: 1
minimum: 0
service:
description: Service configures the LoadBalancer Service that the operator creates for each replica.
type: object
properties:
annotations:
description: |-
Annotations to apply to the LoadBalancer Service. The operator sets some cloud provider annotations so
that the Service gets a public IP address. These annotations override any conflicting value set here.
The operator sets service.beta.kubernetes.io/aws-load-balancer-ip-address-type to ipv4 unless it is set
here. Set it to dualstack on an IPv6 EKS cluster. When it is dualstack, the operator also sets
service.beta.kubernetes.io/aws-load-balancer-enable-prefix-for-ipv6-source-nat to on unless it is set here.
type: object
additionalProperties:
type: string
ipFamilies:
description: |-
IPFamilies sets spec.ipFamilies on each LoadBalancer Service. If unset, the cluster default applies. The
value must agree with IPFamilyPolicy.
type: array
maxItems: 2
items:
description: |-
IPFamily represents the IP Family (IPv4 or IPv6). This type is used
to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies).
type: string
enum:
- IPv4
- IPv6
x-kubernetes-list-type: atomic
ipFamilyPolicy:
description: |-
IPFamilyPolicy sets spec.ipFamilyPolicy on each LoadBalancer Service. If unset, the cluster default
applies. Set RequireDualStack on a dual-stack cluster to get a load balancer with both IPv4 and IPv6
addresses. On EKS, use the service.beta.kubernetes.io/aws-load-balancer-ip-address-type annotation
instead.
type: string
enum:
- SingleStack
- PreferDualStack
- RequireDualStack
port:
description: |-
Port is the UDP port that each replica listens on and that its LoadBalancer Service exposes. The two
ports are always equal because the relay advertises address:port to peers. Changing the port briefly
interrupts relay traffic while the load balancer updates. Defaults to 41641.
type: integer
default: 41641
maximum: 65535
minimum: 1
staticEndpoints:
description: |-
StaticEndpoints lists extra address:port pairs where every replica is reachable from outside the
cluster, for example the public side of a NAT or firewall. The operator adds each entry to every replica
in status.endpoints and advertises it to peers. If an entry has the same address as a load balancer, the
port of the entry replaces the port of the load balancer. An address can appear in only one entry. Write
each entry as an IP address and port, for example 203.0.113.1:41641. Put IPv6 addresses in brackets, for
example [2001:db8::1]:41641.
type: array
items:
type: string
pattern: ^(\d{1,3}(\.\d{1,3}){3}|\[[0-9a-fA-F:.]+\]):\d{1,5}$
x-kubernetes-list-type: set
tags:
description: |-
Tags to apply to each peer relay device. Defaults to [tag:k8s]. If you set custom tags, the operator must
be an owner of each tag. You cannot change the tags after the operator creates the device. Each tag must
match ^tag:[a-zA-Z][a-zA-Z0-9-]*$. See https://tailscale.com/docs/kubernetes-operator/peer-relay.
type: array
items:
type: string
pattern: ^tag:[a-zA-Z][a-zA-Z0-9-]*$
tailnet:
description: |-
Tailnet is the name of the Tailnet resource for the tailnet this PeerRelay joins. If unset, the operator
uses the default tailnet. You cannot change this field after you set it.
type: string
x-kubernetes-validations:
- rule: self == oldSelf
message: PeerRelay tailnet is immutable
x-kubernetes-validations:
- rule: '!has(self.aws) || !has(self.aws.elasticIPs) || self.aws.elasticIPs.size() >= self.replicas'
message: spec.aws.elasticIPs must contain at least one entry per replica
status:
description: |-
Status describes the status of the PeerRelay. This is set
and managed by the Tailscale operator.
type: object
properties:
conditions:
type: array
items:
description: Condition contains details for one aspect of the current state of this API Resource.
type: object
required:
- lastTransitionTime
- message
- reason
- status
- type
properties:
lastTransitionTime:
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
type: string
format: date-time
message:
description: |-
message is a human readable message indicating details about the transition.
This may be an empty string.
type: string
maxLength: 32768
observedGeneration:
description: |-
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
type: integer
format: int64
minimum: 0
reason:
description: |-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
type: string
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
status:
description: status of the condition, one of True, False, Unknown.
type: string
enum:
- "True"
- "False"
- Unknown
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
type: string
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
endpoints:
description: |-
Endpoints lists the public address:port pairs where each replica is reachable. The operator adds entries
as the cloud provisions each Service. A replica has one entry for each address of its load balancer. A
load balancer has more than one address when it spans several availability zones or both address
families. Every replica also has one entry for each entry in spec.staticEndpoints.
type: array
items:
type: object
required:
- address
- port
- replica
properties:
address:
description: |-
Address is a public IP address of the load balancer for this replica, or an address from
spec.staticEndpoints. Peers connect to Address:Port over UDP.
type: string
port:
description: Port is the UDP port the peer relay listens on.
type: integer
format: int32
replica:
description: Replica is the zero-based index of the peer relay replica this endpoint targets.
type: integer
format: int32
x-kubernetes-list-map-keys:
- replica
- address
x-kubernetes-list-type: map
served: true
storage: true
subresources:
status: {}