Back to Cilium

Protocol Documentation

pkg/ztunnel/pb/README.md

1.19.326.9 KB
Original Source

Protocol Documentation

<a name="top"></a>

Table of Contents

<a name="ca_ztunnel-proto"></a>

<p align="right"><a href="#top">Top</a></p>

ca_ztunnel.proto

<a name="istio-v1-auth-IstioCertificateRequest"></a>

IstioCertificateRequest

Certificate request message. The authentication should be based on:

  1. Bearer tokens carried in the side channel;
  2. Client-side certificate via Mutual TLS handshake. Note: the service implementation is REQUIRED to verify the authenticated caller is authorize to all SANs in the CSR. The server side may overwrite any requested certificate field based on its policies.
FieldTypeLabelDescription
csrstringPEM-encoded certificate request. The public key in the CSR is used to generate the certificate, and other fields in the generated certificate may be overwritten by the CA.
validity_durationint64Optional: requested certificate validity period, in seconds.
metadatagoogle.protobuf.Struct$hide_from_docs Optional: Opaque metadata provided by the XDS node to Istio. Supported metadata: WorkloadName, WorkloadIP, ClusterID

<a name="istio-v1-auth-IstioCertificateResponse"></a>

IstioCertificateResponse

Certificate response message.

FieldTypeLabelDescription
cert_chainstringrepeatedPEM-encoded certificate chain. The leaf cert is the first element, and the root cert is the last element.

<a name="istio-v1-auth-IstioCertificateService"></a>

IstioCertificateService

Service for managing certificates issued by the CA.

Method NameRequest TypeResponse TypeDescription
CreateCertificateIstioCertificateRequestIstioCertificateResponseUsing provided CSR, returns a signed certificate.

<a name="workload_ztunnel-proto"></a>

<p align="right"><a href="#top">Top</a></p>

workload_ztunnel.proto

<a name="istio-workload-Address"></a>

Address

Address represents a unique address.

Address joins two sub-resources, Workload and Service, to support querying by IP address. Address is intended to be able to be looked up on-demand, allowing a client to answer a question like "what is this IP address", similar to a reverse DNS lookup.

Each resource will have a mesh-wide unique opaque name, defined in the individual messages. In addition, to support lookup by IP address, they will have alias names for each IP the resource represents. There may be multiple aliases for the same resource (examples: service in multiple networks, or a dual-stack workload). Aliases are keyed by network/IP address. Example: "default/1.2.3.4".

In some cases, we do not know the IP address of a Workload. For instance, we may simply know that there is a workload behind a gateway, and rely on the gateway to handle the rest. In this case, the key format will be "resource-uid". The resource can be a Pod, WorkloadEntry, etc. These resources cannot be looked up on-demand.

In some cases, we do not know the IP address of a Service. These services cannot be used for matching outbound traffic, as we only have L4 attributes to route based on. However, they can be used for Gateways. In this case, the key format will be "network/hostname". These resources cannot be looked up on-demand.

FieldTypeLabelDescription
workloadWorkloadWorkload represents an individual workload. This could be a single Pod, a VM instance, etc.
serviceServiceService represents a service - a group of workloads that can be accessed together.

<a name="istio-workload-ApplicationTunnel"></a>

ApplicationTunnel

ApplicationProtocol specifies a workload (application or gateway) can consume tunnel information.

FieldTypeLabelDescription
protocolApplicationTunnel.ProtocolA target natively handles this type of traffic.
portuint32optional: if set, traffic should be sent to this port after the last zTunnel hop

<a name="istio-workload-Extension"></a>

Extension

Extension provides a mechanism to attach arbitrary additional configuration to an object.

FieldTypeLabelDescription
namestringname provides an opaque name for the extension. This may have semantic meaning or used for debugging. This should be unique amongst all extensions attached to an item.
configgoogle.protobuf.Anyconfig provides some opaque configuration.

<a name="istio-workload-GatewayAddress"></a>

GatewayAddress

GatewayAddress represents the address of a gateway

FieldTypeLabelDescription
hostnameNamespacedHostnameTODO: add support for hostname lookup
addressNetworkAddress
hbone_mtls_portuint32port to reach the gateway at for mTLS HBONE connections

<a name="istio-workload-LoadBalancing"></a>

LoadBalancing

FieldTypeLabelDescription
routing_preferenceLoadBalancing.Scoperepeatedrouting_preference defines what scopes we want to keep traffic within. The mode determines how these routing preferences are handled
modeLoadBalancing.Modemode defines how we should handle the routing preferences.
health_policyLoadBalancing.HealthPolicyhealth_policy defines how we should filter endpoints

<a name="istio-workload-Locality"></a>

Locality

FieldTypeLabelDescription
regionstring
zonestring
subzonestring

