Skip to content

Commit

Permalink
fix: replace deprecated Ingress annotation
Browse files Browse the repository at this point in the history
Before the IngressClass resource and ingressClassName field were added in Kubernetes 1.18, Ingress classes were specified with a kubernetes.io/ingress.class annotation on the Ingress. This annotation was never formally defined, but was widely supported by Ingress controllers.

The newer ingressClassName field on Ingresses is a replacement for that annotation, but is not a direct equivalent. While the annotation was generally used to reference the name of the Ingress controller that should implement the Ingress, the field is a reference to an IngressClass resource that contains additional Ingress configuration, including the name of the Ingress controller.

Cf. https://kubernetes.io/docs/concepts/services-networking/ingress/#deprecated-annotation

Signed-off-by: Guilhem Bonnefille <[email protected]>
  • Loading branch information
gbonnefille committed Jul 7, 2023
1 parent 1392456 commit 69f8b6e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ var routeAnnotations = func(endpointName string) map[string]string {

var nginxIngressAnnotations = func(endpointName string) map[string]string {
return map[string]string{
"kubernetes.io/ingress.class": "nginx",
"nginx.ingress.kubernetes.io/rewrite-target": "/",
"nginx.ingress.kubernetes.io/ssl-redirect": "false",
constants.DevWorkspaceEndpointNameAnnotation: endpointName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ func getIngressForEndpoint(routingSuffix string, endpoint controllerv1alpha1.End
Annotations: nginxIngressAnnotations(endpoint.Name),
},
Spec: networkingv1.IngressSpec{
IngressClassName: "nginx",
Rules: []networkingv1.IngressRule{
{
Host: hostname,
Expand Down

0 comments on commit 69f8b6e

Please sign in to comment.