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

feature: add service port spec for eventlistener #1272

Merged
merged 1 commit into from
Feb 8, 2022

Conversation

waveywaves
Copy link
Member

@waveywaves waveywaves commented Nov 25, 2021

Changes

add the ability to specify the service port for a eventlistener
service. the TLS port will default to 443 instead of 8443 in
the case where the service port is set.
this has been done to circumvent the logic of 8443 only being set
when the default port is set with TLS enabled.

fixes #1270

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

Release Notes

- API changes
  Added ServicePort specification to kubernetesResource to allow users to modify on which port their eventListener service is exposed on (defaults to 8080).

@tekton-robot tekton-robot added release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 25, 2021
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/eventlistener/resources/service.go 100.0% 93.3% -6.7

@waveywaves
Copy link
Member Author

#1270

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/eventlistener/resources/service.go 100.0% 93.3% -6.7

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/eventlistener/resources/service.go 100.0% 93.3% -6.7

@waveywaves
Copy link
Member Author

/test pull-tekton-triggers-go-coverage

Comment on lines 106 to 109
// We return port 8443 if TLS is enabled and the default HTTP port is set.
// This effectively makes 8443 the default HTTPS port unless a user explicitly sets a different port.
servicePortPort = 8443
} else {
// Return port 443 if TLS is enabled and the HTTP port is not the default one.
// This will allow traffic to be directed to the default HTTPS port.
servicePortPort = 443
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@waveywaves How about to remove

if *c.Port == DefaultPort {

and just override servicePortPort to 8443 instead of confusing with 8443 and 443

WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

Could you explain why we need 443 as the default TLS port?

Copy link
Member Author

Choose a reason for hiding this comment

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

After giving it some thought I realized that this may not be a great solution to the TLS port issue. Allowing port override should allow the user to configure the port as 443 if they want to. Having it as a default port is not a great idea fosho.

docs/eventlisteners.md Show resolved Hide resolved
go.sum Outdated Show resolved Hide resolved
pkg/apis/triggers/v1beta1/event_listener_types.go Outdated Show resolved Hide resolved
Comment on lines 106 to 109
// We return port 8443 if TLS is enabled and the default HTTP port is set.
// This effectively makes 8443 the default HTTPS port unless a user explicitly sets a different port.
servicePortPort = 8443
} else {
// Return port 443 if TLS is enabled and the HTTP port is not the default one.
// This will allow traffic to be directed to the default HTTPS port.
servicePortPort = 443
}
Copy link
Member

Choose a reason for hiding this comment

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

Could you explain why we need 443 as the default TLS port?

@waveywaves
Copy link
Member Author

waveywaves commented Dec 10, 2021

Could you explain why we need 443 as the default TLS port?

After giving it some thought I realized that this may not be a great solution to the TLS port issue. Allowing port override should allow the user to configure the port as 443 if they want to. Having it as a default port is not a great idea fosho.

@waveywaves waveywaves force-pushed the eventlistener/service-port branch 10 times, most recently from 054abf5 to cbd349f Compare December 10, 2021 10:34
@khrm khrm added this to the Triggers v0.19 milestone Jan 12, 2022
@dibyom
Copy link
Member

dibyom commented Jan 12, 2022

@waveywaves as I mentioned in the WG today, we might want to look into passing the servicePort into the EventListenerStatus.SetAddress func so that the status.address.URL that is set on the EL contains the right port.

UPDATE: It looks like it might already do the right thing - calls to SetAddress uses resources.ListenerHostname which relies on the ServicePort function that contains the changes.

@waveywaves
Copy link
Member Author

@waveywaves as I mentioned in the WG today, we might want to look into passing the servicePort into the EventListenerStatus.SetAddress func so that the status.address.URL that is set on the EL contains the right port.

UPDATE: It looks like it might already do the right thing - calls to SetAddress uses resources.ListenerHostname which relies on the ServicePort function that contains the changes.

@dibyom In that case, are there any other changes you think I should make ?

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom

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:

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

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 19, 2022
Copy link
Contributor

@savitaashture savitaashture left a comment

Choose a reason for hiding this comment

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

/lgtm 🎉

@dibyom
Copy link
Member

dibyom commented Feb 4, 2022

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 4, 2022
@dibyom
Copy link
Member

dibyom commented Feb 7, 2022

@waveywaves Please run hack/update-codegen.sh to generate updated api docs

@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Feb 8, 2022
add the ability to specify the service port for a eventlistener
service. Default TLS Port 8443 is not set when service port is
specified by the user.

Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
@waveywaves
Copy link
Member Author

waveywaves commented Feb 8, 2022

@dibyom I just updated this. Do take a look. Thanks for the ping.

@dibyom
Copy link
Member

dibyom commented Feb 8, 2022

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 8, 2022
@tekton-robot tekton-robot merged commit a55e2f3 into tektoncd:main Feb 8, 2022
@khrm khrm added the kind/feature Categorizes issue or PR as related to a new feature. label Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature: add spec to specify EventListener service port 🚪
5 participants