-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: replace deprecated Ingress annotation #1143
Conversation
Hi @gbonnefille. Thanks for your PR. I'm waiting for a devfile member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
93c98bd
to
69f8b6e
Compare
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 <guilhem.bonnefille@csgroup.eu>
69f8b6e
to
5cded0f
Compare
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #1143 +/- ##
==========================================
+ Coverage 52.37% 52.43% +0.05%
==========================================
Files 81 81
Lines 7381 7381
==========================================
+ Hits 3866 3870 +4
+ Misses 3234 3230 -4
Partials 281 281
☔ View full report in Codecov by Sentry. |
Since the addition of Kind=IngressClass, there is no reason to hardcode a reference to nginx in the generated Kind=Ingress. Perhaps DWO can look at Kind=IngressClass, identify the default one, and then use this as |
/ok-to-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @gbonnefille for continuing to follow up here; it's much appreciated!
I'd still like to figure something out for #1068 -- I'll try to fit it in when I have time, I've been more focused on the OpenShift use case.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: amisevsk, gbonnefille The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Yes, finding a solution for #1068 could be really interesting. Having in mind that the availability of Kind=ingressClass could be a solution to discover the default IngressClassName instead of having the user to configure it, I started reviewing the code. And it is hard to find an elegant solution. Because I will need to search for the Kind=IngressClass from solver implementations, but in this context we do not have simple access to the K8S itself (for example, for requesting the list of Kind=IngressClass). I also realized that a good implementation would need to request the K8S in order to evaluate if we are using And finally, as Ingress is a mess with many implementation specific annotations, having a basic_router without any hardcoded values, but a good way to configure any aspect could help a lot. |
Yeah, making manual configuration possible would be ideal, though as you say the variety of ingress implementations is kind of a mess, and anything we do around this would also require work in whatever operators depend on us (and implement a routing reconcile -- e.g. Che Operator). It'd be great if there was a way to automatically detect e.g. traefik vs nginx and apply the appropriate annotations, though I don't know if it's possible on Kubernetes (on OpenShift, we use e.g. a test route to discover the cluster's base hostname). |
Yes, sure.
First, the IngressClass' name. As spotted by https://kubernetes.io/docs/concepts/services-networking/ingress/, the With the current fix proposed by this PR, a K8S cluster admin is able to have basic routing solver works, as he only have to declare a Kind=IngressClass with name nginx and routing to the traefik. Other ideas:
But it could be tricky to auto-discover and if the automatic job is not the right one, there is no chance to manually adapt it. One possible other solution is to use a dedicated IngressClass resource, with name Concerning the other annotations ( |
Please, note that cert-manager, an other controller having to create Ingress in order to solve the ACME challenge, has a setting for |
Merging this PR as it fixes a problem (thanks again!). I'll try to schedule some work on configuring ingress annotations/ingress class when I have some time. |
What does this PR do?
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
PR Checklist
/test v8-devworkspace-operator-e2e, v8-che-happy-path
to trigger)v8-devworkspace-operator-e2e
: DevWorkspace e2e testv8-che-happy-path
: Happy path for verification integration with Che