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

fix: use port name when port number is not provided in combined routes #3313

Merged
merged 1 commit into from
Jan 3, 2023

Conversation

pmalek
Copy link
Member

@pmalek pmalek commented Jan 3, 2023

What this PR does / why we need it:

Part of #3296

When user provides only service port name and not the number e.g.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    konghq.com/strip-path: "true"
    kubernetes.io/ingress.class: kong
  name: nginx-ingress
spec:
  rules:
  - http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: nginx
            port:
              name: http

and CombinedRoutes feature flag is used the translation logic incorrectly used port number which wasn't specified. This PR fixes it.

Which issue this PR fixes:

Special notes for your reviewer:

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR

@pmalek pmalek self-assigned this Jan 3, 2023
@pmalek pmalek force-pushed the fix-combined-routes-service-port-by-name branch from 66239f8 to 02a3848 Compare January 3, 2023 14:14
@codecov
Copy link

codecov bot commented Jan 3, 2023

Codecov Report

Base: 74.0% // Head: 74.0% // Increases project coverage by +0.0% 🎉

Coverage data is based on head (2eba44a) compared to base (fd4b1f6).
Patch coverage: 100.0% of modified lines in pull request are covered.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #3313   +/-   ##
=====================================
  Coverage   74.0%   74.0%           
=====================================
  Files        111     111           
  Lines      13290   13285    -5     
=====================================
- Hits        9841    9839    -2     
+ Misses      2820    2818    -2     
+ Partials     629     628    -1     
Impacted Files Coverage Δ
internal/dataplane/parser/translate_ingress.go 92.3% <100.0%> (+0.1%) ⬆️
internal/dataplane/parser/translate_knative.go 88.5% <100.0%> (ø)
internal/dataplane/parser/translators/ingress.go 92.2% <100.0%> (-0.3%) ⬇️
internal/dataplane/parser/translators/portdef.go 76.9% <100.0%> (ø)
...nternal/controllers/gateway/udproute_controller.go 73.6% <0.0%> (-2.8%) ⬇️
internal/dataplane/kongstate/service.go 66.0% <0.0%> (-1.3%) ⬇️
internal/dataplane/parser/parser.go 90.7% <0.0%> (+1.0%) ⬆️
...nternal/controllers/gateway/tcproute_controller.go 75.6% <0.0%> (+2.6%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@pmalek pmalek force-pushed the fix-combined-routes-service-port-by-name branch 3 times, most recently from 2759184 to e680984 Compare January 3, 2023 16:30
@pmalek pmalek marked this pull request as ready for review January 3, 2023 17:02
@pmalek pmalek requested a review from a team as a code owner January 3, 2023 17:02
@pmalek pmalek force-pushed the fix-combined-routes-service-port-by-name branch from e680984 to 2eba44a Compare January 3, 2023 18:13
@pmalek pmalek added this to the KIC v2.8.1 milestone Jan 3, 2023
Copy link
Contributor

@rainest rainest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per conversation earlier, while consistently using a number for the port component of the name would be nice, we don't readily have access to it here, as we only have the Ingress available in ingressRulesFromIngressV1(), not the Service. Absent ready access to the resolved port, it's probably not worth going and getting it just for cosmetic reasons, so this will go ahead and use the name.

@rainest rainest merged commit 4d64571 into main Jan 3, 2023
@rainest rainest deleted the fix-combined-routes-service-port-by-name branch January 3, 2023 22:58
@pmalek pmalek linked an issue Jan 4, 2023 that may be closed by this pull request
1 task
@pmalek pmalek added the fix label Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port name seems not supported with CombinedRoutes
2 participants