-
Notifications
You must be signed in to change notification settings - Fork 202
Refactor Enricher Workflow to allow direct generation of OpenShift objects #678
Comments
We faced some issued with enricher calling the // Create default resources
void create(Visitable builderVisitable, PlatformMode mode);
// Enrich with extra information
void enrich(Visitable builderVisitable, PlatformMode mode); or so. The alternative (probably much better) is to wait for immutable model objects in the kubernetes-model. |
Just a note. This can create backward compatibility issues, because people usually put some env settings (eg. cpu and mem limits) in the |
Please note that this is only a temporary solution as it let ResourceMojo directly reference hardcoded the VolumePermissionEnricher. This is necessary as the enricher have no knowledge whether they are enriching for OpenShift of Kubernetes when called. If fabric8io#678 is tackled this will be resolved and the hack in ResourceMojo which references VolumePermissionEnricher.ENRICHER_NAME must be removed. Fixes fabric8io#790
@nicolaferraro agree that we should still some 'internal' conversions for resource fragments which we are used for both variations and which we already convert on the fly into each other
|
Yeah, this may be a (active-by-default) option. |
PR merged! Thanks!
This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions! |
Closed via #1521 |
Description
The current way to support both, Kubernetes and OpenShift is, that we first create all K8s objects for
kubernetes.yml
and the convert them all in one step to corresponding OpenShift object foropenshift.yml
.Although it worked quite well until now, this approach has now reached its limitations so that a pure 1:1 mapping is not easily possible and lead to ugly constructs and code coupling. (e.g. the creation of OpenShift specific objects for the app-catalog by the dependency enricher, which are then directly extracted by the ResourceMojo. Its a good example how leaky our abstraction became).
The suggested solution is to use a two-pass model, to create the OpenShift and Kubernetes individually by running the Enricher chain twice, with an argument
PlatformMode
for specifying which objects are to be created. That adds gives more flexibility and avoids the brute-force all in once conversion at the end.Also, the enricher API can be simplified to two methods:
The enrichment process then would work like:
Also, for special use case like creating the app-catalog it might make sense to call the chain separately instead of relying that fabric8:resource runs before fabric8:app-catalog and doing checks in the ResourceMojo whether it runs together with other Mojos to create different descriptors (with the same file name !).
The text was updated successfully, but these errors were encountered: