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

Fix #304 - Operator driven service discovery API #283

Merged
merged 5 commits into from
Nov 15, 2023

Conversation

wmedvede
Copy link
Contributor

@wmedvede wmedvede commented Oct 17, 2023

Description of the change:

Motivation for the change:

Checklist

  • Add or Modify a unit test for your change
  • Have you verified that tall the tests are passing?
How to backport a pull request to a different branch?

In order to automatically create a backporting pull request please add one or more labels having the following format backport-<branch-name>, where <branch-name> is the name of the branch where the pull request must be backported to (e.g., backport-7.67.x to backport the original PR to the 7.67.x branch).

NOTE: backporting is an action aiming to move a change (usually a commit) from a branch (usually the main one) to another one, which is generally referring to a still maintained release branch. Keeping it simple: it is about to move a specific change or a set of them from one branch to another.

Once the original pull request is successfully merged, the automated action will create one backporting pull request per each label (with the previous format) that has been added.

If something goes wrong, the author will be notified and at this point a manual backporting is needed.

NOTE: this automated backporting is triggered whenever a pull request on main branch is labeled or closed, but both conditions must be satisfied to get the new PR created.

Copy link
Member

@ricardozanini ricardozanini left a comment

Choose a reason for hiding this comment

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

I like this initial (big) step. Therefore, can we please have one package? It's uncommon in golang to have that many packages for this implementation. Especially in the scope of api package. This is a convention for the CRD types, might be confusing to introduce this here.

What I recommend is to create one single controllers/discovery package and in there, we create our files with meaningful prefixes such as parser_types.go. Also, we can implement it by adopting lowercase letters in the func/types and exposing just the discovery engine like: discovery.NewHandler(workflow).Do(). Just an example.

The other modules/packages don't care about unexposed data structures that we need to do the discovery.

@wmedvede
Copy link
Contributor Author

I like this initial (big) step. Therefore, can we please have one package? It's uncommon in golang to have that many packages for this implementation. Especially in the scope of api package. This is a convention for the CRD types, might be confusing to introduce this here.

What I recommend is to create one single controllers/discovery package and in there, we create our files with meaningful prefixes such as parser_types.go. Also, we can implement it by adopting lowercase letters in the func/types and exposing just the discovery engine like: discovery.NewHandler(workflow).Do(). Just an example.

The other modules/packages don't care about unexposed data structures that we need to do the discovery.

Good suggestions, I'll apply all. Many thanks Ricardo.

Copy link
Member

@ricardozanini ricardozanini left a comment

Choose a reason for hiding this comment

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

Great work! I really like it! Just a few points if you don't mind. I will refrain from adding more since it's a draft yet. 😅

controllers/discovery/discovery.go Outdated Show resolved Hide resolved
controllers/discovery/queries.go Outdated Show resolved Hide resolved
controllers/discovery/port_utils.go Outdated Show resolved Hide resolved
controllers/discovery/port_utils.go Outdated Show resolved Hide resolved
controllers/discovery/port_utils.go Outdated Show resolved Hide resolved
controllers/discovery/queries.go Outdated Show resolved Hide resolved
controllers/discovery/uri_parser.go Show resolved Hide resolved
controllers/discovery/uri_utils.go Outdated Show resolved Hide resolved
controllers/discovery/uri_utils.go Outdated Show resolved Hide resolved
controllers/discovery/kubernetes_catalog.go Outdated Show resolved Hide resolved
@wmedvede wmedvede force-pushed the KOGITO-9867 branch 3 times, most recently from 1033e1a to 6476298 Compare November 2, 2023 17:16
@wmedvede wmedvede marked this pull request as ready for review November 10, 2023 14:25
@wmedvede
Copy link
Contributor Author

@ricardozanini Service discovery was integrated according to the microprofile catalog properties strategy and working for kubernetes services and pods. The other kubernetes objects I think we can add in a separate PR.
I'll take a look at the builder image in the mean time to incorporate the kogito-addons-quarkus-microprofile-config-service-catalog

@ricardozanini
Copy link
Member

@wmedvede

The other kubernetes objects I think we can add in a separate PR

Do we have an issue for this one?

@wmedvede
Copy link
Contributor Author

wmedvede commented Nov 10, 2023

@wmedvede

The other kubernetes objects I think we can add in a separate PR

Do we have an issue for this one?

No. but can I open, the only are the commit comments reffering to KOGITO-9867...., IDK, if you don't mind loosing the history of your review I can open a new PR and use an issue, otherwise I can open an issue and at least link it to this PR.

All good now, kie-issue was linked accordingly

@wmedvede
Copy link
Contributor Author

wmedvede commented Nov 10, 2023

Closes #304

@wmedvede wmedvede changed the title KOGITO-9867: Operator driven service discovery API [SonataFlow Operator] Operator driven service discovery API Nov 10, 2023
@wmedvede wmedvede requested a review from krisv November 10, 2023 16:40
@ricardozanini ricardozanini changed the title [SonataFlow Operator] Operator driven service discovery API Fix #304 - Operator driven service discovery API Nov 10, 2023
@ricardozanini ricardozanini linked an issue Nov 10, 2023 that may be closed by this pull request
Copy link
Contributor

@tchughesiv tchughesiv left a comment

Choose a reason for hiding this comment

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

a couple nits, otherwise lgtm

utils/kubernetes/deployment.go Show resolved Hide resolved
utils/kubernetes/service.go Show resolved Hide resolved
Copy link
Contributor

@domhanak domhanak left a comment

Choose a reason for hiding this comment

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

@wmedvede looks good but I really miss unit tests for all the different discovery functions. There are numerous branches in each, for example we have uri_parser_test.go Could we also do this for other parts?

    - Code review suggestions 1, simplify the original packages into the discovery package
    - Integrate the service discovery API
    - Code review suggestions 3, tests added
@wmedvede
Copy link
Contributor Author

@wmedvede looks good but I really miss unit tests for all the different discovery functions. There are numerous branches in each, for example we have uri_parser_test.go Could we also do this for other parts?

tests where added, this is good enough for now.

@wmedvede wmedvede merged commit 8b25b99 into apache:main Nov 15, 2023
4 checks passed
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.

Operator driven service discovery API
4 participants