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

Added IngressClass objects support #117 #132

Closed
wants to merge 2 commits into from

Conversation

Varun1300211
Copy link

@Varun1300211 Varun1300211 commented Feb 13, 2024

What type of PR is this?
This pull request implements IngressClass support.

Add one of the following kinds:
/kind feature

What this PR does / why we need it:
It retrieves the default IngressClass based on its API group (networking.k8s.io) and a dedicated annotation (ingressclass.kubernetes.io/is-default-class).
If no explicit IngressClass is specified in the Ingress object or via annotation, the default class is used for resource processing.

Which issue(s) this PR fixes:

Fixes #117

Does this PR introduce a user-facing change?:


Please do let me know if it was done in the correct way.

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Feb 13, 2024
Copy link

linux-foundation-easycla bot commented Feb 13, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Varun1300211
Once this PR has been reviewed and has the lgtm label, please assign bowei for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Feb 13, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @Varun1300211!

It looks like this is your first PR to kubernetes-sigs/ingress2gateway 🎉. 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/ingress2gateway 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 k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 13, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @Varun1300211. 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 size/XL Denotes a PR that changes 500-999 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 13, 2024
@Varun1300211
Copy link
Author

/easycla

@LiorLieberman
Copy link
Member

/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 13, 2024
@LiorLieberman
Copy link
Member

Thanks @Varun1300211 !

I will probably look at it tomorrow. In the meantime, can you:

  1. add a release_note block in the PR description (it should be added by default every PR but looks like you deleted it)
  2. Retitle the PR to reflect exactly the change your are adding
  3. Why did you update go mod (probably you run go mod tidy)? I dont think thats needed so if you can revert it it will be awesome.

Thanks!
/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 13, 2024
@Varun1300211 Varun1300211 changed the title Related to issue #117 Added IngressClass objects support #117 Feb 13, 2024
@Varun1300211
Copy link
Author

Done all the changes requested by you @LiorLieberman, please let me know if anything else is required.

Copy link
Member

@levikobi levikobi left a comment

Choose a reason for hiding this comment

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

Thanks @Varun1300211 and welcome!
I left a few comments regarding some things that need to be taken into account.
If you have any questions or need any help feel free to let us know

pkg/i2gw/providers/common/utils.go Show resolved Hide resolved
pkg/i2gw/providers/common/utils.go Outdated Show resolved Hide resolved
pkg/i2gw/providers/common/utils.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 14, 2024
@k8s-ci-robot
Copy link
Contributor

@Varun1300211: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-ingress2gateway-verify 5b80862 link true /test pull-ingress2gateway-verify
pull-ingress2gateway-test 5b80862 link true /test pull-ingress2gateway-test

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@Varun1300211
Copy link
Author

Hi @levikobi, I made the changes suggested by you. Please take a look.

Copy link
Member

@levikobi levikobi left a comment

Choose a reason for hiding this comment

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

Thanks again @Varun1300211!
I think it may help you to try playing around with the tool for a bit and see the different options it provides. Afterwards maybe try to compile your version and see what changes/breaks.

This new addition needs to take into account different options the user may pass.

Comment on lines +65 to +72
switch extension {
case "yaml":
err = yaml.Unmarshal(data, ingressClasses)
case "json":
err = json.Unmarshal(data, ingressClasses)
default:
return nil, fmt.Errorf("unsupported file type: %s", extension)
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe I missed something but it seems like you're always sending an empty slice of data

Comment on lines +40 to +51
func init() {

config, err := rest.InClusterConfig()
if err != nil {
log.Fatal(errors.New("unable to create config"))
}

k8sClientset, err = kubernetes.NewForConfig(config)
if err != nil {
log.Fatal(err)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This init function will always try to create a k8s client, even if the user doesn't have a cluster and want to convert some local file.

You'll need to pass the user's choice of where he wants to read resources from (cluster or file) and the k8s client, which was initialized in the i2gw package.

@LiorLieberman
Copy link
Member

@Varun1300211 Just checking in, please let us know if you need any help with moving this forward

@LiorLieberman
Copy link
Member

@Varun1300211 a friendly ping, are you still planning to work on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/feature Categorizes issue or PR as related to a new feature. 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.

Add support for IngressClass objects
4 participants