-
Notifications
You must be signed in to change notification settings - Fork 586
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
Discussion: How to add CLI meta data to Source CRDs ? #1940
Comments
An issue I see with this is that I don't think all CLIs will be able to be able to dynamically add flags for each |
Yes, but they alway could ;-). This meta-data is helpful for CLI authors if they want to support dynamic cli options, based on the CR at hand. This is supported by any language, but it could be that your favourite options parsing library doesn't support this. However, you can still do the CLI options parsing manually, this is not a principal limitation for a client. |
Following the lines of the discussion starting at #1550 (comment) and the fact that we won't see support for arbitrary We introduce in the Source Schema Spec the support of an annotation annotations:
client.knative.dev/options: |
[
{
"name" : "access-token",
"path" : ".spec.accessToken.secretRef",
"help" : "GitHub access token. The value of this option is the name of a secret and key within secret to GitHub access, dot separated (e.g. --access-token=mygithubsecret.mykey)"
"type" : "secret-reference"
},
{
"name" : "event-type",
"path" : ".spec.eventTypes",
"help" : "GitHub event type. This option can be given multiple times for registering multiple event types"
},
....
] |
@adamharwayne if this sounds ok, I would add this to the "Kn eventing" proposal, too. |
This is great idea to make CLI easier to use. |
We should also add this to the Source Spec after it lands, I don't want to hold off on that before merging, but once it lands on the spec, we can close this? |
I'd like to get the Source Spec changes in for v0.10.0-M2 and finish the CRDs to support this with little more leeway, if we can get everything done for 10-M2, awesome :) |
YEAH!!! WOOO with the Manual CRD via Discovery API. |
This issue is stale because it has been open for 90 days with no |
/remove-lifecycle stale |
This issue is stale because it has been open for 90 days with no |
Let's close this as it seems to going into the direction to leverage the Discovery API to hold those CLI related meta-data, so let's continue as part of the conversation how to integrate this meta-data into the Source type |
Problem
For helping
kn
(or any other CLI) it would be very helpful when a Source CRD would carry some extra meta information for mapping cli-options (like--access-token
or--event-types
for a GitHubSource) to the property within the CR (e.g..spec.accessToken.secreteKeyRef
for--access-token
and.spect.eventTypes
for--event-types
).Fortunately, OpenAPI schema supports so-called Specification Extensions in a Schema Object. These are fields starting with a
x-
So ideally a
GitHubSource
CRD could look like in the example below (where I picked up the existing GitHub source, and added the required meta information to the properties which are supposed to be mapped. I also moved the registry types away from the schema to annotations, but that's not important here)GitHub Source with `x-cli-` annotations
Unfortunately, Kubernetes does not support this (see kubernetes/kubernetes#82942 and also the API docs for CRDs where it seems only a fixed set of
x-kubernetes-
fields are supported😞
The question is how to proceed:
example
: "A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary."externalDocs
: An object withdescription
andurl
fieldAn solution would be also to put the mapping into CRD annotations with the cli-option as key and the JSON path expression as value (or having a single annotation which has a JSON mapping as value), e.g
Tbh, I would prefer a hook into the schema as it feels that it belongs to the schema as an 'annotation' kind.
What do you think about the proposal or is there any other way to help the client to create CRs from flat command line options ?
The text was updated successfully, but these errors were encountered: