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

Add portNamePreffix Helm chart parameter #8458

Merged
merged 1 commit into from
May 10, 2022

Conversation

pauljamm
Copy link
Contributor

@pauljamm pauljamm commented Apr 11, 2022

Allow user to set custom preffix for TCP and UDP ports

What this PR does / why we need it:

Allow users to add custom preffix in Helm chart for TCP and UDP ports.

This is required as some clouds (e.g. Yandex Cloud) doesn't allow ports with names started with numbers.
E.g. for Yandex Cloud apllicable names are /[a-z][-a-z0-9]{1,61}[a-z0-9]/

This issue was mensioned here #6416
And there were a couple of tries to fix it with a head-on solution:
#7515
#7276

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation only

Which issue/s this PR fixes

fixes #6416

How Has This Been Tested?

Made sure the load balancer is provisioned successfully after installing the patched chart.
Tested on Yandex Managed Service for Kubernetes.
Also was added test Helm values, and ran e2e Helm tests.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Apr 11, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: pauljamm / name: Pavel Selivanov (8f4f546f460297fb54f4ae4389453a3a665db185)

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 11, 2022
@k8s-ci-robot
Copy link
Contributor

@pauljamm: This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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
Copy link
Contributor

Welcome @pauljamm!

It looks like this is your first PR to kubernetes/ingress-nginx 🎉. 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/ingress-nginx 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 @pauljamm. Thanks for your PR.

I'm waiting for a kubernetes 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. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 11, 2022
@k8s-ci-robot k8s-ci-robot added the area/helm Issues or PRs related to helm charts label Apr 11, 2022
@pauljamm pauljamm force-pushed the port-name-preffix branch from da403d1 to 8f4f546 Compare April 11, 2022 17:03
@k8s-ci-robot k8s-ci-robot added 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 Apr 11, 2022
@longwuyuan
Copy link
Contributor

longwuyuan commented Apr 11, 2022

Hi @pauljamm ,

Although this PR is targeted for Yandex Cloud users, do you know if the same functionality will work for non-Yandex provider clusters ?

@longwuyuan
Copy link
Contributor

@pauljamm, sorry for asking but which file & line number is mapping a "string" name to a tcp/port number, in this change.

@pauljamm
Copy link
Contributor Author

Hi @pauljamm ,

Although this PR is targeted for Yonder Cloud users, do you know if the same functionality will work for non-Yandex provider clusters ?

Hi @longwuyuan,

This PR just adds ability to specify preffix for loadbalancer service ports names. So it does not contain any changes that should be "supported" by other clouds or Kubernetes clusters. But anyway it's just a manipulation with a port name, which is supported by Kubernetes by itself.

@pauljamm
Copy link
Contributor Author

@pauljamm, sorry for asking but which file & line number is mapping a "string" name to a tcp/port number, in this change.

The origin of a port naming in the ingress Helm chart was
take a port number (key of the dict) from user values, eg

tcp: 9000: "default/test:8080"

and set it as port number in service and add port name in the form

<port-number>-tcp(or udp)

My patch adds additional preffix (if specified by user) to all tcp or udp port names, not changing the original logic of port-name mapping.

So eg here
https://github.com/kubernetes/ingress-nginx/pull/8458/files#diff-2f370c167e670927f2304f85fa3919febc2dcc6231d0c56c985b8784092fba53R134-R135

the first line adds a port name in the form

<preffix if specified>-<key of the dict from user values (see above)>-tcp(or udp)

@pauljamm pauljamm force-pushed the port-name-preffix branch from d4edac0 to 25e5224 Compare April 12, 2022 11:50
@longwuyuan
Copy link
Contributor

longwuyuan commented Apr 12, 2022

@pauljamm , I think its looking good, but please comment if you will write a test. Just to deploy on a kind cluster and use a name for a tcp port and another name for a udp port, and get a 200 response while using those names.

@pauljamm
Copy link
Contributor Author

@pauljamm , I think its looking good, but please comment if you will write a test. Just to deploy on a kind cluster and use a name for a tcp port and another name for a udp port, and get a 200 response while using those names.

