-
Notifications
You must be signed in to change notification settings - Fork 249
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
Proposal - Parameter references #477
Comments
Hi @dhiguero , thanks for the proposal, we already implemented this feature in KubeVela by using X-Definition, let me introduce briefly. When we using an application and want to ref the component name in the component, this field is automatically injected by the system. So, there's no need to declare it in the properties. In the ComponentDefinition, we can use
So in the application, we don't need to specify anything, it can be used like below:
The deployment rendered out will have the component name automatically. More information in the context that can be used: |
Hi @wonderflow, thanks for your answer. I switched from an Spec perspective to a Kubevela one, and found that using component dependencies with This is an example taken from the current documentation of Kubevela about how to reference one component from another. I leave a copy for reference here. Referencing MySQL from Worpress
The main issue I see with this approach is that it is Kubevela based, but it is not directly supported by the Spec. I think we should think about introducing the input/output section in the Application entity in OAM 4, which is currently not supported, and potentially compare it with other alternatives such as the one in this proposal. |
@dhiguero Yes, we can introduce that into the OAM spec. Let's go ahead for that. |
Hi all! Following the conversations from the last community call, this issue is a proposal to introduce a mechanism to be able to reference items of the application structure from the component parametrization section.
Motivation
Up to this point, setting parameters on an application requires the user to fill the collection of
key:value
pairs that will be applied when the actual application is being "instanciated" by the runtime. While this approach works from the point of view of a user for simple cases, it introduces a problem when trying to create tooling around the usage of applications. For example, consider use cases where users want to deploy several instances of the same application.To illustrate the current state and the proposed changes, consider a simple application with two components where "publicapi" requires a parameter to be able to connect to the "database" one. The current approach is to create a parameter and set that parameter manually as in the following example:
While this approach works for some use cases, it could be improved to improve the usability of the Application entity as describe in the following paragraphs.
Proposal
The proposal is to introduce a method by which a parameter can reference a value of the Application entity. Given the current spec, the initial proposal is to use special syntax to distinguish between referencing parameters and literal ones. Taken inspiration from the component parameter definition section, it could look like:
In this case, if a parameter starts with valueRef the runtime understands that this value needs to interpreted instead of being a literal one. To improve usability further, we could also propose other syntax such as the following one, where the name of the component is used to easily identify the target component.
Benefits
This proposal is an enabler of future improvements around OAM, its runtimes, and the tools around it. To highlight some of the main benefits:
What do you think?
The text was updated successfully, but these errors were encountered: