Skip to content

Commit a17bc49

Browse files
authored
support show ingress path in env (#4477)
Signed-off-by: Patrick Zhao <zhaoyu@koderover.com>
1 parent 5fcbb85 commit a17bc49

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

pkg/shared/kube/resource/ingress.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ type HostInfo struct {
3030
}
3131

3232
type Backend struct {
33+
Path string `json:"path"`
34+
PathType string `json:"path_type"`
3335
ServiceName string `json:"service_name"`
3436
ServicePort string `json:"service_port"`
3537
}

pkg/shared/kube/wrapper/ingress.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ func GetIngressHostInfo(ing *v1.Ingress) []resource.HostInfo {
6060

6161
for _, path := range rule.HTTP.Paths {
6262
backend := resource.Backend{
63+
Path: path.Path,
64+
PathType: string(*path.PathType),
6365
ServiceName: path.Backend.Service.Name,
6466
ServicePort: fmt.Sprintf("%d", path.Backend.Service.Port.Number),
6567
}
@@ -85,7 +87,14 @@ func (ing *ingress) HostInfo() []resource.HostInfo {
8587
}
8688

8789
for _, path := range rule.HTTP.Paths {
90+
pathType := ""
91+
if path.PathType != nil {
92+
pathType = string(*path.PathType)
93+
}
94+
8895
backend := resource.Backend{
96+
Path: path.Path,
97+
PathType: pathType,
8998
ServiceName: path.Backend.ServiceName,
9099
ServicePort: path.Backend.ServicePort.String(),
91100
}

0 commit comments

Comments
 (0)