Skip to content
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

K8S ingress rule fails to match Exact / #10631

Open
saffih opened this issue Nov 8, 2023 · 4 comments
Open

K8S ingress rule fails to match Exact / #10631

saffih opened this issue Nov 8, 2023 · 4 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@saffih
Copy link

saffih commented Nov 8, 2023

Using Pattern to catch Exact /:
│app.kubernetes.io/name: rke2-ingress-nginx │app.kubernetes.io/version: 1.6.4 │helm.sh/chart: rke2-ingress-nginx-4.5.201
Having an ingress with:
│ rules:
│ - http:
│ paths:
│ - backend:
│ service:
│ name: powerflex-status-ui
│ port:
│ number: 80
│ path: /
│ pathType: Exact
When calling:
curl -k -H 'Cache-Control: no-cache, no-store' -I ​https://100.68.80.54/
HTTP/2 404
It should have returned 200 - it fails to match a single /
It worked with an older version. We have a workaround, adding $ to the expression.

WORKAROUND: That one seems identical but it works - getting http 200 by using: Exact /$
│ rules:
│ - http:
│ paths:
│ - backend:
│ service:
│ name: powerflex-status-ui
│ port:
│ number: 80
│ path: /$
│ pathType: Exact

** Expected 200 **:

The parsing with Exact is not good - a minor bug and we have a workaround by changing the expression:
/$
It should behave the same with \ vs. $

NGINX Ingress controller version (exec into the pod and run nginx-ingress-controller --version.):


NGINX Ingress controller
Release: nginx-1.6.4-hardened4
Build: git-90e1717ce
Repository: https://github.com/rancher/ingress-nginx.git
nginx version: nginx/1.21.4


Kubernetes version (use kubectl version):
1.26.4+rke2r1

Environment:

  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release):

NAME="SLES"
VERSION="15-SP4"
VERSION_ID="15.4"
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP4"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15:sp4"
DOCUMENTATION_URL="https://documentation.suse.com/"

  • Kernel (e.g. uname -a):
    Linux sn-451-vm51 5.14.21-150400.24.81-default Basic structure  #1 SMP PREEMPT_DYNAMIC Tue Aug 8 14:10:43 UTC 2023 (90a74a8) x86_64 x86_64 x86_64 GNU/Linux
  • Install tools:

    • Please mention how/where was the cluster created like kubeadm/kops/minikube/kind etc.
  • Basic cluster related info:

    • kubectl version

WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.4+rke2r1", GitCommit:"f89670c3aa4059d6999cb42e23ccb4f0b9a03979", GitTreeState:"clean", BuildDate:"2023-04-12T18:32:51Z", GoVersion:"go1.19.8 X:boringcrypto", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.4+rke2r1", GitCommit:"f89670c3aa4059d6999cb42e23ccb4f0b9a03979", GitTreeState:"clean", BuildDate:"2023-04-12T18:32:51Z", GoVersion:"go1.19.8 X:boringcrypto", Compiler:"gc", Platform:"linux/amd64"}

  • kubectl get nodes -o wide

NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
sn-451-vm51 Ready control-plane,etcd,master 30h v1.26.4+rke2r1 100.68.80.51 SUSE Linux Enterprise Server 15 SP4 5.14.21-150400.24.81-default containerd://1.6.19-k3s1
sn-451-vm52 Ready control-plane,etcd,master 30h v1.26.4+rke2r1 100.68.80.52 SUSE Linux Enterprise Server 15 SP4 5.14.21-150400.24.81-default containerd://1.6.19-k3s1
sn-451-vm53 Ready control-plane,etcd,master 30h v1.26.4+rke2r1 100.68.80.53 SUSE Linux Enterprise Server 15 SP4 5.14.21-150400.24.81-default containerd://1.6.19-k3s1

  • How was the ingress-nginx-controller installed:
    • If helm was used then please show output of helm ls -A | grep -i ingress

rke2-ingress-nginx kube-system 3 2023-11-07 12:28:40.371153914 +0000 UTC deployed rke2-ingress-nginx-4.5.201 1.6.4

/label rke2

@saffih saffih added the kind/bug Categorizes issue or PR as related to a bug. label Nov 8, 2023
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Nov 8, 2023
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@bmv126
Copy link

bmv126 commented Nov 8, 2023

Looks like same as #10618

@longwuyuan
Copy link
Contributor

@saffih is it possible for you to write a test step-by-step instruction that a reader can copy/paste from and reproduce on a minikube/kind cluster

Copy link

github-actions bot commented Dec 9, 2023

This is stale, but we won't close it automatically, just bare in mind the maintainers may be busy with other tasks and will reach your issue ASAP. If you have any question or request to prioritize this, please reach #ingress-nginx-dev on Kubernetes Slack.

@github-actions github-actions bot added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
Development

No branches or pull requests

4 participants