You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue description:
There is a difference in the behaviour of show_subquestion_if and
show_if in a chart's question.yaml, between the older Apps functionality in the Cluster Manager and the Apps & Marketplace in the Cluster Explorer
Business impact:
Unable to directly port chart catalog from old Apps feature to new Apps & Marketplace
Root cause
The root cause was that the Ember UI and the Dashboard UI had different ways of rendering the forms that were configured in a helm chart app's questions.yaml. Ember used custom code for checking the conditional logic in the questions.yaml, whereas the Dashboard UI used a library called Jexl for this purpose. It turns out Jexl has slightly different behavior for evaluating whether to show and hide form inputs based on other form inputs. For example, in Ember, turning something on might cause more config options to be displayed. In the dashboard those extra options just weren't showing up.
What was fixed, or what changes have occurred
I made a PR that makes it so that the dashboard reverts back to using the custom code from the Ember UI for an edge case where the conditional logic in questions.yaml has a hyphen in it. (Jexl doesn't support hyphens because it converts the condition string into javascript, and in javascript the hyphen means a minus sign so it couldn't process it as part of a variable name as Ember did.) It only reverts to the custom ember logic when there's a hyphen to avoid breaking the logic in other places.
Vince said that we shouldn't completely remove Jexl because Jexl is probably better/safer overall and we already told users that we are using this library.
Areas or cases that should be tested
I would say only this very specific customer's use case should be tested because this PR is really about supporting existing customers and making it so they don't have to do annoying manual work to migrate legacy apps. If we didn't make this change, they would have to manually remove the hyphens from their variable names in questions.yaml. I would expect that in most cases, variable names wouldn't have hyphens so this issue wouldn't come up.
What areas could experience regressions?
The PR affects how custom forms are rendered from Questions.yaml, so if it caused a regression it would be there.
Are the repro steps accurate/minimal?
The repro steps show how to see the expected behavior in the Ember UI. The desired behavior is to replicate the same behavior in the Dashboard UI.
Repro steps for the expected behavior
Provision a Rancher v2.5.9 instance with single all role node downstream
Add catalog [https://github.com/axeal/rancher-catalog.git] branch case-00311126 in Cluster Manager and same as Chart Repository in Cluster Explorer
Toggle rabbitmq Ingress enabled between True/False and observe rabbitmq Ingress TLS enabled, rabbitmq secretName and rabbitmq certManager enabled fields displayed or hidden
Toggle Influxdb Application Version between v1/v2 and observe Init Admin Token, Init Bucket Name, Init Mode Name, Init Organization Name and Init Retention Day fields displayed when v2 selected and HTTP Auth Enabled ? when v1 selected
Repro steps for the actual behavior
Cluster Explorer -> Apps & Marketplace -> Charts -> json-exporter
Under rabbitmq Ingress Settings Tab observe toggling rabbitmq Ingress enabled has no effect on fields displayed !cluster-explorer-ingress.png!
Under InfluxDB Configuration Settings Tab observe toggling Influxdb Application Version has now effect on fields displayed !cluster-explorer-influxdb-version.png!
Actual behavior:
Behaviour differs between Cluster Manager Apps and Cluster Explorer Apps & Marketplace
Expected behavior:
Behaviour the same
Additional notes:
Support did narrow down the situation to a failure to process the conditional logic as expected when the variable contains a hyphen.
Create a chart with the questions.yaml below and observe the show_subquestion_if: true is processed as expected in both Apps v1 in the Cluster Manager and Apps v2 in the Cluster Explorer. Update the variable name to contain a hyphen (e.g. se-rabbitmq.rabbitmq.ingress.enabled or rabbitmq.se-rabbitmq.ingress.enabled) and observe the subquestions are not displayed in the Cluster Explorer.
Since there have been no other problems with Jexl so far, I'm re-adding Ember's custom evaluation logic, but only using it for evaluating expressions that contain hyphens. Everything else should use Jexl, so these changes will only apply to this narrowly defined case where hyphens are used.
Issue description:
There is a difference in the behaviour of show_subquestion_if and
show_if in a chart's question.yaml, between the older Apps functionality in the Cluster Manager and the Apps & Marketplace in the Cluster Explorer
Business impact:
Unable to directly port chart catalog from old Apps feature to new Apps & Marketplace
Root cause
The root cause was that the Ember UI and the Dashboard UI had different ways of rendering the forms that were configured in a helm chart app's
questions.yaml
. Ember used custom code for checking the conditional logic in the questions.yaml, whereas the Dashboard UI used a library called Jexl for this purpose. It turns out Jexl has slightly different behavior for evaluating whether to show and hide form inputs based on other form inputs. For example, in Ember, turning something on might cause more config options to be displayed. In the dashboard those extra options just weren't showing up.What was fixed, or what changes have occurred
I made a PR that makes it so that the dashboard reverts back to using the custom code from the Ember UI for an edge case where the conditional logic in questions.yaml has a hyphen in it. (Jexl doesn't support hyphens because it converts the condition string into javascript, and in javascript the hyphen means a minus sign so it couldn't process it as part of a variable name as Ember did.) It only reverts to the custom ember logic when there's a hyphen to avoid breaking the logic in other places.
Vince said that we shouldn't completely remove Jexl because Jexl is probably better/safer overall and we already told users that we are using this library.
Areas or cases that should be tested
I would say only this very specific customer's use case should be tested because this PR is really about supporting existing customers and making it so they don't have to do annoying manual work to migrate legacy apps. If we didn't make this change, they would have to manually remove the hyphens from their variable names in questions.yaml. I would expect that in most cases, variable names wouldn't have hyphens so this issue wouldn't come up.
What areas could experience regressions?
The PR affects how custom forms are rendered from Questions.yaml, so if it caused a regression it would be there.
Are the repro steps accurate/minimal?
The repro steps show how to see the expected behavior in the Ember UI. The desired behavior is to replicate the same behavior in the Dashboard UI.
Repro steps for the expected behavior
rabbitmq Ingress enabled
between True/False and observerabbitmq Ingress TLS enabled
,rabbitmq secretName
andrabbitmq certManager enabled
fields displayed or hiddenInfluxdb Application Version
between v1/v2 and observeInit Admin Token
,Init Bucket Name
,Init Mode Name
,Init Organization Name
andInit Retention Day
fields displayed when v2 selected andHTTP Auth Enabled ?
when v1 selectedRepro steps for the actual behavior
rabbitmq Ingress Settings
Tab observe togglingrabbitmq Ingress enabled
has no effect on fields displayed !cluster-explorer-ingress.png!InfluxDB Configuration Settings
Tab observe togglingInfluxdb Application Version
has now effect on fields displayed !cluster-explorer-influxdb-version.png!Actual behavior:
Behaviour differs between Cluster Manager Apps and Cluster Explorer Apps & Marketplace
Expected behavior:
Behaviour the same
Additional notes:
Support did narrow down the situation to a failure to process the conditional logic as expected when the variable contains a hyphen.
Create a chart with the questions.yaml below and observe the
show_subquestion_if: true
is processed as expected in both Apps v1 in the Cluster Manager and Apps v2 in the Cluster Explorer. Update the variable name to contain a hyphen (e.g.se-rabbitmq.rabbitmq.ingress.enabled
orrabbitmq.se-rabbitmq.ingress.enabled
) and observe the subquestions are not displayed in the Cluster Explorer.Global For All charts
Internal reference: SURE-3300
The text was updated successfully, but these errors were encountered: