Skip to content

Commit

Permalink
Remove required and ha mode fail check
Browse files Browse the repository at this point in the history
  • Loading branch information
iblutrifork committed Oct 10, 2023
1 parent ea70a3a commit 2149653
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 10 deletions.
11 changes: 3 additions & 8 deletions charts/flink-job/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ If release name contains chart name it will be used as a full name.
*/}}
{{- define "flink-job.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- .Values.fullnameOverride | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
Expand Down Expand Up @@ -142,13 +142,11 @@ Create the name of the service account to use
{{- $inputs := "" -}}
{{- $outputs := "" -}}
{{- range .Values.job.topics -}}
{{- $name := required "topics.name is required" .name -}}
{{- $name := .name -}}
{{- if eq .type "input" -}}
{{- $inputs = printf "%s,%s" $inputs $name -}}
{{- else if eq .type "output" -}}
{{- $outputs = printf "%s,%s" $outputs $name -}}
{{- else -}}
{{- fail (printf "Topic type %s not understood. Allowed values are: input, output" .type) -}}
{{- end -}}
{{- end -}}
{{- with $inputs -}}
Expand Down Expand Up @@ -232,9 +230,6 @@ Add necessary configuration for running in HA mode
{{- $haDir := printf "%s://%s/%s/ha" (trimSuffix "://" .global.storage.scheme) .global.storage.baseDir .fullname -}}
{{- $configs = fromJson (include "flink-job._dictSet" (list $configs "high-availability.storageDir" $haDir)) -}}
{{- end -}}
{{- if not (hasKey $configs "high-availability.storageDir") -}}
{{- fail "storage.scheme and storage.baseDir or flinkConfiguration.'high-availability.storageDir' is required when using jobManager.replicas > 1" -}}
{{- end -}}
{{- end -}}
{{- $configs | toJson -}}
{{- end -}}
Expand Down Expand Up @@ -291,4 +286,4 @@ Set a key=value in a dictionary, if the key is not defined

{{- define "flink-job.nameWithimageHash" -}}
{{ include "flink-job.fullname" . }}{{ (sha256sum (nospace (toString .Values.image))) | trunc 10 }}
{{- end -}}
{{- end -}}
93 changes: 91 additions & 2 deletions charts/flink-job/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,96 @@
"$schema": "https://json-schema.org/draft-07/schema#",
"title": "JSON schema for flink-job/values.yaml",
"type": "object",
"allOf": [
{
"if": {
"properties": {
"jobManager": {
"properties": {
"replicas": {
"exclusiveMinimum": 1
}
}
}
}
},
"then": {
"anyOf": [
{
"properties": {
"flinkConfiguration": {
"required": ["high-availability.storageDir"]
}
}
},
{
"properties": {
"storage": {
"required": ["scheme", "baseDir"]
}
}
}
]
}
},
{
"if": {
"properties": {
"job": {
"properties": {
"upgradeMode": {
"const": "last-state"
}
}
}
}
},
"then": {
"anyOf": [
{
"properties": {
"flinkConfiguration": {
"required": ["high-availability.storageDir"]
}
}
},
{
"properties": {
"storage": {
"required": ["scheme", "baseDir"]
}
}
}
]
}
},
{
"if": {
"properties": {
"job": {
"properties": {
"upgradeMode": {
"const": "last-state"
}
}
}
}
},
"then": {
"properties": {
"flinkConfiguration": {
"required": ["high-availability.storageDir"]
}
}
}
}
],
"properties": {
"nameOverride": { "type": "string" },
"fullnameOverride": { "type": "string" },
"fullnameOverride": {
"type": "string",
"maxLength": 63
},
"image": {
"description": "Image config",
"type": "object",
Expand Down Expand Up @@ -77,7 +164,9 @@
},
"required": ["enabled"]
},
"flinkConfiguration": { "type": "object" },
"flinkConfiguration": {
"type": "object"
},
"restartNonce": {
"type": ["integer", "string"]
},
Expand Down

0 comments on commit 2149653

Please sign in to comment.