-
Notifications
You must be signed in to change notification settings - Fork 244
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
Revised Proposal to param based operator service creation #4751
Revised Proposal to param based operator service creation #4751
Conversation
@kadel @dharmit The swagger.json that is present on the cluster is currently 15MBs when I tried. What would be the best approach to cache it? So I was thinking of fetching it parallely when a user does Once we have the swagger.json, we can either store it whole, or specifically store all the CRDs that are listed in I was thinking of storing the operator listing ( just the operator part of |
# Improved schema for operator backed services | ||
|
||
This proposal is about improving the experience for a user of the operator backed services. Currently a user doesn't know exaustively which fields are available in a CR as we depend on optional metadata present in CRDs, to improve this we are considering using the metadata available from the cluster about the CRDs. | ||
Getting that metadata from the cluster is challenging because a normal cluster user ( plain vanilla ) doesn't have access to that metadata so we are gonna follow a 3 tiered approach |
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.
What's the "plain vanilla" in this case? Is it normal user on vanilla k8s or non-admin user on any of k8s/ocp clusters?
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.
Both actually, a normal user or non admin user. From the metadata perspective both are same
This proposal is about improving the experience for a user of the operator backed services. Currently a user doesn't know exaustively which fields are available in a CR as we depend on optional metadata present in CRDs, to improve this we are considering using the metadata available from the cluster about the CRDs. | ||
Getting that metadata from the cluster is challenging because a normal cluster user ( plain vanilla ) doesn't have access to that metadata so we are gonna follow a 3 tiered approach | ||
|
||
- check if the user has access to the CRD, if so then use that. |
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.
In what scenario(s) is the CRD accessible to non-admin user? My understanding is that kubectl get crds
fails when done as a non-admin user.
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.
If the user has permissions to that endpoint but is not admin user then they can use it
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.
OK. Technically feasible. But doesn't seem like a scenario we would have too often. Again, I can't back up my comment with Telemetry. It's more of a hunch.
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.
But we should still account for such event as web console uses that same approach so they would have a reason to do this
|
||
This change would affect multiple service commands and the changes are described briefly below - | ||
- `odo catalog describe service` should include the metadata fields with description so the users can provide then when doing `odo service create` | ||
- `odo catalog list service` shouldn't change much other then listing CRDs per operator |
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.
We're already listing all the CRDs provided by all the installed Operators. I think this won't change at all.
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.
ack, changing that
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.
changed
@girishramnani @kadel I'm probably missing something simple here. Where in the swagger AP ( I'm referring to the JSON available at this endpoint and I can't find the parameters that we see in the alm-example. I'm currently trying to find parameters for etcdcluster. Besides that, in the JSON, is there one place where I can find all the Operators? I ask this because information for etcd Operator and service binding Operator are available at two different endpoints:
Am I looking at the right place? |
The json that I would have pasted wouldn’t have etcd as I didn’t have that installed at the time. |
I was referring to the Swagger data I got from my cluster which had etcd Opreator installed. |
Could you please share that file? |
|
||
At this stage the user either has access to the `openAPIV3Schema` or `ClusterServiceVersion` and also the user has provided the service parameters they want to set as well. To hide the difference between these implementation from the user the `catalog describe` output would follow the same format. e.g. | ||
``` | ||
- FieldPath: zookeeper.resources |
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.
how are arrays of objects going to be represented in this output?
lets say that there is that first.second.envVars
is and array of env variable objects ({name: "foo", value:"bar"}
)
How the FieldPath
will look like, so users know that envVars
is an array of objects and the format they need to use is first.second.envVars[0].name=foo
first.second.envVars[0].value=bar
)
and they don't try to do something like first.second.envVars.name=foo
first.second.envVars.value=bar
or first.second[0].envVars.name=foo
first.second[0].envVars.value=bar
)
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.
my thought was to Maybe we can show it as first.second.envVars[*].name
and explain in describe that * needs to be an index 0,1….?
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.
my thought was to Maybe we can show it as
first.second.envVars[*].name
and explain in describe that * needs to be an index 0,1….?
👍 If there is enough information to do that that would be great!
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.
yeah we have information on what is an array from swagger
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.
added conversion detail in the proposal
So I worked on going through the swagger and realised some CRs dont have any information.
in such cases we will as usual fallback to |
There is still a lot of details that need to be figured out. But those are going to be easier to figure out once we start implementing this. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kadel The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This particular one is my main concern/worry. But we got to start implementing things to realize what's working and what's not. /LGTM |
|
||
If the user doesn't have CRD access or that portion is not implemented yet then we fetch try to fetch the same `openAPIV3Schema` from the cluster's `swagger.json` from the endpoint `<cluster-url>/api/kubernetes/openapi/v2`. This is a very large document as it holds all the definitions present on the cluster. | ||
|
||
So this needs to be cached and refreshed whenever a new operator is installed. |
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'm not very comfortable with managing an automatic cache (which, without a serious protocol between the two parts, is doomed to be inefficient).
What about a specific and explicit odo command, that the user could run to fetch the param information for one or more services?
User story:
odo catalog list services
indicates the params or number of params if known, or if not known, that the user can fetch them.- fetch the params for a specific service
$ odo catalog list services
Services available through Operators
NAME CRDs Params
etcdoperator.v0.9.4-clusterwide EtcdCluster, EtcdBackup, EtcdRestore (to fetch)
service-binding-operator.v0.7.1 ServiceBinding 3 parameters
To fetch params for a service, you can run `odo service fetch-params <service-name>
$ odo service fetch-params etcdoperator.v0.9.4-clusterwide/EtcdCluster
...
Also, only the params information could be stored locally (and not the complete swagger/CRD info), independently of the source of the params (ClusterServiceVersion, swagger, CRD), so the use of this data by odo service create
is generic.
The user could detect which method for fetching the data is available, or give the user the choice to select one.
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.
fetch the params for a specific service
I'm not sure about this. As a user I would be pretty annoyed that I have to run extra command to get information that is essentially required for creating services.
Why odo catalog list services
couldn't do that automatically?
Also, only the params information could be stored locally (and not the complete swagger/CRD info), independently of the source of the params (ClusterServiceVersion, swagger, CRD), so the use of this data by
odo service create
is generic.
I like the idea of caching just params for all sources. This is good.
The user could detect which method for fetching the data is available, or give the user the choice to select one.
I think that this is exposing implementation to users. The user doesn't care where the data comes from. Especially when it can be a fairly complicated decision.
What type of PR is this?
/kind design
/kind documentation
[skip ci]
What does this PR do / why we need it:
see $SUBJECT
Which issue(s) this PR fixes:
Fixes #4240
PR acceptance criteria:
Unit test
Integration test
Documentation
Update changelog
I have read the test guidelines
How to test changes / Special notes to the reviewer: