Repository navigation
cmd/k8s-operator: adds a tailscale IngressClass resource, prints warning if class not found. - #10823
Conversation
Some Ingress validating webhooks reject Ingresses with .spec.ingressClassName for which there is no matching IngressClass. Updates #10820 Signed-off-by: Irbe Krumina <[email protected]>
…ter. We currently do not utilize the IngressClass, however we might in the future at which point we might start requiring that the right class for this controller instance actually exists. Signed-off-by: Irbe Krumina <[email protected]>
39057ea to
a7d0ad0
Compare
| // deprovisioning later. | ||
| func (a *IngressReconciler) maybeProvision(ctx context.Context, logger *zap.SugaredLogger, ing *networkingv1.Ingress) error { | ||
| if err := a.validateIngressClass(ctx); err != nil { | ||
| logger.Warnf("error validating tailscale IngressClass: %v. In future this might be a terminal error.", err) |
There was a problem hiding this comment.
This appears at default ('info') logs
{"level":"warn","ts":"2024-01-11T12:11:18Z","logger":"ingress-reconciler","msg":"error validating tailscale IngressClass: ingressclass.kubernetes.io/is-default-class annotation is set on 'tailscale' IngressClass, but Tailscale Ingress controller does not support default Ingress class. Ensure that you are using 'tailscale' IngressClass from latest Tailscale installation manifests.. In future this might be a terminal error.","ingress-ns":"default","ingress-name":"kuardfoobar"}
| Name: tailscaleIngressClassName, | ||
| }, | ||
| } | ||
| if err := a.Get(ctx, client.ObjectKeyFromObject(ic), ic); apierrors.IsNotFound(err) { |
There was a problem hiding this comment.
Doing this will start a watch for IngressClass as that's what c/r does by default. I don't really see that as an issue since those are small resources of which there shouldn't be many. I do want to clean up our caching logic at some point though, we could cache less and cache metadata only in some cases, but so far no-one has raised memory consumption issues or slowness
There was a problem hiding this comment.
Should this be a code comment to make sure folks reading this code have more context? It's going to be more visible than a comment on the PR.
There was a problem hiding this comment.
For this particular one I would rather not leave a comment there it's not really relevant to the code flow. I will add a TODO to re-evaluate caching in where we set up controllers.
knyar
left a comment
There was a problem hiding this comment.
While I reviewed the code, I am not familiar with IngressClass and can't evaluate whether this is the best way to address the issue. I am happy to learn more about this and form an opinion if you'd like some feedback on the overall approach.
| Name: tailscaleIngressClassName, | ||
| }, | ||
| } | ||
| if err := a.Get(ctx, client.ObjectKeyFromObject(ic), ic); apierrors.IsNotFound(err) { |
There was a problem hiding this comment.
Should this be a code comment to make sure folks reading this code have more context? It's going to be more visible than a comment on the PR.
Signed-off-by: Irbe Krumina <[email protected]> Co-authored-by: Anton Tolchanov <[email protected]>
|
I see this is more than just adding the k8s resource, as it has code changes. Looks good, as it will give flexibility in the future. Happy to test this if you want. |
Hi @freimer thanks, we always value extra tests and feedback. Did you also run into an issue with this on EKS/with AWS load balancer? |
|
I'm the reporting customer ;-) |
I didn't realise that. Thanks for reporting the issue! |
…ing if class not found. (tailscale#10823) * cmd/k8s-operator/deploy: deploy a Tailscale IngressClass resource. Some Ingress validating webhooks reject Ingresses with .spec.ingressClassName for which there is no matching IngressClass. Additionally, validate that the expected IngressClass is present, when parsing a tailscale `Ingress`. We currently do not utilize the IngressClass, however we might in the future at which point we might start requiring that the right class for this controller instance actually exists. Updates tailscale#10820 Signed-off-by: Irbe Krumina <[email protected]> Co-authored-by: Anton Tolchanov <[email protected]>
…ing if class not found. (tailscale#10823) * cmd/k8s-operator/deploy: deploy a Tailscale IngressClass resource. Some Ingress validating webhooks reject Ingresses with .spec.ingressClassName for which there is no matching IngressClass. Additionally, validate that the expected IngressClass is present, when parsing a tailscale `Ingress`. We currently do not utilize the IngressClass, however we might in the future at which point we might start requiring that the right class for this controller instance actually exists. Updates tailscale#10820 Signed-off-by: Irbe Krumina <[email protected]> Co-authored-by: Anton Tolchanov <[email protected]>
See #10820 for detailed context.
This PR adds a 'tailscale'
IngressClassresource to Tailscale operator manifests (helm chart and static) to prevent strict webhooks rejecting user's TailscaleIngressresources.It also adds a simple validation that runs at the time when an
Ingressresource would be reconciled and prints a warning either if 'tailscale'IngressClassresource is not found or if the controller name does not match our controller.This is with the thinking that in future we might actually want to utilize this
IngressClassresource:IngressI am not certain we will need
IngressClassfor the above reasons, but also this is a no-op for users who install with our manifests.Next steps:
IngressClasscannot be modified (we do not support changing controller name or specifying a class with a different name)Notes
IngressClasswill need to delete it to upgrade to this versionIngressresource does not get rejected by AWS load balancer's validating webhook (see the original issue description)