Skip to content

Commit

Permalink
Differentiate application for debug
Browse files Browse the repository at this point in the history
Co-Authored-By: sindrerh2 <sindre.rodseth.hansen@nav.no>
Co-Authored-By: Youssef Bel Mekki <38552193+ybelMekk@users.noreply.github.com>
  • Loading branch information
3 people committed Nov 7, 2024
1 parent c9a91cb commit 0509307
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions pkg/resourcecreator/ingress/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,21 +181,22 @@ func nginxIngresses(source Source, cfg Config) ([]*networkingv1.Ingress, error)

if redirects != nil && len(redirects) > 0 {
for _, redirect := range redirects {
parsedUrl, err := parseIngress(string(redirect.To))
parsedRedirectUrl, err := parseIngress(string(redirect.To))
if err != nil {
return nil, err
}
for _, ing := range ingresses {
for _, rule := range ing.Spec.Rules {
// found the ingress that matches the redirect
if rule.Host == parsedUrl.Host {
r := ingressRule(source.GetName(), parsedUrl)
if rule.Host == parsedRedirectUrl.Host {
r := ingressRule(source.GetName(), parsedRedirectUrl)
ingressClass := util.ResolveIngressClass(rule.Host, cfg.GetGatewayMappings())
rdIngresses, err := getIngress(source, cfg, r, ingressClass, string(redirect.From))
rdIngress, err := getIngress(source, cfg, r, ingressClass, string(redirect.From))
if err != nil {
return nil, err
}
redirectIngresses[*ingressClass] = rdIngresses
rdIngress.Name = "foo"
redirectIngresses[*ingressClass] = rdIngress
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/resourcecreator/testdata/ingress_redirect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ input:
kind: Application
apiVersion: nais.io/v1alpha1
metadata:
name: myapplication
name: myapplicationredirect
namespace: mynamespace
uid: "123456"
spec:
Expand Down Expand Up @@ -45,7 +45,7 @@ tests:
paths:
- backend:
service:
name: myapplication
name: myapplicationredirect
port:
number: 80
path: /
Expand Down Expand Up @@ -76,7 +76,7 @@ tests:
- operation: CreateOrUpdate
apiVersion: networking.k8s.io/v1
kind: Ingress
name: myapplication-nais-ingress-941e7d93-THIS-ONE-FAILS-ON-PURPOSE-SHOULD-BE-THE-REDIRECT-INGRESS
name: foo
match:
- type: subset
name: "redirect ingress for myapp"
Expand Down

0 comments on commit 0509307

Please sign in to comment.