TIS1107 - Preferred Gateway Nomenclature
The preferred nomenclature for gateways in Istio is [gateway namespace]/[gateway name]
.
[namespace]/[gateway name]
To ensure clear and unambiguous gateway references, always use the preferred nomenclature [gateway namespace]/[gateway name]
in VirtualService
configurations.
Examples
-
VirtualService
with Incorrect Gateway NomenclatureapiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: my-virtual-service
namespace: example-namespace
spec:
hosts:
- "my-app.example.com"
gateways:
- "my-gateway"
http:
- route:
- destination:
host: "my-app-service.example-namespace.svc.cluster.local"Explanation: The
gateway
field in theVirtualService
is set as"my-gateway"
without specifying the namespace. The preferred Istio nomenclature for referencing gateways is[gateway namespace]/[gateway name]
, which provides clarity and avoids conflicts when gateways with the same name exist in different namespaces.
Recommendation
Update the nomenclature of the gateways to the supported Istio format [gateway namespace]/[gateway name]
.
-
Update Gateway Nomenclature to Include Namespace
Update the
gateway
reference to include both the namespace and the gateway name.apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: my-virtual-service
namespace: example-namespace
spec:
hosts:
- "my-app.example.com"
gateways:
- "example-namespace/my-gateway"
http:
- route:
- destination:
host: "my-app-service.example-namespace.svc.cluster.local"Explanation: Updating the gateway reference to
"example-namespace/my-gateway"
provides the complete and preferred nomenclature, avoiding ambiguity and ensuring that the correct gateway is used in the configuration.