Skip to content
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 flag to pass the details for adding/removing the func config envs/volumes. #1182

Closed
sudhirverma opened this issue Aug 23, 2022 · 16 comments

Comments

@sudhirverma
Copy link

Issue: redhat-developer/vscode-knative#190

As required in VSCode we would need flags to add/remove configured environment variable and volumes.

for e.g:

func config envs add -type 'type of enviroment variable' -name 'name' -value 'value'

func config envs add -type 'type of enviroment variable'  -configMap 'configMap'

cc: @mohitsuman @lstocchi

@mohitsuman
Copy link

With the current implementation of func cli asking interactive prompts to the user, from the IDE side of things we would pass those prompts as dropdown options and once the user selects them, the command would be passed as a flag directly.
This way we can support multiple parameters (anything added in future) through the IDE workflow.

@matejvasek
Copy link
Contributor

@sudhirverma
How output of func config envs list should look like?

[{"Name":"abc","Value":"42"},{"Name":"cba","Value":"{{ env:HOME }}"}]

Or somehow else?

@matejvasek
Copy link
Contributor

Also do we want specific flags for secrets/configMaps, or would we be content with just --name and --value (which would require {{}} for special values)?

@matejvasek
Copy link
Contributor

cc @lance @zroubalik @lkingland

@sudhirverma sudhirverma changed the title Add flag to pass the details for adding/removing the func config envs/valumes. Add flag to pass the details for adding/removing the func config envs/volumes. Aug 23, 2022
@sudhirverma
Copy link
Author

How output of func config envs list should look like?

[{"Name":"abc","Value":"42"},{"Name":"cba","Value":"{{ env:HOME }}"}]

this would be good to show output when we do func config envs list -ojson or --json.

@lance
Copy link
Member

lance commented Aug 23, 2022

Let's identify in specifics what commands need what flags. I think it's a pretty big list

For func config envs add

  • --name the name of the environment variable
  • --value for hard coded variables - how should this work for variables from the environment? Do we just have the user enter the string {{ env.MY_ENV }} directly?
  • --configMap for keys/values stored in a ConfigMap. If --name is provided, only a single value with key corresponding to --name is used. If --name is not provided, all key/value pairs are used.
  • --secret behaving the same as --configMap above, but with secrets.

For func config labels add and func config annotations add I think we can eliminate the --configMap and --secret flags.

So, for example, a user wanting to add an environment variable named FOO with a value from the current environment BAR variable, they would type

func config envs add --name FOO --value "{{ env.BAR }}"

To use all values from the ConfigMap called myConfig.

func config envs add --configMap myConfig

We also need to add the --name flag to func config [envs|labels|annotations] delete command to delete a specific key/value pair.

Does this all sound about right?

@matejvasek
Copy link
Contributor

matejvasek commented Aug 23, 2022

@lance
Yeah, but instead of

func config envs add --configMap myConfig

we could have just

func config envs add --value '{{ configMap:myConfig }}'

It would be simple to implement it that way, however user would have to know the expression language.
Basically there would be just --name and --value flags.

@lance
Copy link
Member

lance commented Aug 23, 2022

It would be simple to implement it that way, however user would have to know the expression language.

True - but also users can either use the interactive prompt or the IDE.

@lance
Copy link
Member

lance commented Sep 9, 2022

@matejvasek can this be closed now given that #1188 has landed?

@lance lance moved this to Icebox in Func Roadmap Sep 9, 2022
@lance lance moved this from Icebox to In Progress in Func Roadmap Sep 9, 2022
@lance lance added this to the 1.0.0 Release milestone Sep 9, 2022
@lance
Copy link
Member

lance commented Oct 4, 2022

@matejvasek ping - do you think this can be closed?

@matejvasek
Copy link
Contributor

There is still work to be done.

@matejvasek
Copy link
Contributor

Only adding and listing of envvars is implemented, deletion is not.
Also volumes are not implemented at all.

@lance
Copy link
Member

lance commented Oct 4, 2022

Only adding and listing of envvars is implemented, deletion is not. Also volumes are not implemented at all.

Ok thanks for the update. Do you think it would help to break this into a couple of different issues? Now that adding/listing env vars is in place it might be easier for someone to pick up additional pieces.

@lance lance moved this to 🏗 In progress in Functions WG Roadmap Oct 6, 2022
@lance
Copy link
Member

lance commented Oct 6, 2022

/kind enhancement

@lance lance moved this from 🏗 In progress to 🔖 Next in Functions WG Roadmap Oct 13, 2022
@lance
Copy link
Member

lance commented Oct 13, 2022

Moving this to "Next" instead of "In progress" since some of it did get done but not all of it.

@lance lance moved this from 🔖 Next to ✅ Done in Functions WG Roadmap Oct 18, 2022
@lance
Copy link
Member

lance commented Oct 18, 2022

Closing this as complete. Will open new issues for labels / annotations / secrets.

@lance lance closed this as completed Oct 18, 2022
Repository owner moved this from In Progress to In Design in Func Roadmap Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

4 participants