Skip to content

Commit ce4b7a2

Browse files
authored
feat: Contour HTTPProxy health check support for issue # 22504 (#22596)
Signed-off-by: Greg Barasch <[email protected]>
1 parent 18a26d6 commit ce4b7a2

File tree

6 files changed

+122
-0
lines changed

6 files changed

+122
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-- Status reporting information detailed here
2+
-- https://projectcontour.io/docs/main/config/fundamentals/#status-reporting
3+
hs = {
4+
status = "Progressing",
5+
message = "Waiting for status",
6+
}
7+
8+
if obj.status ~= nil then
9+
if obj.status.currentStatus ~= nil then
10+
if obj.status.currentStatus == "valid" then
11+
hs.status = "Healthy"
12+
elseif obj.status.currentStatus == "invalid" then
13+
hs.status = "Degraded"
14+
end
15+
hs.message = obj.status.description
16+
end
17+
end
18+
19+
return hs
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
tests:
2+
- healthStatus:
3+
status: Healthy
4+
message: "Valid HTTPProxy"
5+
inputPath: testdata/healthy.yaml
6+
- healthStatus:
7+
status: Progressing
8+
message: 'Waiting for status'
9+
inputPath: testdata/progressing.yaml
10+
- healthStatus:
11+
status: Progressing
12+
message: 'Waiting for controller'
13+
inputPath: testdata/not_reconciled.yaml
14+
- healthStatus:
15+
status: Degraded
16+
message: 'At least one error present, see Errors for details'
17+
inputPath: testdata/degraded.yaml
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apiVersion: projectcontour.io/v1
2+
kind: HTTPProxy
3+
metadata:
4+
name: basic
5+
spec:
6+
virtualhost:
7+
fqdn: foo-basic.bar.com
8+
routes:
9+
- conditions:
10+
- prefix: /
11+
services:
12+
- name: s1
13+
port: 80
14+
status:
15+
conditions:
16+
- errors:
17+
- message: 'Spec.Routes unresolved service reference: service "default/s1" not found'
18+
reason: ServiceUnresolvedReference
19+
status: "True"
20+
type: ServiceError
21+
lastTransitionTime: "2025-04-07T10:00:00Z"
22+
message: 'At least one error present, see Errors for details'
23+
observedGeneration: 1
24+
reason: ErrorPresent
25+
status: "False"
26+
type: Valid
27+
currentStatus: invalid
28+
description: 'At least one error present, see Errors for details'
29+
loadBalancer:
30+
ingress:
31+
- hostname: abc-123.elb.us-east-1.amazonaws.com
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: projectcontour.io/v1
2+
kind: HTTPProxy
3+
metadata:
4+
name: basic
5+
spec:
6+
virtualhost:
7+
fqdn: foo-basic.bar.com
8+
routes:
9+
- conditions:
10+
- prefix: /
11+
services:
12+
- name: s1
13+
port: 80
14+
status:
15+
conditions:
16+
- type: Valid
17+
status: "True"
18+
observedGeneration: 1
19+
lastTransitionTime: "2025-04-07T10:00:00Z"
20+
reason: Valid
21+
message: Valid HTTPProxy
22+
currentStatus: valid
23+
description: Valid HTTPProxy
24+
loadBalancer:
25+
ingress:
26+
- hostname: www.example.com
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: projectcontour.io/v1
2+
kind: HTTPProxy
3+
metadata:
4+
name: basic
5+
spec:
6+
virtualhost:
7+
fqdn: foo-basic.bar.com
8+
routes:
9+
- conditions:
10+
- prefix: /
11+
services:
12+
- name: s1
13+
port: 80
14+
status:
15+
currentStatus: NotReconciled
16+
description: Waiting for controller
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: projectcontour.io/v1
2+
kind: HTTPProxy
3+
metadata:
4+
name: basic
5+
spec:
6+
virtualhost:
7+
fqdn: foo-basic.bar.com
8+
routes:
9+
- conditions:
10+
- prefix: /
11+
services:
12+
- name: s1
13+
port: 80

0 commit comments

Comments
 (0)