You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to formalize and clearly define the mechanism and rules used when overriding parts of the content of the parent devfile, or parts of the content of a plugin component.
That mainly means that overrides are just fragments using the same syntax as the elements to override.
Overriding rules are easy for simple object fields: A simple field that didn't exist will be added, and a simple field that already existed will be replaced with the value of the new one.
This become less straightforward for lists. Here strategic merge patch allows defining a merge strategy on lists, that will drive the way lists are overridden, as mentioned by the already-mentioned document:
To solve this problem, Strategic Merge Patch uses the go struct tag of the API objects to determine what lists should be merged and which ones should not.
To summarize the overriding behavior for list mainly depends on the patchStrategy and the patchMergeKey json tags on the corresponding GO structures.
In the devfile case, most of the lists, such as container env variables, would be managed with a mergepatchStrategyand lists would be merged based on a defined key (patchMergeKey would be name in the case of environment variables).
Actions to be done
We should be add the appropriate patchMerge json tags on all the lists in the Go sources of the model.
We should implement a common logic to implement the overriding, available for at least all GO-based tools that will manage devfiles.
The text was updated successfully, but these errors were encountered:
Main concept
We need to formalize and clearly define the mechanism and rules used when overriding parts of the content of the parent devfile, or parts of the content of a plugin component.
The main idea is to use kustomize-like syntax, and so use strategic merge patch mechanism, as described in this document: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-api-machinery/strategic-merge-patch.md#background
That mainly means that overrides are just fragments using the same syntax as the elements to override.
Overriding rules are easy for simple object fields: A simple field that didn't exist will be added, and a simple field that already existed will be replaced with the value of the new one.
This become less straightforward for lists. Here strategic merge patch allows defining a merge strategy on lists, that will drive the way lists are overridden, as mentioned by the already-mentioned document:
To summarize the overriding behavior for list mainly depends on the
patchStrategy
and thepatchMergeKey
json tags on the corresponding GO structures.In the devfile case, most of the lists, such as container env variables, would be managed with a
merge
patchStrategy
and lists would be merged based on a defined key (patchMergeKey
would bename
in the case of environment variables).Actions to be done
patchMerge
json tags on all the lists in the Go sources of the model.The text was updated successfully, but these errors were encountered: