Skip to content

Added ssl-ports validation in case unused ports are introduced in the aws-load-balancer-ssl-ports annotation #3067

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

Merged
merged 1 commit into from
Mar 20, 2023

Conversation

ahrakos
Copy link
Contributor

@ahrakos ahrakos commented Feb 18, 2023

Issue

Issue Link

fixes #2931

Description

  • Added tests infrastructure for the buildListenerConfig function
  • Tested two cases -
    • A case where all ports provided in the aws-load-balancer-ssl-ports annotation exists in the spec.Ports section
    • A case where part of the ports provided in the aws-load-balancer-ssl-ports annotation do not exist in spec.Ports section
  • Added a validation function, which takes the array of ports provided in the annotation, and array of ports which is provided in the service's spec, and returns the list of unused ports, and an error if there are unused ports.
  • Called the validation function from the buildTLSPortsSet function, and threw the error back in the hierarchy

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the docs directory)
  • [] Manually tested
  • Made sure the title of the PR is a good description that can go into the release notes

BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯

  • [] Backfilled missing tests for code in same general area 🎉
  • Refactored something and made the world a better place 🌟

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 18, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: ahrakos (da86d8363e38143cb32e346a1e2cfbc1c7d1cdea)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Feb 18, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @ahrakos!

It looks like this is your first PR to kubernetes-sigs/aws-load-balancer-controller 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/aws-load-balancer-controller has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @ahrakos. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Feb 18, 2023
@ahrakos
Copy link
Contributor Author

ahrakos commented Feb 18, 2023

/assign

@ahrakos ahrakos removed their assignment Feb 19, 2023
@k8s-ci-robot
Copy link
Contributor

@ahrakos: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/ok-to-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@codecov-commenter
Copy link

Codecov Report

Base: 54.32% // Head: 54.40% // Increases project coverage by +0.07% 🎉

Coverage data is based on head (da86d83) compared to base (e1fb94a).
Patch coverage: 91.66% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3067      +/-   ##
==========================================
+ Coverage   54.32%   54.40%   +0.07%     
==========================================
  Files         145      145              
  Lines        8410     8429      +19     
==========================================
+ Hits         4569     4586      +17     
- Misses       3511     3512       +1     
- Partials      330      331       +1     
Impacted Files Coverage Δ
pkg/service/model_build_listener.go 90.90% <91.66%> (-0.30%) ⬇️

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.

@johngmyers
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 22, 2023
@kishorj
Copy link
Collaborator

kishorj commented Feb 23, 2023

You also need to modify the e2e tests since we now validate the ssl-ports.

@ahrakos ahrakos force-pushed the ssl-ports-validation branch 5 times, most recently from 80e05c6 to ed0ca12 Compare February 25, 2023 19:07
@ahrakos
Copy link
Contributor Author

ahrakos commented Feb 25, 2023

@kishorj
Can you finally approve?
I managed to fix the e2e tests :)

@kishorj kishorj added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Feb 28, 2023
Copy link
Collaborator

@kishorj kishorj left a comment

Choose a reason for hiding this comment

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

I have some nit comments, changes look good otherwise.

@@ -115,10 +119,43 @@ func (t *defaultModelBuildTask) buildListenerCertificates(_ context.Context) []e
return certificates
}

func (t *defaultModelBuildTask) buildTLSPortsSet(_ context.Context) sets.String {
func validateTLSPortsSet(rawTLSPorts []string, ports []corev1.ServicePort) ([]string, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

since the return value is not used, lets just return error from this function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@ahrakos ahrakos force-pushed the ssl-ports-validation branch from ed0ca12 to a739661 Compare February 28, 2023 20:37
@ahrakos ahrakos requested review from kishorj and removed request for johngmyers February 28, 2023 20:38
@kishorj
Copy link
Collaborator

kishorj commented Mar 10, 2023

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 10, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahrakos, kishorj

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 10, 2023
@kishorj kishorj removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 11, 2023
@ahrakos ahrakos force-pushed the ssl-ports-validation branch from a739661 to b275e44 Compare March 11, 2023 08:54
@ahrakos
Copy link
Contributor Author

ahrakos commented Mar 11, 2023

/lgtm

@k8s-ci-robot
Copy link
Contributor

@ahrakos: you cannot LGTM your own PR.

In response to this:

/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@kishorj
Copy link
Collaborator

kishorj commented Mar 20, 2023

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 20, 2023
@k8s-ci-robot k8s-ci-robot merged commit a6c9352 into kubernetes-sigs:main Mar 20, 2023
johngmyers pushed a commit to johngmyers/aws-load-balancer-controller that referenced this pull request Aug 21, 2023
johngmyers added a commit to johngmyers/aws-load-balancer-controller that referenced this pull request Aug 21, 2023
Merge in DEL/aws-load-balancer-controller-fork from update-from-upstream to main

* commit '9bbcc80fd4e701018636af4147b27d69e4f128d3':
  update ko to v0.13.0 (kubernetes-sigs#3115)
  update module dependencies (kubernetes-sigs#3114)
  added validation for dummy ports introduced in the aws-load-balancer-ssl-ports annotation (kubernetes-sigs#3067)
  docs: add a new page about security groups management (kubernetes-sigs#2988)
  Add InboundCIDRs field to IngressClassParams (kubernetes-sigs#3089)
  Add SSLPolicy field to IngressClassParams (kubernetes-sigs#3025)
  enable EndpointsFailOpen by default (kubernetes-sigs#3078)
Timothy-Dougherty pushed a commit to adammw/aws-load-balancer-controller that referenced this pull request Nov 9, 2023
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Controller silently ignores SSL ports that it isn't actually listening on
5 participants