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

Provide a Service Port Name #379

Merged
merged 2 commits into from
Aug 23, 2023
Merged

Conversation

maysunfaisal
Copy link
Member

What does this PR do?:

Provides a Service Port name if there is more than one Service Port. The API says Name is mandatory is there is more than 1.

Which issue(s)/story(ies) does this PR fixes:

https://issues.redhat.com/browse/RHTAPBUGS-433

PR acceptance criteria:

  • Unit/Functional tests

  • Documentation

  • Client Impact

How to test changes / Special notes to the reviewer:

Create a Component, SEB, Snapshot, Environment. Ensure the Gitops Repo service.yaml has two service ports and both of them have names. Apply it in your OpenShift project and access the route.

Example of the Gitops Repo for providing Service Port Name https://github.com/maysunfaisal/application-sample-lK5Sb-borrow-place/blob/main/components/component-sample/base/service.yaml#L13-L20

Signed-off-by: Maysun J Faisal <[email protected]>
// because name is required if there is more than one port
portName := strconv.Itoa(int(port.Port))
if portNameMap[portName] {
portName = fmt.Sprintf("%s-%s", portName, util.GetRandomString(4, true))
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering what is the purpose of having multiple service ports with different names but same port number? I know it's not blocked by kube api, but it's just exposing the same port to be accessible, isn't it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question.. I was having the exact same questions when i was writing this 😆
but I was thinking, we cant control what ppl name their ports, if someone is bring in a service with port 8080 and naming it "1234", we cant do anything about it.

However, if they enter 1234 as port on RHTAP HAC, then we cant use "1234" as name anymore. This is more for avoiding name clashes. Any other better suggestions?

Copy link
Contributor

Choose a reason for hiding this comment

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

makes sense.

@maysunfaisal
Copy link
Member Author

/retest

@codecov
Copy link

codecov bot commented Aug 17, 2023

Codecov Report

Patch coverage: 84.86% and project coverage change: -0.70% ⚠️

Comparison is base (1afd7ae) 84.61% compared to head (1a49512) 83.92%.
Report is 84 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #379      +/-   ##
==========================================
- Coverage   84.61%   83.92%   -0.70%     
==========================================
  Files          27       31       +4     
  Lines        3530     4248     +718     
==========================================
+ Hits         2987     3565     +578     
- Misses        402      516     +114     
- Partials      141      167      +26     
Files Changed Coverage Δ
pkg/devfile/errors.go 100.00% <ø> (ø)
cdq-analysis/pkg/devfile.go 68.30% <68.30%> (ø)
cdq-analysis/pkg/componentdetectionquery.go 69.28% <69.28%> (ø)
controllers/componentdetectionquery_controller.go 74.51% <71.42%> (+3.97%) ⬆️
pkg/github/token_mock.go 75.67% <75.67%> (-24.33%) ⬇️
controllers/application_controller.go 78.46% <76.81%> (-3.07%) ⬇️
controllers/component_controller.go 73.15% <79.48%> (-4.45%) ⬇️
cdq-analysis/pkg/detect.go 73.38% <79.54%> (ø)
pkg/github/token.go 87.74% <84.95%> (-7.65%) ⬇️
controllers/application_controller_conditions.go 89.39% <87.87%> (-10.61%) ⬇️
... and 17 more

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@yangcao77 yangcao77 left a comment

Choose a reason for hiding this comment

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

generally looks good to me, just a small question as commented.

@openshift-ci
Copy link

openshift-ci bot commented Aug 22, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: maysunfaisal, yangcao77

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [maysunfaisal,yangcao77]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@maysunfaisal maysunfaisal merged commit 1f9eb46 into redhat-appstudio:main Aug 23, 2023
6 of 7 checks passed
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.

2 participants