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

expose to the cluster services pointed by Ingress #221

Merged
merged 4 commits into from
Jun 1, 2023

Conversation

zivnevo
Copy link
Member

@zivnevo zivnevo commented May 24, 2023

Fixes #212

In this PR:

  • Scanning Ingress resources and marking the services they point to as ExposeToCluster=true
  • resourceFinder no longer stores Route resources, nor will it store Ingress resources. Instead, it just stores in a dedicated data structure all the services it will have to expose later on. When scanning a Route resource or an Ingress resource, this data structure gets updated with the Services mentioned in the scanned resource.
  • Using generics to avoid having a new parse function for every new resource we consider

@zivnevo zivnevo requested a review from adisos May 24, 2023 13:40
Copy link
Contributor

@adisos adisos left a comment

Choose a reason for hiding this comment

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

looks good!
added one question.


exposedServicesInNamespace, ok := servicesToExpose[routeObj.Namespace]
if !ok {
servicesToExpose[routeObj.Namespace] = map[string]bool{}
Copy link
Contributor

Choose a reason for hiding this comment

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

does it handle Ingress/Route resources without a namespace?

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe it does. For such resources Namespace field is "", which is a valid key in the map.
Thus, it will only expose listed services which also do not have Namespace.
The BookInfo example has such an Ingress resource, and a corresponding Service. It seems to be exposed properly.

@zivnevo zivnevo merged commit 69363fc into main Jun 1, 2023
6 checks passed
@zivnevo zivnevo deleted the handle_ingress_resource branch June 1, 2023 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Open ingress for services exposed by Ingress resource
2 participants