-
Notifications
You must be signed in to change notification settings - Fork 541
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 (jkube-kit/enricher) : GitEnricher should implement enrich
instead of create
#2562
fix (jkube-kit/enricher) : GitEnricher should implement enrich
instead of create
#2562
Conversation
Eclipse JKube CI ReportStarted new GH workflow run for #2562 (2024-01-16T16:08:46Z) ⚙️ JKube E2E Tests (7544208007)
|
07d7021
to
902bf95
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #2562 +/- ##
=============================================
+ Coverage 59.36% 70.00% +10.64%
- Complexity 4586 4911 +325
=============================================
Files 500 474 -26
Lines 21211 19152 -2059
Branches 2830 2480 -350
=============================================
+ Hits 12591 13407 +816
+ Misses 7370 4529 -2841
+ Partials 1250 1216 -34 ☔ View full report in Codecov by Sentry. |
…ead of `create` GitEnricher should be executed in `enrich` phase so that it's invoked during OpenShift build. Signed-off-by: Rohan Kumar <rohaan@redhat.com>
902bf95
to
cf65355
Compare
|
arguments(new ServiceBuilder().withNewMetadata().endMetadata().build()), | ||
arguments(new DeploymentBuilder().withNewMetadata().endMetadata().build()), | ||
arguments(new DeploymentConfigBuilder().withNewMetadata().endMetadata().build()), | ||
arguments(new ReplicaSetBuilder().withNewMetadata().endMetadata().build()), | ||
arguments(new ReplicationControllerBuilder().withNewMetadata().endMetadata().build()), | ||
arguments(new DaemonSetBuilder().withNewMetadata().endMetadata().build()), | ||
arguments(new StatefulSetBuilder().withNewMetadata().endMetadata().build()), | ||
arguments(new JobBuilder().withNewMetadata().endMetadata().build()), | ||
arguments(new SecretBuilder().withNewMetadata().endMetadata().build()), | ||
arguments(new ImageStreamBuilder().withNewMetadata().endMetadata().build()), | ||
arguments(new BuildConfigBuilder().withNewMetadata().endMetadata().build()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that due to the changes in GitEnricher, now you need to create the ObjectMetaBuilder entry.
I'm not sure that everytime the resources reach the enricher they will contain an ObjectMetaBuilder instance.
Are you sure about this? (consider also fragments and other corner cases)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not so sure. I checked with a fragment without metadata but I noticed we always seem to initialize metadata while reading fragment into HasMetadata
:
https://github.com/eclipse/jkube/blob/e101e93ed4bfad99ce9549d85aa968225326839e/jkube-kit/enricher/api/src/main/java/org/eclipse/jkube/kit/enricher/api/util/KubernetesResourceFragments.java#L138-L139
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using ObjectMetadataBuilder
also adds git labels in .metadata
of Pod Template, not sure whether we want to have git annotations there.
We have PodAnnotationEnricher for copying annotations from controller metadata to Pod template metadata
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of resources generated via opinionated defaults, I checked various handlers in org.eclipse.jkube.kit.enricher.handler
package and they all seem to be generating a non null ObjectMeta always:
https://github.com/eclipse/jkube/blob/e101e93ed4bfad99ce9549d85aa968225326839e/jkube-kit/enricher/api/src/main/java/org/eclipse/jkube/kit/enricher/handler/DeploymentHandler.java#L42
Once resources go through enricher's create
phase, jkube-metadata
is the first enricher in enrich
phase where various visitors try to create metadata if it doesn't exist:
https://github.com/eclipse/jkube/blob/e101e93ed4bfad99ce9549d85aa968225326839e/jkube-kit/enricher/api/src/main/java/org/eclipse/jkube/kit/enricher/api/visitor/MetadataVisitor.java#L134
Description
Related to #2500
GitEnricher should be executed in
enrich
phase so that it's invoked during OpenShift build.enrich
fromcreate
method@BeforeEach
BuildConfig
,ImageStream
,Secret
resources to parameterized method sourceType of change
test, version modification, documentation, etc.)
Checklist