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

Refactor occlient and kclient by unifying them into one #4093

Closed
1 task
adisky opened this issue Oct 7, 2020 · 15 comments
Closed
1 task

Refactor occlient and kclient by unifying them into one #4093

adisky opened this issue Oct 7, 2020 · 15 comments
Assignees
Labels
area/refactoring Issues or PRs related to code refactoring estimated-size/S (5-10) Rough sizing for Epics. Less then one sprint of work for one person triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
Milestone

Comments

@adisky
Copy link
Contributor

adisky commented Oct 7, 2020

/kind code-refactoring

Acceptance Criteria

  • oc client and kclient should have the same interface and based on what odo encounters in the context, the client needs to be decided in the context.
  • Unify the occlient and kclient into one client called as kclient. Remove the duplications and do everything through kclient. Interfaces to be added later.
@girishramnani girishramnani added this to For consideration in Sprint 191 via automation Oct 7, 2020
@girishramnani
Copy link
Contributor

We need to primarily bring back the original 3 layered architecture that odo had -

  • cli packages
  • odo specific packages
  • cluster communication packages

Currently things are bleading into each other.

@girishramnani girishramnani added the triage/needs-information Indicates an issue needs more information in order to work on it. label Oct 7, 2020
@girishramnani girishramnani moved this from For consideration to To do in Sprint 191 Oct 8, 2020
@mik-dass
Copy link
Contributor

It might be good idea to merge the two clients into a single client which handles both openshift and kubenetes clusters. We already are using the kclient inside the occlient
https://github.com/openshift/odo/blob/49853dc69d4f45d2f54cd4bad80e601bd2b4e715/pkg/occlient/occlient.go#L200

This will help reduce duplicate code between the two clients. Also a single interface for both the clients might be tricky as certain resources like routes etc are not in the kclient.

@dharmit
Copy link
Member

dharmit commented Oct 12, 2020

It might be good idea to merge the two clients into a single client

I remember that we started kclient with the intention of being able to deprecate occlient at some point. So this has to be our end goal, IMO.

@mik-dass
Copy link
Contributor

I remember that we started kclient with the intention of being able to deprecate occlient at some point. So this has to be our end goal, IMO.

We will just remove the unnecessary functions when that deprecation happens from the new merged client. Also creation of routes instead of ingress does need a occlient currently and we need to support s2i for some time.

@metacosm
Copy link
Contributor

The two clients should be indeed be merged. It shouldn't matter to the client code which kind of cluster odo is connected to. I don't think that this can be done without first isolating how components / etc. are realized on the cluster from code calling it: i.e. code calling the client shouldn't need to know how a component is implemented on the cluster. More precisely, the client should expose something like GetComponent *Component and not GetDeployment *v1.Deployment.

@mik-dass
Copy link
Contributor

More precisely, the client should expose something like GetComponent *Component and not GetDeployment *v1.Deployment.

We were thinking of doing this on the odo specific packages. The current idea is to have interfaces for storage, URL etc and s2i/devfile will have their own implementations of those functions. The client won't have any idea about odo specific things.

@girishramnani girishramnani added this to the Post v2.0 milestone Oct 20, 2020
@girishramnani girishramnani added this to For consideration in Sprint 192 via automation Oct 27, 2020
@girishramnani girishramnani removed this from To do in Sprint 191 Oct 27, 2020
@girishramnani girishramnani moved this from For consideration to To do in Sprint 192 Oct 27, 2020
@mik-dass
Copy link
Contributor

mik-dass commented Oct 28, 2020

I have added a document regarding the refactor here https://docs.google.com/document/d/1izxse1fBKqWG1822zvSsZwZHTDj57nlxlZllLxpDfzI/edit?usp=sharing. @metacosm @kadel @girishramnani @adisky @dharmit Please have a look and share your feedback.

@metacosm
Copy link
Contributor

@mik-dass I've added some comments, please also see: #4057 (comment)

@girishramnani girishramnani removed this from To do in Sprint 192 Oct 29, 2020
@dharmit dharmit changed the title Refactor oc client and kclient Refactor occlient and kclient by unifying them into one Nov 11, 2020
@mik-dass mik-dass self-assigned this Nov 11, 2020
@dharmit dharmit added this to For Consideration in Sprint 193 via automation Nov 18, 2020
@dharmit dharmit moved this from For Consideration to To do in Sprint 193 Nov 18, 2020
@dharmit
Copy link
Member

dharmit commented Dec 4, 2020

@mik-dass can you move this into the issue description and check off the ones you have already got merged? Add a note to those that have a PR open. Just want to get an idea about its status before we consider it for the next sprint.

And, if all the resources have been taken care, feel free to close this!

@mik-dass
Copy link
Contributor

mik-dass commented Dec 4, 2020

Add a note to those that have a PR open. Just want to get an idea about its status before we consider it for the next sprint.

I have checked off the resources which are done.

Other tasks include clean up files, clean up interfaces like ExecClient to reduce import cycles and remove duplicate functions.

We need to finish this part and unify the two clients.

@dharmit
Copy link
Member

dharmit commented Dec 7, 2020

Other tasks include clean up files, clean up interfaces like ExecClient to reduce import cycles and remove duplicate functions.

We need to finish this part and unify the two clients.

So now we're supposed to make changes that we discussed in #4057? I remember you were working on url package to make it more interface-y. Are you planning to open a PR for it or have you abondoned that code?

For things in "odo service" and "odo catalog list services", I intend to address those via #4242.

@mik-dass
Copy link
Contributor

mik-dass commented Dec 7, 2020

So now we're supposed to make changes that we discussed in #4057?

Yes, the client related changes discussed in #4057.

I remember you were working on url package to make it more interface-y. Are you planning to open a PR for it or have you abandoned that code?

I need to clean it up as a part of #4115.

@dharmit
Copy link
Member

dharmit commented Mar 1, 2021

@kadel @mik-dass do you think this issue should be closed?

@mik-dass
Copy link
Contributor

mik-dass commented Mar 1, 2021

@kadel @mik-dass do you think this issue should be closed?

Yes, I think we can close this issue.

@dharmit dharmit closed this as completed Mar 2, 2021
Sprint 193 automation moved this from In progress to Done Mar 2, 2021
@rm3l rm3l added the area/refactoring Issues or PRs related to code refactoring label Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/refactoring Issues or PRs related to code refactoring estimated-size/S (5-10) Rough sizing for Epics. Less then one sprint of work for one person triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
Archived in project
Development

No branches or pull requests

7 participants