-
Notifications
You must be signed in to change notification settings - Fork 73
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
[Change Proposal] Add support for required conditional groups of variables #744
Comments
Kibana related PR: elastic/kibana#182645 |
The proposal presented would help out with the CSPM integration. The problem statement aligns with the CSPM challenge where we need to have all the stream variables optional because we have the options However, I can see other scenarios getting more complex, so I am leaning on option 1 |
Is this proposal going to be resolved before the 8.18 release? |
I can schedule this in our next sprint, but it's not clear how much work would be required to land this proposal in its current state or if it would need more work to solidify our approach. Overall I'm in favor of option 2 because it requires less changes to the overall variable structure in packages. I think including "additional validation rules" at a higher level in the package will allow us to express logic like "at least one of these variables must be set" without tying it to a specific variable or requiring a full refactor of the variable declarations. |
cc @jsoriano |
I also agree on option 2, specially because option 1 would be breaking for current packages and versions of Fleet.
@seanrathier would you have examples of these more complex scenarios? |
@jsoriano, the use case for CSPM and CloudFlare are similar where this is a simple rule
However, a more complex rule like below with option 1 would require us to duplicate the vars which may be an issue for the Fleet platform to change.
|
Oh, good point, for this case option 2 would be better too, right? That would be represented as:
|
Here is one of the complex validations I was referring to, if
So I think we need an unless clause.
|
Adding this Couldn't this be represented like this?
Or if we want to be more explicit about some condition, maybe we can make the groups a list of objects instead of only the names, so we can require some values.
Or we could build this as some kind of switch case, what would allow to define multiple sets of optional groups:
|
🤔 I like this approach, and this will work for complex validations
|
There are cases where there are sets of variables that are optional, but it is required to set at least one of them. This is frequent for example when there are different available authentication options.
For example in Cloudflare there are three variables defined as optional:
auth_token
,auth_email
andauth_key
. Either the token needs to be set, or the email and the key.We need a way to express this in the package manifests.
There are some options to explore:
Option 1: Variable groups
So it is possible to define "groups" in a similar fashion to
select
, and the selected group can have its own restrictions, something like this:This would also require changes in Fleet UI.
Option 2: Groups of requirements
Define a list of groups that must be configured. Something like this would mean what is wanted in the Cloudflare integration:
Understood as (auth_email AND auth_key) OR (auth_token).
This option wouldn't require breaking changes in packages. It will also require changes in Fleet UI.
The text was updated successfully, but these errors were encountered: