On Kubernetes, the namespace a policy is created in restricts which proxies it can reach.
targetRef narrows within that reach, it can’t widen it. The control plane works out the
reach from the policy’s shape and records it in the kuma.io/policy-role label, which it
computes on every write.
|
Policy
|
kuma.io/policy-role
|
Reaches
|
|
Created on the global control plane
|
system
|
Every proxy in the mesh, in every zone.
|
Created in the system namespace, kong-mesh-system, of a zone control plane
|
system
|
Every proxy in that zone. It isn’t distributed to other zones.
|
Created in an application namespace, where every to[] item selects one local destination. Each item is a MeshService or MeshHTTPRoute selected by these three labels and no others:
kuma.io/display-name
k8s.kuma.io/namespace, set to the policy’s own namespace
kuma.io/zone, set to the local zone
|
producer
|
Every client of that destination, in any namespace and any zone.
|
Created in an application namespace, with at least one to[] item selected any other way. For example, by kuma.io/display-name alone, or with k8s.kuma.io/namespace set to another namespace.
|
consumer
|
Only proxies in the policy’s own namespace.
|
Created in an application namespace, with no to[] at all
|
workload-owner
|
Only proxies in the policy’s own namespace.
|
A policy can’t mix producer and consumer items. A policy that names a single destination in one
to[] item and something broader in another is rejected on admission.
targetRef.kind: Mesh does not select the whole mesh on its own. In a consumer or
workload-owner policy it selects every proxy in that policy’s namespace. Creating it in
kong-mesh-system widens it to the whole zone, not the whole mesh: a policy
created on a zone control plane stays in that zone. Only the global control plane, or a
producer policy, reaches every zone.
A selector with only kuma.io/display-name, or with any extra label, makes the item a
consumer item.
A zone control plane sets the kuma.io/origin: zone label on the policies created there. You
don’t need to set it, and if you do, any value other than zone is rejected.
Universal has no namespaces, so every policy is system. A policy created on the global
control plane reaches every zone, and one created on a zone control plane reaches only that
zone.