Skip to content

Commit

Permalink
allow null strategy
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Kalantar <kalantar@us.ibm.com>
  • Loading branch information
kalantar committed Sep 26, 2023
1 parent 48f5ec9 commit 7c42911
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions charts/routing-actions/templates/traffic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,42 @@
{{- printf "Unknown appType: '%s'" .Values.appType | fail }}
{{- end }}

{{- /* set default strategy */}}
{{- $strategy := "none" }}
{{- if .Values.strategy }}
{{- $strategy := .Values.strategy }}
{{- end }}

{{- /* validate values for strategy */}}
{{- if not (has .Values.strategy (list "blue-green" "canary" "none")) }}
{{- printf "Unknown strategy: '%s'" .Values.strategy | fail }}
{{- if not (has $strategy (list "blue-green" "canary" "none")) }}
{{- printf "Unknown strategy: '%s'" $strategy | fail }}
{{- end }}

{{- /* handle initialize */}}
{{- if eq "initialize" .Values.action }}

{{- /* gateway needed for kserve-modelmesh, deployment */}}
{{- if ne "none" .Values.strategy }}
{{- if ne "none" $strategy }}
{{- if has .Values.appType (list "kserve-modelmesh" "deployment") }}
{{ include "initial.gateway" . }}
{{- end }}
{{- end }}
---
{{- if ne "none" .Values.strategy }}
{{- if ne "none" $strategy }}
{{- if eq "deployment" .Values.appType }}
{{ include "deployment.virtualservice" . }}
{{- else if eq "kserve-modelmesh" .Values.appType }}
{{ include "mm.virtualservice" . }}
{{- else }} {{- /* eq "kserve" .Values.appType */}}
{{- if eq "blue-green" .Values.strategy }}
{{- if eq "blue-green" $strategy }}
{{ include "kserve.virtualservice-bluegreen" . }}
{{- else }} {{- /* eq "canary" .Values.strategy */}}
{{- else }} {{- /* eq "canary" $strategy */}}
{{ include "kserve.virtualservice-canary" . }}
{{- end }}
{{- end }}
{{- end }}
---
{{- if ne "none" .Values.strategy }}
{{- if ne "none" $strategy }}
{{- if eq "deployment" .Values.appType }}
{{ include "deployment.service" . }}
{{- else if eq "kserve-modelmesh" .Values.appType }}
Expand All @@ -50,50 +56,50 @@
{{- end }}
---
{{- if eq "deployment" .Values.appType }}
{{- if eq "none" .Values.strategy }}
{{- if eq "none" $strategy }}
{{ include "deployment.routemap-none" . }}
{{- else if eq "blue-green" .Values.strategy }}
{{- else if eq "blue-green" $strategy }}
{{ include "deployment.routemap-bluegreen" . }}
{{- else }} {{- /* eq "canary" .Values.strategy */}}
{{- else }} {{- /* eq "canary" $strategy */}}
{{ include "deployment.routemap-canary" . }}
{{- end }}
{{- else if eq "kserve-modelmesh" .Values.appType }}
{{- if eq "none" .Values.strategy }}
{{- if eq "none" $strategy }}
{{ include "mm.routemap-none" . }}
{{- else if eq "blue-green" .Values.strategy }}
{{- else if eq "blue-green" $strategy }}
{{ include "mm.routemap-bluegreen" . }}
{{- else }} {{- /* eq "canary" .Values.strategy */}}
{{- else }} {{- /* eq "canary" $strategy */}}
{{ include "mm.routemap-canary" . }}
{{- end }}
{{- else }} {{- /* eq "kserve" .Values.appType */}}
{{- if eq "none" .Values.strategy }}
{{- if eq "none" $strategy }}
{{ include "kserve.routemap-none" . }}
{{- else if eq "blue-green" .Values.strategy }}
{{- else if eq "blue-green" $strategy }}
{{ include "kserve.routemap-bluegreen" . }}
{{- else }} {{- /* eq "canary" .Values.strategy */}}
{{- else }} {{- /* eq "canary" $strategy */}}
{{ include "kserve.routemap-canary" . }}
{{- end }}
{{- end }}
---
{{- if eq "blue-green" .Values.strategy }}
{{- if eq "blue-green" $strategy }}
{{- range $i, $v := $versions }}
{{ include "create.weight-config" (unset $v "weight") }}
---
{{- end }}
{{- else if eq "mirror" .Values.strategy }}
{{- else if eq "mirror" $strategy }}
{{- range $i, $v := (rest $versions) }}
{{ include "create.weight-config" (unset $v "weight") }}
---
{{- end }}
{{- end }}

{{- else if eq "modify-weights" .Values.action }}
{{- if eq "blue-green" .Values.strategy }}
{{- if eq "blue-green" $strategy }}
{{- range $i, $v := .Values.appVersions }}
{{ include "create.weight-config" $v }}
---
{{- end }}
{{- else if eq "mirror" .Values.strategy }}
{{- else if eq "mirror" $strategy }}
{{- range $i, $v := (rest $versions) }}
{{ include "create.weight-config" (set $v "weight" $.Values.mirrorPercentage) }}
---
Expand Down

0 comments on commit 7c42911

Please sign in to comment.