<a name="istio-workload-NamespacedHostname"></a>

NamespacedHostname

NamespacedHostname represents a service bound to a specific namespace.

FieldTypeLabelDescription
namespacestringThe namespace the service is in.
hostnamestringhostname (ex: gateway.example.com)

<a name="istio-workload-NetworkAddress"></a>

NetworkAddress

NetworkAddress represents an address bound to a specific network.

FieldTypeLabelDescription
networkstringNetwork represents the network this address is on.
addressbytesAddress presents the IP (v4 or v6).

<a name="istio-workload-Port"></a>

Port

FieldTypeLabelDescription
service_portuint32Port the service is reached at (frontend).
target_portuint32Port the service forwards to (backend).

<a name="istio-workload-PortList"></a>

PortList

PorList represents the ports for a service

FieldTypeLabelDescription
portsPortrepeated

<a name="istio-workload-Service"></a>

Service

Service represents a service - a group of workloads that can be accessed together. The xds primary key is "namespace/hostname". Secondary (alias) keys are the unique network/IP pairs that the service can be reached at.

FieldTypeLabelDescription
namestringName represents the name for the service. For Kubernetes, this is the Service name.
namespacestringNamespace represents the namespace for the service.
hostnamestringHostname represents the FQDN of the service. For Kubernetes, this would be <name>.<namespace>.svc.<cluster domain>.
addressesNetworkAddressrepeatedAddress represents the addresses the service can be reached at. There may be multiple addresses for a single service if it resides in multiple networks, multiple clusters, and/or if it's dual stack. For a headless kubernetes service, this list will be empty.
portsPortrepeatedPorts for the service. The target_port may be overridden on a per-workload basis.
subject_alt_namesstringrepeatedOptional; if set, the SAN to verify for TLS connections. Typically, this is not set and per-workload identity is used to verify
waypointGatewayAddressWaypoint is the waypoint proxy for this service. When set, all incoming requests must go through the waypoint.
load_balancingLoadBalancingLoad balancing policy for selecting endpoints. Note: this applies only to connecting directly to the workload; when waypoints are used, the waypoint's load_balancing configuration is used.
ip_familiesIPFamiliesIP families provides configuration about the IP families this service supports.
extensionsExtensionrepeatedExtension provides a mechanism to attach arbitrary additional configuration to an object.

<a name="istio-workload-Workload"></a>

Workload

Workload represents a workload - an endpoint (or collection behind a hostname). The xds primary key is "uid" as defined on the workload below. Secondary (alias) keys are the unique network/IP pairs that the workload can be reached at.

FieldTypeLabelDescription
uidstringUID represents a globally unique opaque identifier for this workload. For k8s resources, it is recommended to use the more readable format:

cluster/group/kind/namespace/name/section-name

As an example, a ServiceEntry with two WorkloadEntries inlined could become two Workloads with the following UIDs: - cluster1/networking.istio.io/v1alpha3/ServiceEntry/default/external-svc/endpoint1 - cluster1/networking.istio.io/v1alpha3/ServiceEntry/default/external-svc/endpoint2

For VMs and other workloads other formats are also supported; for example, a single UID string: "0ae5c03d-5fb3-4eb9-9de8-2bd4b51606ba" | | name | string | | Name represents the name for the workload. For Kubernetes, this is the pod name. This is just for debugging and may be elided as an optimization. | | namespace | string | | Namespace represents the namespace for the workload. This is just for debugging and may be elided as an optimization. | | addresses | bytes | repeated | Address represents the IPv4/IPv6 address for the workload. This should be globally unique. This should not have a port number. Each workload must have at least either an address or hostname; not both. | | hostname | string | | The hostname for the workload to be resolved by the ztunnel. DNS queries are sent on-demand by default. If the resolved DNS query has several endpoints, the request will be forwarded to the first response.