@longwuyuan, I defenetly will, but could you provide some examples (or may be guide) of such tests for this repo?
I've found test values for Helm charts and added two new files (for deployment and for daemonset) with my parameter, but as I can see, this test only verifies that the values and templates using them are correct and chart can be deployed with them.

@pauljamm
Copy link
Contributor Author

@pauljamm , I think its looking good, but please comment if you will write a test. Just to deploy on a kind cluster and use a name for a tcp port and another name for a udp port, and get a 200 response while using those names.

@longwuyuan, I defenetly will, but could you provide some examples (or may be guide) of such tests for this repo? I've found test values for Helm charts and added two new files (for deployment and for daemonset) with my parameter, but as I can see, this test only verifies that the values and templates using them are correct and chart can be deployed with them.

@longwuyuan if you mean this kind of tests, it's already being tested under the similar conditions here. It's just another string preffix for service port name.

@longwuyuan
Copy link
Contributor

@rikatz
Copy link
Contributor

rikatz commented May 1, 2022

/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 May 1, 2022
@rikatz
Copy link
Contributor

rikatz commented May 1, 2022

/approve
/hold
Please just fix the comment, leave it a bit more descriptive on why the field is required, what's the usage case for that field.

@longwuyuan feel free to lgtm as soon as this is fixed!

Thank you all :)

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 1, 2022
@longwuyuan
Copy link
Contributor

Yeah, we should make progress but if there is no test that shows a TCP/UDP port getting named and then used in a working functional K8S object related to ingress-nginx-controller, then I prefer to hold until the test is available.

@longwuyuan
Copy link
Contributor

@pauljamm , hope you are doing great.
Any update would help make progress.
Are you going to show your test details in the PR or write a test in e2e suite here.

@pauljamm pauljamm force-pushed the port-name-preffix branch from 25e5224 to 804b876 Compare May 4, 2022 16:07
@pauljamm
Copy link
Contributor Author

pauljamm commented May 4, 2022

@longwuyuan sorry for not answering for a long time.

Just to be clear, this is the name of a port. See above - this is a port object

Ports: []corev1.ServicePort{

And this is the name of a service

Name: "dns-external-name-svc",

@pauljamm
Copy link
Contributor Author

pauljamm commented May 4, 2022

@longwuyuan sorry, but it's not clear for me, why should we create duplicated tests, which besides just tests built in basic Kubernetes functionality.

@longwuyuan
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 4, 2022
@pauljamm
Copy link
Contributor Author

pauljamm commented May 5, 2022

/assign @rikatz @ChiefAlexander @cpanato

Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

thanks for this PR
lgtm but can you bump the chart version?

@pauljamm pauljamm force-pushed the port-name-preffix branch from 804b876 to 1178e8d Compare May 5, 2022 17:19
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels May 5, 2022
Allow user to set custom preffix for TCP and UDP ports
@pauljamm pauljamm force-pushed the port-name-preffix branch from 1178e8d to 7b91cc4 Compare May 5, 2022 17:26
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 5, 2022
@pauljamm
Copy link
Contributor Author

pauljamm commented May 5, 2022

thanks for this PR lgtm but can you bump the chart version?

@cpanato
Thanks for the review.
Chart version bumped.

@pauljamm pauljamm requested a review from cpanato May 5, 2022 17:30
@rikatz
Copy link
Contributor

rikatz commented May 10, 2022

/lgtm
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 10, 2022
@rikatz
Copy link
Contributor

rikatz commented May 10, 2022

Thanks

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: longwuyuan, pauljamm, rikatz

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 merged commit 61fcca3 into kubernetes:main May 10, 2022
@pauljamm pauljamm deleted the port-name-preffix branch May 11, 2022 10:25
rchshld pushed a commit to joomcode/ingress-nginx that referenced this pull request May 19, 2023
Allow user to set custom preffix for TCP and UDP ports
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. area/helm Issues or PRs related to helm charts 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. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to set custom name for tcp/udp service
5 participants