ReferenceGrant

gateway.networking.k8s.io/v1


Gateway API Versionv1.6.0

ReferenceGrant identifies kinds of resources in other namespaces that are trusted to reference the specified kinds of resources in the same namespace as the policy.

Each ReferenceGrant can be used to represent a unique trust relationship.
Additional Reference Grants can be used to add to the set of trusted sources of inbound references for the namespace they are defined within.

All cross-namespace references in Gateway API (with the exception of cross-namespace Gateway-route attachment) require a ReferenceGrant.

ReferenceGrant is a form of runtime verification allowing users to assert which cross-namespace object references are permitted. Implementations that support ReferenceGrant MUST NOT permit cross-namespace references which have no grant, and MUST respond to the removal of a grant by revoking the access that the grant allowed.

---
config:
  theme: base
  themeVariables:
    secondaryColor: '#ffffff'
---
block
  columns 7

  classDef al_ref_box fill:#F2F2F2,stroke:#555;
  classDef al_mgw_box fill:#70991F,stroke:#555;
  classDef al_gwapi_box fill:#326CE5,stroke:#555;
  classDef al_std_box fill:#808B8F,stroke:#555;
  classDef al_self_box fill:#326CE5,stroke:#777,stroke-width:5px; 

  
  space:3
  
  ReferenceGrant["<a href='../../../gateway-api/reference-grant/v1'>&nbsp;&nbsp;<b>ReferenceGrant</b>&nbsp;&nbsp;</a>"]
  class ReferenceGrant al_self_box
  
  
  space:2
  block:Ref:1
    columns 1
    Gateway["<a href='../../../gateway-api/gateway/v1'>&nbsp;&nbsp;Gateway&nbsp;&nbsp;</a>"]
    HTTPRoute["<a href='../../../gateway-api/http-route/v1'>&nbsp;&nbsp;HTTPRoute&nbsp;&nbsp;</a>"]
    ListenerSet["<a href='../../../gateway-api/listener-set/v1'>&nbsp;&nbsp;ListenerSet&nbsp;&nbsp;</a>"]
    class Gateway,HTTPRoute,ListenerSet al_gwapi_box
  end
  class Ref al_ref_box
  
  

  ReferenceGrant -- "<br><i>references</i>" --> Ref
apiVersion: gateway.networking.k8s.io/v1
kind: ReferenceGrant
metadata:
  name: reference-grant-example
  namespace: example-namespace
spec:
  from:
    - group: gateway.networking.k8s.io
      kind: HTTPRoute
      namespace: other-namespace
  to:
    - group: ""
      kind: Service
      name: backend

ReferenceGrant

Field Description Type Required Default Allowed Values
metadata defines the resource’s metadata ObjectMeta yes
spec defines the desired state of ReferenceGrant. object yes

ReferenceGrant.spec

Field Description Type Required Default Allowed Values
from describes the trusted namespaces and kinds that can reference the resources described in “To”. Each entry in this list MUST be considered to be an additional place that references can be valid from, or to put this another way, entries MUST be combined using OR. object[] yes
to describes the resources that may be referenced by the resources described in “From”. Each entry in this list MUST be considered to be an additional place that references can be valid to, or to put this another way, entries MUST be combined using OR. object[] yes

ReferenceGrant.spec.from[]

Field Description Type Required Default Allowed Values
group is the group of the referent.
When empty, the Kubernetes core API group is inferred.
string yes
kind is the kind of the referent. Although implementations may support additional resources, the following types are part of the “Core” support level for this field.

When used to permit a SecretObjectReference:
When used to permit a BackendObjectReference:
  • GRPCRoute
  • HTTPRoute
  • TCPRoute
  • TLSRoute
  • UDPRoute
string yes
namespace is the namespace of the referent. string yes

ReferenceGrant.spec.to[]

Field Description Type Required Default Allowed Values
group is the group of the referent.
When empty, the Kubernetes core API group is inferred.
string yes
kind is the kind of the referent. Although implementations may support additional resources, the following types are part of the “Core” support level for this field:
  • Secret when used to permit a SecretObjectReference
  • Service when used to permit a BackendObjectReference
string yes
name is the name of the referent. When unspecified, this policy refers to all resources of the specified Group and Kind in the local namespace. string no