At a minimum, each workload must have either an address or hostname. For example, a workload that backs a Kubernetes service will typically have only endpoints. A workload that backs a headless Kubernetes service, however, will have both addresses as well as a hostname used for direct access to the headless endpoint. | | network | string | | Network represents the network this workload is on. This may be elided for the default network. A (network,address) pair makeup a unique key for a workload at a point in time. | | tunnel_protocol | TunnelProtocol | | Protocol that should be used to connect to this workload. | | trust_domain | string | | The SPIFFE identity of the workload. The identity is joined to form spiffe://<trust_domain>/ns/<namespace>/sa/<service_account>. TrustDomain of the workload. May be elided if this is the mesh wide default (typically cluster.local) | | service_account | string | | ServiceAccount of the workload. May be elided if this is "default" | | waypoint | GatewayAddress | | If present, the waypoint proxy for this workload. All incoming requests must go through the waypoint. | | network_gateway | GatewayAddress | | If present, East West network gateway this workload can be reached through. Requests from remote networks should traverse this gateway. | | node | string | | Name of the node the workload runs on | | canonical_name | string | | CanonicalName for the workload. Used for telemetry. | | canonical_revision | string | | CanonicalRevision for the workload. Used for telemetry. | | workload_type | WorkloadType | | WorkloadType represents the type of the workload. Used for telemetry. | | workload_name | string | | WorkloadName represents the name for the workload (of type WorkloadType). Used for telemetry. | | native_tunnel | bool | | If set, this indicates a workload expects to directly receive tunnel traffic. In ztunnel, this means: * Requests from this workload do not need to be tunneled if they already are tunneled by the tunnel_protocol. * Requests to this workload, via the tunnel_protocol, do not need to be de-tunneled. | | application_tunnel | ApplicationTunnel | | If an application, such as a sandwiched waypoint proxy, supports directly receiving information from zTunnel they can set application_protocol. | | services | Workload.ServicesEntry | repeated | The services for which this workload is an endpoint. The key is the NamespacedHostname string of the format namespace/hostname. | | authorization_policies | string | repeated | A list of authorization policies applicable to this workload. NOTE: this only includes Selector based policies. Namespace and global polices are returned out of band. Authorization policies are only valid for workloads with addresses rather than hostname. | | status | WorkloadStatus | | | | cluster_id | string | | The cluster ID that the workload instance belongs to | | locality | Locality | | The Locality defines information about where a workload is geographically deployed | | network_mode | NetworkMode | | | | extensions | Extension | repeated | Extension provides a mechanism to attach arbitrary additional configuration to an object. | | capacity | google.protobuf.UInt32Value | | Capacity for this workload. This represents the amount of traffic the workload can handle, relative to other workloads If unset, the capacity is default to 1. |

<a name="istio-workload-Workload-ServicesEntry"></a>

Workload.ServicesEntry

FieldTypeLabelDescription
keystring
valuePortList

<a name="istio-workload-ApplicationTunnel-Protocol"></a>

ApplicationTunnel.Protocol

NameNumberDescription
NONE0Bytes are copied from the inner stream without modification.
PROXY1Prepend PROXY protocol headers before copying bytes Standard PROXY source and destination information is included, along with potential extra TLV headers: 0xD0 - The SPIFFE identity of the source workload 0xD1 - The FQDN or Hostname of the targeted Service

<a name="istio-workload-IPFamilies"></a>

IPFamilies

NameNumberDescription
AUTOMATIC0AUTOMATIC is inferred from the configured addresses.
IPV4_ONLY1Only IPv4 is supported
IPV6_ONLY2Only IPv6 is supported
DUAL3Both IPv4 and IPv6 is supported

<a name="istio-workload-LoadBalancing-HealthPolicy"></a>

LoadBalancing.HealthPolicy

NameNumberDescription
ONLY_HEALTHY0Only select healthy endpoints
ALLOW_ALL1Include all endpoints, even if they are unhealthy.

<a name="istio-workload-LoadBalancing-Mode"></a>

LoadBalancing.Mode

NameNumberDescription
UNSPECIFIED_MODE0
STRICT1In STRICT mode, only endpoints that meets all of the routing preferences will be considered. This can be used, for instance, to keep traffic ONLY within the same cluster/node/region. This should be used with caution, as it can result in all traffic being dropped if there is no matching endpoints, even if there are endpoints outside of the preferences.
FAILOVER2In FAILOVER mode, endpoint selection will prefer endpoints that match all preferences, but failover to groups of endpoints that match less (or, eventually, none) preferences. For instance, with [NETWORK, REGION, ZONE], we will send to: 1. Endpoints matching [NETWORK, REGION, ZONE] 2. Endpoints matching [NETWORK, REGION] 3. Endpoints matching [NETWORK] 4. Any endpoints

<a name="istio-workload-LoadBalancing-Scope"></a>

LoadBalancing.Scope

NameNumberDescription
UNSPECIFIED_SCOPE0
REGION1Prefer traffic in the same region.
ZONE2Prefer traffic in the same zone.
SUBZONE3Prefer traffic in the same subzone.
NODE4Prefer traffic on the same node.
CLUSTER5Prefer traffic in the same cluster.
NETWORK6Prefer traffic in the same network.

<a name="istio-workload-NetworkMode"></a>

NetworkMode

NetworkMode indicates how the addresses of the workload should be treated.

NameNumberDescription
STANDARD0STANDARD means that the workload is uniquely identified by its address (within its network).
HOST_NETWORK1HOST_NETWORK means the workload has an IP address that is shared by many workloads. The data plane should avoid attempting to lookup these workloads by IP address (which could return the wrong result).

<a name="istio-workload-TunnelProtocol"></a>

