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

How could I use a struct as a parameter ? #951

Closed
abmybgx opened this issue Oct 15, 2019 · 8 comments
Closed

How could I use a struct as a parameter ? #951

abmybgx opened this issue Oct 15, 2019 · 8 comments
Labels
kep/24 Map and array parameter types kep/25 Template function toYaml kep/26 Parameter value files kind/enhancement

Comments

@abmybgx
Copy link

abmybgx commented Oct 15, 2019

What would you like to be added:

Define a struct as a parameter

Why is this needed:

When I'd like to use node-affinity or tolerations in my operatorVersions, parameter type string is not easy to achieve.

@gerred
Copy link
Member

gerred commented Oct 15, 2019

Hi @abmybgx would you mind proposing a syntax for this? Would love to see your thoughts here.

@porridge
Copy link
Member

Closing in favour of #1221 which has more traction. Please reopen if you think this is something else.

@abmybgx
Copy link
Author

abmybgx commented Mar 11, 2020

@porridge Is the function would be ready on v0.11 release, and how to use it?

@porridge
Copy link
Member

porridge commented Mar 11, 2020

@abmybgx there are 3 pieces to this feature w.r.t. your use case:

  1. ability to create parameters of type map - will be in 0.11, but AFAIK is undocumented (right @nfnt?). You can use this test operator as an example though.
  2. ability to dump a parameter value as YAML inside a template - will also be in 0.11 and documentation for it will appear in the canonical place right after the release. For now you can see it on this preview site but basically it's to be used identically like the function with the same name in Helm.
  3. ability to conveniently pass complex parameter values into kubectl kudo - unlikely to be merged in time for the 0.11 release, still in review, as is its documentation. However you should be able to still pass them in JSON format (which is a subset of YAML) on the --parameter flag.

@porridge porridge added kep/24 Map and array parameter types kep/25 Template function toYaml kep/26 Parameter value files labels Mar 11, 2020
@abmybgx
Copy link
Author

abmybgx commented Mar 12, 2020

@porridge Thanks for your comment. And what about the case of below?

tolerations:
- key: xxx
   value: xxx
   operator: xxx
   effect: xxx
- key
   value
   operator:
   effect:

@porridge
Copy link
Member

@abmybgx what is the question exactly? FWIW this is not valid YAML, but something like this would be allowed, once KEP-26 implementation is merged (probably in kudo 0.12.x). If you rewrite this in JSON format it should also work in 0.11, I think.

@abmybgx
Copy link
Author

abmybgx commented Mar 12, 2020

@porridge I mean maybe I need a param named tolerations and how could I mapping the struct like that? Did mean the below is usable now?

tolerations:
- key: {json}
- key: {json}

@porridge
Copy link
Member

@abmybgx no, because currently there is nowhere you could put the above document in.
What I mean is that the following should be usable:

kubectl kudo update --instance=foo --parameter 'tolerations=[{"key": {"value": 1, "operator": "eq", "effect": 3}}, {"key": {"value": 5, "operator": "le", "effect": 6}}]'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kep/24 Map and array parameter types kep/25 Template function toYaml kep/26 Parameter value files kind/enhancement
Projects
None yet
Development

No branches or pull requests

3 participants