replicatedhq / kots

KOTS provides the framework, tools and integrations that enable the delivery and management of 3rd-party Kubernetes applications, a.k.a. Kubernetes Off-The-Shelf (KOTS) Software.
https://kots.io
Apache License 2.0
898 stars 88 forks source link

kots repl syntax not taking values #2592

Open gauravkcldcvr opened 2 years ago

gauravkcldcvr commented 2 years ago

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}}
sgalsaleh commented 2 years ago

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

sgalsaleh commented 2 years ago

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

gauravkcldcvr commented 2 years ago

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}}