Skip to content

Commit

Permalink
Add condition rules to replace the rest of the fail helm statements
Browse files Browse the repository at this point in the history
  • Loading branch information
iblutrifork committed Oct 10, 2023
1 parent 2149653 commit 4eb522d
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 9 deletions.
9 changes: 0 additions & 9 deletions charts/flink-job/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,6 @@ Validate the configuration
{{- $configs = fromJson (include "flink-job._dictSet" (list $configs "state.savepoints.dir" $savepointsDir)) -}}
{{- end -}}
{{- end -}}
{{- if not (has .global.job.upgradeMode (list "stateless" "last-state" "savepoint")) -}}
{{- fail "job.upgradeMode must be either stateless, last-state, or savepoint" -}}
{{- end -}}
{{- if and (has .global.job.upgradeMode (list "last-state" "savepoint")) (not (hasKey $configs "state.checkpoints.dir")) -}}
{{- fail "storage.scheme and storage.baseDir or flinkConfiguration.'state.checkpoints.dir' is required when using job.upgradeMode=savepoint or last-state" -}}
{{- end -}}
{{- if and (eq .global.job.upgradeMode "savepoint") (not (hasKey $configs "state.savepoints.dir")) -}}
{{- fail "storage.scheme and storage.baseDir or flinkConfiguration.'state.savepoints.dir' is required when using job.upgradeMode=savepoint" -}}
{{- end -}}
{{- $configs | toJson -}}
{{- end -}}

Expand Down
62 changes: 62 additions & 0 deletions charts/flink-job/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,68 @@
"title": "JSON schema for flink-job/values.yaml",
"type": "object",
"allOf": [
{
"if": {
"properties": {
"job": {
"properties": {
"upgradeMode": {
"const": "savepoint"
}
}
}
}
},
"then": {
"anyOf": [
{
"properties": {
"flinkConfiguration": {
"required": ["state.savepoints.dir"]
}
}
},
{
"properties": {
"storage": {
"required": ["scheme", "baseDir"]
}
}
}
]
}
},
{
"if": {
"properties": {
"job": {
"properties": {
"upgradeMode": {
"enum": ["savepoint", "last-state"]
}
}
}
}
},
"then": {
"anyOf": [
{
"properties": {
"flinkConfiguration": {
"required": ["state.checkpoints.dir"]
}
}
},
{
"properties": {
"storage": {
"required": ["scheme", "baseDir"]
}
}
}
]
}
},
{
"if": {
"properties": {
Expand Down

0 comments on commit 4eb522d

Please sign in to comment.