TunnelProtocol

TunnelProtocol indicates the tunneling protocol for requests.

NameNumberDescription
NONE0NONE means requests should be forwarded as-is, without tunneling.
HBONE1HBONE means requests should be tunneled over HTTP. This does not dictate HTTP/1.1 vs HTTP/2; ALPN should be used for that purpose.

Future options may include things like QUIC/HTTP3, etc. |

<a name="istio-workload-WorkloadStatus"></a>

WorkloadStatus

NameNumberDescription
HEALTHY0Workload is healthy and ready to serve traffic.
UNHEALTHY1Workload is unhealthy and NOT ready to serve traffic.

<a name="istio-workload-WorkloadType"></a>

WorkloadType

NameNumberDescription
DEPLOYMENT0
CRONJOB1
POD2
JOB3

<a name="zds_ztunnel-proto"></a>

<p align="right"><a href="#top">Top</a></p>

zds_ztunnel.proto

<a name="istio-workload-zds-Ack"></a>

Ack

Ztunnel ack message. If error is not empty, this is an error message.

FieldTypeLabelDescription
errorstring

<a name="istio-workload-zds-AddWorkload"></a>

AddWorkload

Add a workload to the ztunnel. This will be accompanied by ancillary data containing the workload's netns file descriptor.

FieldTypeLabelDescription
uidstring
workload_infoWorkloadInfo

<a name="istio-workload-zds-DelWorkload"></a>

DelWorkload

Delete a workload from the ztunnel. Ztunnel should shutdown the workload's proxy.

FieldTypeLabelDescription
uidstring

<a name="istio-workload-zds-KeepWorkload"></a>

KeepWorkload

Keep workload that we can't find in the fd cache. This can only be sent before SnapshotSent is sent to signal ztunnel to not delete the workload if it has it.

FieldTypeLabelDescription
uidstring

<a name="istio-workload-zds-SnapshotSent"></a>

SnapshotSent

Let ztunnel know that a full snapshot was sent. Ztunnel should reconcile its internal state and remove internal entries that were not sent.

<a name="istio-workload-zds-WorkloadInfo"></a>

WorkloadInfo

FieldTypeLabelDescription
namestring
namespacestring
service_accountstring

<a name="istio-workload-zds-WorkloadRequest"></a>

WorkloadRequest

Sent from CNI to ztunnel

FieldTypeLabelDescription
addAddWorkload
keepKeepWorkload
delDelWorkload
snapshot_sentSnapshotSent

<a name="istio-workload-zds-WorkloadResponse"></a>

WorkloadResponse

Sent from ztunnel to CNI

FieldTypeLabelDescription
ackAck

<a name="istio-workload-zds-ZdsHello"></a>

ZdsHello

FieldTypeLabelDescription
versionVersion

<a name="istio-workload-zds-Version"></a>

Version

NameNumberDescription
NOT_USED0
V11

Scalar Value Types

.proto TypeNotesC++JavaPythonGoC#PHPRuby
<a name="double" /> doubledoubledoublefloatfloat64doublefloatFloat
<a name="float" /> floatfloatfloatfloatfloat32floatfloatFloat
<a name="int32" /> int32Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.int32intintint32intintegerBignum or Fixnum (as required)
<a name="int64" /> int64Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.int64longint/longint64longinteger/stringBignum
<a name="uint32" /> uint32Uses variable-length encoding.uint32intint/longuint32uintintegerBignum or Fixnum (as required)
<a name="uint64" /> uint64Uses variable-length encoding.uint64longint/longuint64ulonginteger/stringBignum or Fixnum (as required)
<a name="sint32" /> sint32Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.int32intintint32intintegerBignum or Fixnum (as required)
<a name="sint64" /> sint64Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.int64longint/longint64longinteger/stringBignum
<a name="fixed32" /> fixed32Always four bytes. More efficient than uint32 if values are often greater than 2^28.uint32intintuint32uintintegerBignum or Fixnum (as required)
<a name="fixed64" /> fixed64Always eight bytes. More efficient than uint64 if values are often greater than 2^56.uint64longint/longuint64ulonginteger/stringBignum
<a name="sfixed32" /> sfixed32Always four bytes.int32intintint32intintegerBignum or Fixnum (as required)
<a name="sfixed64" /> sfixed64Always eight bytes.int64longint/longint64longinteger/stringBignum
<a name="bool" /> boolboolbooleanbooleanboolboolbooleanTrueClass/FalseClass
<a name="string" /> stringA string must always contain UTF-8 encoded or 7-bit ASCII text.stringStringstr/unicodestringstringstringString (UTF-8)
<a name="bytes" /> bytesMay contain any arbitrary sequence of bytes.stringByteStringstr[]byteByteStringstringString (ASCII-8BIT)