-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
spec: add extras
for adding additional info in result.
#749
spec: add extras
for adding additional info in result.
#749
Conversation
a6ba0bb
to
4b5cc5a
Compare
This will be helpful in CNI DEL for cleaning something like iptable rules/chains ..., but I'm worrying about whether this is a break change in SPEC, which means libcni and plugins both will need a version upgrade. |
It's an optional field, so I think it should keep the backward compatibility, although the plugins which introduced this field MUST create a new version for it, I think, since it's not easy to check whether a struct has one field in golang. TBH, I have no idea about this part, maybe those plugins could check the field existence by reflect? Any suggestions? Besides, the word |
SPEC.md
Outdated
@@ -160,7 +160,7 @@ Network configuration in JSON format must be streamed to the plugin through stdi | |||
|
|||
Note that IPAM plugins should return an abbreviated `Result` structure as described in [IP Allocation](#ip-allocation). | |||
|
|||
Plugins must indicate success with a return code of zero and the following JSON printed to stdout in the case of the ADD command. The `ips` and `dns` items should be the same output as was returned by the IPAM plugin (see [IP Allocation](#ip-allocation) for details) except that the plugin should fill in the `interface` indexes appropriately, which are missing from IPAM plugin output since IPAM plugins should be unaware of interfaces. | |||
Plugins must indicate success with a return code of zero and the following JSON printed to stdout in the case of the ADD command. The `ips`, `dns` and `capabilityArgs` items should be the same output as was returned by the IPAM plugin (see [IP Allocation](#ip-allocation) for details) except that the plugin should fill in the `interface` indexes appropriately, which are missing from IPAM plugin output since IPAM plugins should be unaware of interfaces. |
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 found it surprising that capabilityArgs
would come specifically from the IPAM plugin. Is the background to this described somewhere?
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.
TBH, I'm not sure about this, I just see this comment. Personally, I'd prefer Args
. The original intention about adding this optional args is that I want to consume the extra args returned by IPAM plugin result, for now, it doesn't support carry extra args.
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 don't see where either of your links mention IPAM.
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.
So what's your suggestion? How about make this field not specifically to ipam plugin? I think this field is also useful for those chained plugins.
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.
Yes, I cannot see any reason to make this specific to IPAM, so I would change the wording so it doesn't say that.
I too would prefer Maybe |
Signed-off-by: colstuwjx <colstuwjx@gmail.com>
4b5cc5a
to
68c93d0
Compare
… suggestions. Signed-off-by: colstuwjx <colstuwjx@gmail.com>
I have been changed the wording according to @bboreham 's suggestion, personally, I choosed BTW, currently, CNI DEL carries the ADD operation result within prevResult, I wonder whether it is guaranteed. If it did NOT, we may lost the plugin extra results. |
capabilityArgs
for adding additional info in result.extras
for adding additional info in result.
Any updates? |
@Colstuwjx we discussed at length in the maintainers meeting today. What you've done in the spec looks fine, however I think we should dig a little further into what the libcni code will do. Three cases come to mind:
Case 1 just needs the And we should have tests for all of this. |
I couldn't find the If the downstream plugin called the IPAM, it would be sth like:
the downstream plugin could extract The And for the last case, I don't think it's reasonable, we just cache the result while ADD, and it maybe NOT guaranteed, if we suggest this way, plugin developers may abuse this feature. I suggest each plugin should handle DELETE by an idempotent way rather than relying on the cached result, the spec also talked about this part. |
That line in the SPEC tells you to look in CONVENTIONS.md to find out more about capabilities. |
@Colstuwjx The suggestion here is to ensure that any Proposal:
Justification for this approach rather than something similar is to strongly encourage plugins to declare the data they wish to exchange with runtimes and other plugins via CONVENTIONS.md and not have it be a random dumping ground for data. |
Okay, it would be better for reading if we add link to that @dcbw , the
I agree with you, but the fact is, some CNI plugins, for example, IPAM plugins, need to pass such extra execution result inside the I'd like to close this PR, since we didn't make a conclusion about this. |
This PR is going to fix #582 .
It was above 4 months since we proposed a solution for adding additional information inside result struct, therefore, I'd like to give a try, propose this PR for pushing this feature online.
Feel free to reject this PR if we have another idea about how to fix this issue.
Thanks.