apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: diff-host-rules
spec:
rules:
- host: "diff-host-diff-path-slash"
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: service-diff-host-slash
port:
number: 8080
- host: "diff-host-diff-path-slash-whoami"
http:
paths:
- path: /whoami
pathType: ImplementationSpecific
backend:
service:
name: service-diff-host-slash-whoami
port:
number: 8080
Feature: host rule test
An Ingress may define routing rules based on the request path and host. If the HTTP request path matches one of the paths in the Ingress objects, the traffic is routed to its backend service.
Scenarios
| Status | Progress |
|---|---|
|
Passed |
100.00% |
|
Failed |
0.00% |
(path / and host diff-host-diff-path-slash matches request / and host diff-host-diff-path-slash)
(path / and host diff-host-diff-path-slash matches request /whoami and host diff-host-diff-path-slash)
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: diff-host-rules
spec:
rules:
- host: "diff-host-diff-path-slash"
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: service-diff-host-slash
port:
number: 8080
- host: "diff-host-diff-path-slash-whoami"
http:
paths:
- path: /whoami
pathType: ImplementationSpecific
backend:
service:
name: service-diff-host-slash-whoami
port:
number: 8080
(path / and host diff-host-diff-path-slash matches request /whoami/a/b/c/d/e/f/g and host diff-host-diff-path-slash)
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: diff-host-rules
spec:
rules:
- host: "diff-host-diff-path-slash"
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: service-diff-host-slash
port:
number: 8080
- host: "diff-host-diff-path-slash-whoami"
http:
paths:
- path: /whoami
pathType: ImplementationSpecific
backend:
service:
name: service-diff-host-slash-whoami
port:
number: 8080
(path /whoami and diff-host-diff-path-slash-whoami dose not matches request / and host diff-host-diff-path-slash-whoami)
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: diff-host-rules
spec:
rules:
- host: "diff-host-diff-path-slash"
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: service-diff-host-slash
port:
number: 8080
- host: "diff-host-diff-path-slash-whoami"
http:
paths:
- path: /whoami
pathType: ImplementationSpecific
backend:
service:
name: service-diff-host-slash-whoami
port:
number: 8080
(path /whoami and diff-host-diff-path-slash-whoami matches request /whoami and host diff-host-diff-path-slash-whoami)
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: diff-host-rules
spec:
rules:
- host: "diff-host-diff-path-slash"
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: service-diff-host-slash
port:
number: 8080
- host: "diff-host-diff-path-slash-whoami"
http:
paths:
- path: /whoami
pathType: ImplementationSpecific
backend:
service:
name: service-diff-host-slash-whoami
port:
number: 8080
(path /whoami and diff-host-diff-path-slash-whoami matches request /whoami/a/b/c/d/e/f/g and host diff-host-diff-path-slash-whoami)
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: diff-host-rules
spec:
rules:
- host: "diff-host-diff-path-slash"
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: service-diff-host-slash
port:
number: 8080
- host: "diff-host-diff-path-slash-whoami"
http:
paths:
- path: /whoami
pathType: ImplementationSpecific
backend:
service:
name: service-diff-host-slash-whoami
port:
number: 8080