-
Notifications
You must be signed in to change notification settings - Fork 263
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
Add support to combine service create --filename with other options #923
Comments
In the event a user defines both a serviceaccount property in the file and via a flag, which should be applied or should an error be thrown? |
IMO, the resolution should be:
|
Not sure how I feel about it yet but why would name be different? Someone could be using someone else’s yaml as a common baseline, and it has a name , but they need a new name in their env. Erroring would force them to dup the file and get out of sync. |
tbh, I can't see any use case why someone would like to change the name of a service, as the name is used in Knative (and in K8s in general) as an identifier. I see this feature more like a variant of If you have a good use case why one would need a new name in their env, maybe this use case is more appealing than having this kind of consistency across Another idea was also to allow the yaml file to be an arbitrary list of something, and with the name given on the command line, the service definition could be picked from the list in the file. Not sure if this is a good idea though. But this would also require consistency of the names. |
I suggest to implement the overwrite of other options first and then finally discuss and decide what to do with a name collision. In the meantime, we can collect arguments pro and against having to allow a name overwrite. |
I was only thinking of 'create' since that's what the title of the issue mentioned. In that case I can see someone hosting a yaml file in their repo that they use but then someone else wants to use it themselves, so they can either copy it (and manually keep it in sync) just so they can change the name, or we can allow them to override the name. This promotes reuse. As for 'update', "name" should be ignored since you can't update a ksvc name. |
Also, my statement about ignoring "name" on The cmd line stuff should just be a convenience thing to allow people to avoid the pain of editing the file before running the command (this is just normal options processing... cmd line overrides env vars which overrides config files). I don't see this being any different. How the net (merged) result interacts with the server doesn't change. |
But you need the name to find out which service to update ? |
doi! :-) My mind was stuck on |
edited^^ |
I'm more inclined towards overriding the name from file when it's provided as cmd param to have a consistent policy towards flags that everything provided by the user on cmdline takes precedence over file input. Therefore single value params/flags like Then there's one use case to handle YAML's |
Feature request
Per PR #913 review discussion and comment. There's a possibility to extend the initial functionality of
kn service create --filename
with other options. In a nutshell to view provided file as a baseline that can be further modified but other option flags.There should be a reasonable amount of tests added to verify common usage pattern works, e.g. command line options are reflected, take priority and can override existing values, lists are merged etc.
Use case
Create a service from file and add env variable:
Create a service from file and specify service account:
Implementation notes
The following code block should be added and suggestion points from this PR reflected.
The text was updated successfully, but these errors were encountered: