Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Refactor ResourceMojo to get rid of GeneratorContext #1528

Open
rohanKanojia opened this issue Feb 25, 2019 · 0 comments
Open

Refactor ResourceMojo to get rid of GeneratorContext #1528

rohanKanojia opened this issue Feb 25, 2019 · 0 comments
Labels
group/enricher Enricher related status/never-stale Pin this issue to get never marked as stale by stale-bot target/JKube Implementation to be performed in JKube

Comments

@rohanKanojia
Copy link
Member

Right now we're referencing Generators during resource generation in ResourceMojo here:

private List<ImageConfiguration> getResolvedImages(List<ImageConfiguration> images, final Logger log)
throws MojoExecutionException {
List<ImageConfiguration> ret;
ret = ConfigHelper.resolveImages(
log,
images,
(ImageConfiguration image) -> imageConfigResolver.resolve(image, project, session),
null, // no filter on image name yet (TODO: Maybe add this, too ?)
(List<ImageConfiguration> configs) -> {
try {
GeneratorContext ctx = new GeneratorContext.Builder()
.config(extractGeneratorConfig())
.project(project)
.logger(log)
.platformMode(mode)
.strategy(buildStrategy)
.useProjectClasspath(useProjectClasspath)
.build();
return GeneratorManager.generate(configs, ctx, true);
} catch (Exception e) {
throw new IllegalArgumentException("Cannot extract generator: " + e, e);
}
});
Date now = getBuildReferenceDate();
storeReferenceDateInPluginContext(now);
String minimalApiVersion = ConfigHelper.initAndValidate(ret, null /* no minimal api version */,
new ImageNameFormatter(project, now), log);
return ret;

We need ImageConfiguration in order to extract image names and container ports while making pod template. Ideally ResourceMojo should not be aware of ImageConfiguration which should be referenced in BuildMojo. We should find a way to get of of Generators here. Maybe we can make this configuration option for enrichers, too(or think about other solutions). This for sure is less harming than blending in generators here.

@rohanKanojia rohanKanojia added status/never-stale Pin this issue to get never marked as stale by stale-bot target/4.0 PR for targeted to 4.0.x group/enricher Enricher related and removed target/4.0 PR for targeted to 4.0.x labels Feb 25, 2019
@manusa manusa added the target/JKube Implementation to be performed in JKube label May 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
group/enricher Enricher related status/never-stale Pin this issue to get never marked as stale by stale-bot target/JKube Implementation to be performed in JKube
Projects
None yet
Development

No branches or pull requests

2 participants