Giriş
Söz dizimi şöyle
{{ if PIPELINE }}
  # Do something
{{ else if OTHER PIPELINE }}
  # Do something else
{{ else }}
  # Default case
{{ end }}Açıklaması şöyle
A pipeline will be evaluated as false if the value is:a boolean falsea numeric zeroan empty stringa nil (empty or null)an empty collection (map, slice, tuple, dict, array)
Açıklaması şöyle
To remove any leading spaces we can use a dash {{- before the if/else statement.
Örnek
Şöyle yaparız
{{- if .Values.backup.enabled }}
  backup:
    engine: {{ $.Values.backup.engine }}
    locations:
      - volume:
          persistentVolumeClaim:
            claimName: {{ $.Values.keyspaceName }}-vitess-backup
{{- end }}Örnek -and
Şöyle yaparız
{{- if and (.Values.configMap.data.darkMode) ( eq .Values.configMap.data.os "mac") }}
mode: dark
{{- else }} 
mode: light
{{- end }}
{{- if eq .Values.configMap.data.env "prod"  }}
env: prod
{{- else if eq .Values.configMap.data.env "dev" }}
env: dev
{{- else }}
env: test
{{- end }}
Hiç yorum yok:
Yorum Gönder