Skip to content

Commit 303da00

Browse files
authored
feat: Option to set created IngressClass as default one (#827)
1 parent 9bee0ad commit 303da00

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

charts/apisix-ingress-controller/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,10 @@ The same for container level, you need to set:
130130
| config.ingressPublishService | string | `""` | the controller will use the Endpoint of this Service to update the status information of the Ingress resource. The format is "namespace/svc-name" to solve the situation that the data plane and the controller are not deployed in the same namespace. |
131131
| config.ingressStatusAddress | list | `[]` | |
132132
| config.keyFile | string | `"/etc/webhook/certs/key.pem"` | the TLS key file path. |
133-
| config.kubernetes | object | `{"apiVersion":"apisix.apache.org/v2","apisixRouteVersion":"apisix.apache.org/v2","electionId":"ingress-apisix-leader","enableGatewayAPI":false,"ingressClass":"apisix","ingressVersion":"networking/v1","kubeconfig":"","namespaceSelector":[""],"resyncInterval":"6h","watchEndpointSlices":false}` | Kubernetes related configurations. |
133+
| config.kubernetes | object | `{"apiVersion":"apisix.apache.org/v2","apisixRouteVersion":"apisix.apache.org/v2","defaultIngressClass":false,"electionId":"ingress-apisix-leader","enableGatewayAPI":false,"ingressClass":"apisix","ingressVersion":"networking/v1","kubeconfig":"","namespaceSelector":[""],"resyncInterval":"6h","watchEndpointSlices":false}` | Kubernetes related configurations. |
134134
| config.kubernetes.apiVersion | string | `"apisix.apache.org/v2"` | the resource API version, support "apisix.apache.org/v2beta3" and "apisix.apache.org/v2". default is "apisix.apache.org/v2" |
135135
| config.kubernetes.apisixRouteVersion | string | `"apisix.apache.org/v2"` | the supported apisixroute api group version, can be "apisix.apache.org/v2" "apisix.apache.org/v2beta3" or "apisix.apache.org/v2beta2" |
136+
| config.kubernetes.defaultIngressClass | bool | `false` | If true, Ingresses without `ingressClassName` get assigned to this IngressClass on creation. Ref: https://kubernetes.io/docs/concepts/services-networking/ingress/#default-ingress-class |
136137
| config.kubernetes.electionId | string | `"ingress-apisix-leader"` | the election id for the controller leader campaign, only the leader will watch and delivery resource changes, other instances (as candidates) stand by. |
137138
| config.kubernetes.enableGatewayAPI | bool | `false` | whether to enable support for Gateway API. Note: This feature is currently under development and may not work as expected. It is not recommended to use it in a production environment. Before we announce support for it to reach Beta level or GA. |
138139
| config.kubernetes.ingressClass | string | `"apisix"` | The class of an Ingress object is set using the field IngressClassName in Kubernetes clusters version v1.18.0 or higher or the annotation "kubernetes.io/ingress.class" (deprecated). |

charts/apisix-ingress-controller/templates/ingress-class.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ apiVersion: {{ .Values.config.kubernetes.ingressVersion }}
88
kind: IngressClass
99
metadata:
1010
name: {{ .Values.config.kubernetes.ingressClass | quote }}
11+
{{- if .Values.config.kubernetes.defaultIngressClass }}
12+
annotations:
13+
ingressclass.kubernetes.io/is-default-class: "true"
14+
{{- end }}
1115
spec:
1216
controller: apisix.apache.org/apisix-ingress # fix: https://github.com/apache/apisix-ingress-controller/issues/1653

charts/apisix-ingress-controller/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ config:
123123
# Kubernetes clusters version v1.18.0 or higher or the annotation
124124
# "kubernetes.io/ingress.class" (deprecated).
125125
ingressClass: "apisix"
126+
# -- If true, Ingresses without `ingressClassName` get assigned to this IngressClass on creation.
127+
# Ref: https://kubernetes.io/docs/concepts/services-networking/ingress/#default-ingress-class
128+
defaultIngressClass: false
126129
# -- the supported ingress api group version, can be "networking/v1beta1",
127130
# "networking/v1" (for Kubernetes version v1.19.0 or higher), and
128131
# "extensions/v1beta1", default is "networking/v1".

0 commit comments

Comments
 (0)