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 JKubeServiceHub's BuildService election mechanism #253

Closed
rohanKanojia opened this issue Jun 22, 2020 · 1 comment · Fixed by #772
Closed

Refactor JKubeServiceHub's BuildService election mechanism #253

rohanKanojia opened this issue Jun 22, 2020 · 1 comment · Fixed by #772
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@rohanKanojia
Copy link
Member

Right now we have a really ugly way of selecting a particular BuildService
https://github.com/eclipse/jkube/blob/1c916f9e76566e8d2bc0721156742bd04bf5161a/jkube-kit/config/service/src/main/java/org/eclipse/jkube/kit/config/service/JKubeServiceHub.java#L100-L110

This approach is fine for now but as we plan to increase support for multiple builds(like JIB, Buildah, Podman etc). We need to refactor this and make it generic. We can probably implement it like we're doing in case of Generators:
https://github.com/eclipse/jkube/blob/1c916f9e76566e8d2bc0721156742bd04bf5161a/kubernetes-maven-plugin/plugin/src/main/java/org/eclipse/jkube/maven/plugin/generator/GeneratorManager.java#L52-L60

@manusa manusa added this to the 1.1.0 milestone Jun 22, 2020
@manusa manusa added the enhancement New feature or request label Jun 23, 2020
@manusa manusa modified the milestones: 1.1.0, 1.2.0 Jan 20, 2021
@manusa manusa modified the milestones: 1.2.0, 2.0.0, 1.3.0 Mar 26, 2021
@manusa manusa modified the milestones: 1.3.0, 1.4.0 May 5, 2021
@rohanKanojia rohanKanojia self-assigned this Jun 29, 2021
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Jun 30, 2021
…on mechanism

+ Use ServiceLoader to load all Build Services and pick up service
  which is applicable in current context. This requires BuildService
  implementations to have zero-arg constructors so I need to set the
  elements from setters instead.

+ Added isApplicable(), setJKubeServiceHub(), setLogger() methods in
  BuildService interface

Signed-off-by: Rohan Kumar <[email protected]>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Jun 30, 2021
…on mechanism

+ Use ServiceLoader to load all Build Services and pick up service
  which is applicable in current context. This requires BuildService
  implementations to have zero-arg constructors so I need to set the
  elements from setters instead.

+ Added isApplicable(), setJKubeServiceHub(), setLogger() methods in
  BuildService interface

Signed-off-by: Rohan Kumar <[email protected]>
@manusa
Copy link
Member

manusa commented Jun 30, 2021

I thought there was an extra-issue for this, but we probably just discussed this elsewhere because I can't find it.

In addition to the way BuildService implementations are discovered and instantiated, we need a way to automatically (in case the user doesn't provide a manual configuration jkube.build.strategy select a build service based on the environment where the plugin is run (maybe with a scoring system).

So, for openshift-maven-plugin, current assumption is to use s2i or in cluster Docker if specified as a build strategy. ✔️

However, for kubernetes-maven-plugin, if no strategy is selected, JKube should be smart enough to select the appropriate build strategy. e.g. try with Docker, fallback to jib

rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Jul 1, 2021
…on mechanism

+ Use ServiceLoader to load all Build Services and pick up service
  which is applicable in current context. This requires BuildService
  implementations to have zero-arg constructors so I need to set the
  elements from setters instead.

+ Added isApplicable(), setJKubeServiceHub(), methods in
  BuildService interface

Signed-off-by: Rohan Kumar <[email protected]>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Jul 1, 2021
…on mechanism

+ Use ServiceLoader to load all Build Services and pick up service
  which is applicable in current context. This requires BuildService
  implementations to have zero-arg constructors so I need to set the
  elements from setters instead.

+ Added isApplicable(), setJKubeServiceHub(), methods in
  BuildService interface

Signed-off-by: Rohan Kumar <[email protected]>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Jul 1, 2021
…on mechanism

+ Use ServiceLoader to load all Build Services and pick up service
  which is applicable in current context. This requires BuildService
  implementations to have zero-arg constructors so I need to set the
  elements from setters instead.

+ Added isApplicable(), setJKubeServiceHub(), methods in
  BuildService interface

Signed-off-by: Rohan Kumar <[email protected]>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Jul 1, 2021
…on mechanism

+ Use ServiceLoader to load all Build Services and pick up service
  which is applicable in current context. This requires BuildService
  implementations to have zero-arg constructors so I need to set the
  elements from setters instead.

+ Added isApplicable(), setJKubeServiceHub(), methods in
  BuildService interface

Signed-off-by: Rohan Kumar <[email protected]>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Jul 2, 2021
…on mechanism

+ Use ServiceLoader to load all Build Services and pick up service
  which is applicable in current context. This requires BuildService
  implementations to have zero-arg constructors so I need to set the
  elements from setters instead.

+ Added isApplicable(), setJKubeServiceHub(), methods in
  BuildService interface

Signed-off-by: Rohan Kumar <[email protected]>
@manusa manusa self-assigned this Jul 7, 2021
manusa pushed a commit to manusa/jkube that referenced this issue Jul 8, 2021
…on mechanism

+ Use ServiceLoader to load all Build Services and pick up service
  which is applicable in current context. This requires BuildService
  implementations to have zero-arg constructors so I need to set the
  elements from setters instead.

+ Added isApplicable(), setJKubeServiceHub(), methods in
  BuildService interface

Signed-off-by: Rohan Kumar <[email protected]>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Jul 8, 2021
…on mechanism

+ Use ServiceLoader to load all Build Services and pick up service
  which is applicable in current context. This requires BuildService
  implementations to have zero-arg constructors so I need to set the
  elements from setters instead.

+ Added isApplicable(), setJKubeServiceHub(), methods in
  BuildService interface

Signed-off-by: Rohan Kumar <[email protected]>
manusa pushed a commit that referenced this issue Jul 16, 2021
+ Use ServiceLoader to load all Build Services and pick up service
  which is applicable in current context. This requires BuildService
  implementations to have zero-arg constructors so I need to set the
  elements from setters instead.

+ Added isApplicable(), setJKubeServiceHub(), methods in
  BuildService interface

Signed-off-by: Rohan Kumar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment