-
Notifications
You must be signed in to change notification settings - Fork 350
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): resource option refactoring #2355
Conversation
* Provide support for configmap, secret or local file * Refactoring the structure of mount points to distinguish clearly between config and resource options Ref apache#2003
Adding backward compatibility and a deprecation notice. Ref apache#2003
Adding the possibility to specify the destination path for any resource Ref apache#2003
Won't accept any resource/config file larger than 1MB, due to the limitation on K8S CustomResources Ref apache#2003
* Added support to specify a single key from a configmap/secret in --resource or --config flag * Refactoring the RunConfigOption struct to include the new feature and hide the complexity to usage Ref apache#2003
Good work @squakez ! |
|
||
for _, entry := range entries { | ||
if entry.Type == configurationType { | ||
var item = make(map[string]string) |
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.
Probably you could have used the entry struct type instead of map, but it's ok
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.
Looks good, should we merge it?
Thanks for reviewing! Yes, you can proceed, I am already working on the documentation. |
I let @astefanutti do it since he said he was having a look.. |
Let me do a quick round of review 👍🏼. |
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.
Please find below a couple of points. These may rather be questions or comments, that can possibly be addressed subsequently:
-
I find it a bit hard to reason about the API, we have:
resources: compression content contentKey contentRef contentType mountPath name path rawContent type
and:
configuration: resourceKey resourceMountPoint resourceType type value
Do you think this could be improved, e.g., use more consistent name (
mountPath
vsresourceMountPoint
), limit possible values with+kubebuilder:validation:Enum
, add documentation, ... -
For the option value, the format is
[configmap|secret|file]:resourceName[/key]
: I would findpath
instead ofresourceName
a bit more coherent between ConfigMap/Secret and file, mentioning that the path can bename/key
for the former. Also, I wonder, should it be documented that the ConfigMap / Secret is implicitly located in the current namespace? -
Could the
--property
option be merged with the--config
option, to be symmetrical with the--resource
option? -
Should the documentation be updated according to the new CLI options: https://camel.apache.org/camel-k/latest/configuration/configmap-secret.html?
-
For the Integration container layout, I understand that the directories prefixed with
_
are application configuration resources, and that this is inherited from the runtime, right? Should we mirror that layout for plain resources? I find adding that extradata
directory not adding much meaning.
Yeah, I had this part in mind as a refactoring tracked in #2320. If you're okey with the approach, we can review your comment as part of that development that I'm planning to do right after #2003 is closed.
I see your point. I found difficult to show the syntax in the CLI as file won't have
I think they have a different meaning. The
Worry not, another PR is ready with examples and full documentation... I did not want to have this PR larger than it is now!
So, this would be the final tree expected on the
The |
8b3298c
to
bb94003
Compare
Great, sounds good. The sooner the better to avoid dealing with backward compatibility.
I cannot think of a one-size-fits-all solution, but the following may be other ways:
Ah right. The
👍🏼
Actually, I would rather get rid of the For |
@astefanutti I've just committed 20b770c to include a clearer option description and to use a single |
@squakez great, thanks. Let's merge it! |
With this PR we are refactoring the original
--resource
flag to behave similarly of what we've done with--config
.kamel run --resource [configmap|secret|file]:resourceName[/key][@/path/to/destination]
We are also refactoring the
--config
flag to include the possiblity to specify/key
when using asecret
/configmap
.The difference is that the
--resource
will allow the user to provide any kind of file (also binary files) and those files won't be considered as properties file by theIntegration
runtime.Configmap
s andSecret
s--resource /path/to/file
(though, it is marked as deprecated for future removal)@/path/
to let the user chose where the resource (file, secret or configmaps) will be mountedsecret
/configmap
key both in--resource
and--configmap
CRD
s to specify resources type (config
orresource
), resource key selection and destination pathCloses #2003
Closes #1831
Closes #1534
Closes #1533
Release Note