|
1 | 1 | --- |
2 | | -title: Ingress Annotations |
| 2 | +title: Annotations |
3 | 3 | slug: /reference/apisix-ingress-controller/annotation |
4 | | -description: Learn how annotations extend the functionality of Kubernetes Ingress resource in APISIX Ingress Controller to configure routing, security, and gateway behaviors. |
| 4 | +description: Learn how annotations extend the functionality of Kubernetes Ingress and IngressClass resource in APISIX Ingress Controller to configure routing, security, and gateway behaviors. |
5 | 5 | --- |
6 | 6 |
|
7 | | -Annotations are key-value pairs that allow controllers to configure functionalities that are not available through standard Kubernetes resource fields. In APISIX Ingress Controller, annotations are commonly used with Ingress resources to configure gateway behaviors, routing rules, upstream settings, plugins, and other features. Alternatively, you can use APISIX CRDs to configure these features for a better experience. |
| 7 | +Annotations are key-value pairs that allow controllers to configure functionalities that are not available through standard Kubernetes resource fields. In APISIX Ingress Controller, annotations are commonly used to configure gateway behaviors, routing rules, upstream settings, plugins, and other features. Alternatively, you can use APISIX CRDs to configure these features for a better experience. |
8 | 8 |
|
9 | 9 | This document describes all available annotations and their uses. |
10 | 10 |
|
11 | | -## All Annotations |
| 11 | +## Ingress Annotations |
12 | 12 |
|
13 | 13 | | Annotation | |
14 | 14 | | ------------------------------------------------------ | |
@@ -52,6 +52,12 @@ This document describes all available annotations and their uses. |
52 | 52 | | `k8s.apisix.apache.org/auth-type` | |
53 | 53 | | `k8s.apisix.apache.org/svc-namespace` | |
54 | 54 |
|
| 55 | +## IngressClass Annotations |
| 56 | + |
| 57 | +| Annotation | |
| 58 | +| ------------------------------------------------------ | |
| 59 | +| `apisix.apache.org/parameters-namespace` | |
| 60 | + |
55 | 61 | ## Annotation Details |
56 | 62 |
|
57 | 63 | Note that annotation keys and values can only be strings. |
@@ -272,8 +278,9 @@ apiVersion: networking.k8s.io/v1 |
272 | 278 | kind: Ingress |
273 | 279 | metadata: |
274 | 280 | name: cross-namespace-ingress |
| 281 | + namespace: aic # Ingress is in aic namespace |
275 | 282 | annotations: |
276 | | - k8s.apisix.apache.org/svc-namespace: "other-namespace" |
| 283 | + k8s.apisix.apache.org/svc-namespace: "other-namespace" # Service is in other-namespace |
277 | 284 | spec: |
278 | 285 | ingressClassName: apisix |
279 | 286 | rules: |
@@ -610,3 +617,26 @@ spec: |
610 | 617 | port: |
611 | 618 | number: 80 |
612 | 619 | ``` |
| 620 | + |
| 621 | +### GatewayProxy Namespace Specification |
| 622 | + |
| 623 | +The `apisix.apache.org/parameters-namespace` annotation enables the specification of a custom namespace for GatewayProxy resources referenced by an IngressClass. This is used when a GatewayProxy resource resides in a specific namespace, as IngressClass is cluster-scoped and requires the namespace to locate the resource. |
| 624 | + |
| 625 | +The annotation takes precedence over the `parameters.namespace` field in the IngressClass spec. If neither is specified, it defaults to the `default` namespace. |
| 626 | + |
| 627 | +For example: |
| 628 | + |
| 629 | +```yaml |
| 630 | +apiVersion: networking.k8s.io/v1 |
| 631 | +kind: IngressClass |
| 632 | +metadata: |
| 633 | + name: apisix |
| 634 | + annotations: |
| 635 | + apisix.apache.org/parameters-namespace: "apisix-system" |
| 636 | +spec: |
| 637 | + controller: apisix.apache.org/ingress-controller |
| 638 | + parameters: |
| 639 | + apiGroup: apisix.apache.org |
| 640 | + kind: GatewayProxy |
| 641 | + name: apisix-config |
| 642 | +``` |
0 commit comments