-
Notifications
You must be signed in to change notification settings - Fork 345
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
feat(cmd/run): autogenerated configmap for resource/config local files #2771
Conversation
ab478a6
to
0cd7322
Compare
I'm not deep into the code at the moment to do a review but I'm +1 on the goal. |
No problem, more than the code, the goal of the draft PR is to discuss about the feature. About bumping API version, I actually don't know which would be the recommended procedures to follow. |
0cd7322
to
3b2ba13
Compare
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.
A couple of points:
- Would the ultimate place to reference these ConfigMaps be in a new configuration trait, as discussed in [Trait] Configuration refactoring #2320, maybe as a second iteration to this?
- Should the operator watch these owned ConfigMaps for changes, and reconcile the parent Integration?
- If yes, as a sub-case, the Integration phase could be set to
Error
if a referenced ConfigMap got deleted by mistake. - It relates to Automatically redeploy on config change #1235 and Runtime reload configmap/secret when they change #2106 possibly
- If yes, as a sub-case, the Integration phase could be set to
- Are the generated ConfigMaps really immutable?
- Would that make sense to go the same direction for the
SourceSpec
field?
For the versioning, I think that it'd be acceptable to apply the current strategy, that is marking the field(s) as deprecated, let the users do the migration, and have the fields removed in later releases. Versioning CRDs is quite involved, and we would possibly have to implement a conversion Webhook, which comes at an extra operational cost. |
Thanks for the review @astefanutti, those are very good points to discuss.
That is partially correct. The idea is to move configmap/secret managment there as soon as this part would be completed. So, once autogenerated, the configmaps will be managed as any user provided configmap into the
I don't think this would apply to autogenerated configmaps. In my view, these kind of configmaps are just a support to the local file content. I've worked to support
They must be, IMO. The name is generated from a SHA based on the file content and nobody should alter them as they are thought as a representation of the local file.
Not sure if it makes sense. I think that the |
7ad87a9
to
e436589
Compare
Old review, more commit have been done since then.
c760a04
to
51a6ac9
Compare
Reduce code duplication
With this new field we know if a Config option is used as a resource or a configuration to be parsed
These new parameters will manage the config/resource volume mounts
That is my background too. My question was more, why does the
I'm trying to reason first from the end-user standpoint. The CLI hides it, still it's part of the API. I remember we had the discussion in #2635, and I was wondering whether that was the right moment to find a more "functionally oriented" trait to capture this concern, and disentangle the container trait. |
If I understood correctly, the question is about generated Configmap difference with user provided Configmap. The only difference is about the lifecycle of the Configmap itself, as my idea is to have it living together and exclusively within the Integration lifecycle. This is mimicking the previous behavior, when a Configmap was generated beside the Integration. The difference is that the resource is not directly stored in the Integration and the Configmap is generated by the CLI (as it must access the file content). Another possibility would be to autogenerate the Configmap but let the lifecycle (update/delete) up to the user. However, I think it completely overlaps what we already provide with the normal configmap, just saving the manual step to create the configmap from the file resource. Hope it answer your question, I'm not entirely sure we're talking about the same thing here :)
I made some test and with this implementation, the generated Configmap is kept until the Integration is living. We can provide an additional loop to reconcile the generated Configmap not needed right after the binding step. Or we can keep it the way it is, if we consider the pattern to create an Integration with a file and later update the same integration without a file as a rare one. I don't have a strong opinion on this part.
The idea to move the volumes logic into a separate trait could be interesting. However, we need to attach those volumes into the |
I think we are talking about the same thing :) But that is general description, that I still fail to reconcile with the actual implementation :) Maybe this could be cleared if you could help me understand:
I'm trying to understand if the consistency of the Integration configuration being created is still satisfied, meaning if user A create an integration with a local file resource, user B should still be able to operate the Integration. I hope that makes sense :)
What I'm trying to determine here, aren't we about to duplicate the garbage collection that we already have for resources generated by the operator. I get the particularity of the "local file" use case, but would there be a way to make it fit into the existing garbage collection mechanism.
Yes, that is also my understanding of the technical details. I'm trying to reason at the functional level, from the end-user standpoint. |
Ah, this is a mistake. I copied the description from the run command. In the trait we cannot have a
Originally I used the file name as a configmap name. But that leads to 2 problems:
Using an hash solves both problems.
Yes, reason why I'd keep the generated content until the Integration lives.
Definitely, the usage of |
7efedc3
to
78e62f4
Compare
I've finished another iteration of development in order to address the points discussed previously. With d85257c we're now validating the input submitted to the trait: we won't allow anything but I prefer this name to a generic The last outstanding point is about garbage collecting the autogenerated configmaps that are used and later removed. Right now they will live beside the Integration, until this one is deleted. I cannot figure out how to manage differently and let them be garbage collected as soon as they are updated (unless we do a manual clean). IMO we can keep them along. @astefanutti please, have a further look and let me know what do you think. |
It sounds and looks great to me 👍🏼.
What I'm thinking is a process like this:
|
Very clever suggestion @astefanutti. I like how it looks like now. Please see 1b405ee which has captured the changes you proposed. Both |
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.
Thanks! I've left a couple of final comments, and it'll be good to go 👍🏼.
1b405ee
to
f1ab95f
Compare
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.
Great!
81e74da
to
f58eef2
Compare
f58eef2
to
4fce0f4
Compare
fe55ec4
to
3dcd440
Compare
d831144
to
2537dbd
Compare
@astefanutti any last look before I can merge? |
@squakez LGTM 👍🏼 Great work! |
With this PR the CLI will take care to parse a file, autogenerate to a
Configmap
and bind it to theIntegration
as it would be any other configmap. The resource will be owned by the Integration, so, deleted as soon as the Integration will be deleted. We also watch for resource file change to allow--sync
option and regenerate the configmap upon a file change detection.With this approach we can still keep the possibility for the user to provide a file and at the same time we can remove the need to include the resource content in the
Integration
. We can extend it to the--openapi
and deprecate theResourceSpec
.Integration.Configuration
in favor of related traits--openapi
to create an autogeneratedconfigmap
- relates Let user configure configmaps/secrets forkamel run --openapi
option #2772Integration.Resources
in favor of the new logicmount
traitCloses #2320
Closes #2772
Release Note