kots icon indicating copy to clipboard operation
kots copied to clipboard

kots repl syntax not taking values

Open gauravkcldcvr opened this issue 2 years ago • 3 comments

We have defined two conditions in kots manifest values.yaml that is being used in helm charts, but it is not taking the both the conditions at once, is there any way we can use AND operator in the syntax or can use two conditions one after the another which seems to be not in working, or am I using it wrongly?

Need help regarding this. Thanks in advance!

condition 1:

#     {{repl if ConfigOptionNotEquals "DOMAIN" ""}}
        hosts:
        - repl{{ ConfigOption `DOMAIN` }} 
        tls:
        - hosts:
          - repl{{ ConfigOption `DOMAIN` }}
#     {{repl end}}

condition 2:

#     {{repl if ConfigOptionEquals "SecretName" "true"}}
        tls:
        - secretName: tls-cert
#     {{repl end}}

gauravkcldcvr avatar Mar 07 '22 14:03 gauravkcldcvr

hi @gauravkcldcvr, could you please share the relevant parts of the config yaml file?

sgalsaleh avatar Mar 07 '22 16:03 sgalsaleh

if you'd like to use an AND operation, you can do something like this

'{{repl and (ConfigOptionNotEquals "DOMAIN" "") (ConfigOptionEquals "SecretName" "true")}}'

if the "SecretName" config option is of type "bool", then you'd wanna use "1"/"0" instead of "true"/"false" https://kots.io/reference/v1beta1/config/#bool

sgalsaleh avatar Mar 07 '22 16:03 sgalsaleh

we have a manifest kots values.yaml file which looks like this below. But it's not taking both of the below conditions at once like mentioned below. Should validate both conditions. Can we not use multiple if blocks one after the another?

  values:
      ingress:
        enabled: true

        annotations: 
          kubernetes.io/ingress.class: nginx
          nginx.ingress.kubernetes.io/ssl-redirect: "{{repl ConfigOptionEquals `tlsEnabled` `true` }}"
          nginx.ingress.kubernetes.io/configuration-snippet: |
            rewrite ^/services/monitor/(.*)$ /$1 break;
            proxy_set_header Authorization "";

#     {{repl if ConfigOptionNotEquals "DOMAIN" ""}}
        hosts:
        - repl{{ ConfigOption `DOMAIN` }} 
        tls:
        - hosts:
          - repl{{ ConfigOption `DOMAIN` }}
#     {{repl end}}

#     {{repl if ConfigOptionEquals "SecretName" "true"}}
        tls:
        - secretName: tls-cert
#     {{repl end}}

gauravkcldcvr avatar Mar 08 '22 04:03 gauravkcldcvr