Hello!
I would like to show a configOption in a Kots config if the installation is a nonKurl cluster OR isKurl, but uses Rook.
So far I have tried to following without success and the option is never shown when it is a kurl+rook cluster:
#1 when: repl{{ and (ConfigOption "option_1" | ParseBool) (ConfigOption "option_2" | ParseBool) (or (not IsKurl) (ne (KurlOption "rook.version") "")) }}
#2 when: repl{{ and (ConfigOption "option_1" | ParseBool) (ConfigOption "option_2" | ParseBool) (or (not IsKurl) (KurlOption "rook.version" | ParseBool)) }}
Can you advise what I might be doing wrong? Do I misinterpret the documentation about KurlOption
?
The installer looks like the following:
apiVersion: cluster.kurl.sh/v1beta1
kind: Installer
metadata:
name: "test-installer"
spec:
...
rook:
version: "1.12.8"
isBlockStorageEnabled: true
storageClassName: "distributed"
hostpathRequiresPrivileged: true
bypassUpgradeWarning: false
minimumNodeCount: 3
Thank you in advance!
The first thing we thought was that capitalization might be the issue. You’ll notice that the docs use Rook.CephReplicaCount
here. I would try Rook.Version
and see if that works for you. If not, a support issue to help dig into it might be the best option.
You could also template Rook.Version
and some other variants into a ConfigMap to see what value it returns. Then at least you know if your and/or logic is wrong, or if the KurlOption
function isn’t returning what you expect.
1 Like
Thank you @Alex_Parker for the comment and for the recommendation of templating configOptions and expressions into a configmap, this helped a lot in troubleshooting.
My #1 attempt, together with capitalizing the referenced KurlOption (Rook.Version
) turned out to be the correct solution:
repl{{ and (ConfigOption "option_1" | ParseBool) (ConfigOption "option_2" | ParseBool) (or (not IsKurl) (ne (KurlOption "Rook.Version") "")) }}
TIL that using ParseBool on a string (that is not equal to either “true” or “false”) will be parsed as “false”, therefore attempt #2 is incorrect.
1 Like