diff --git a/charts/flink-job/manual-ci/bad-upgrademode.yaml b/charts/flink-job/manual-ci/bad-upgrademode.yaml new file mode 100644 index 00000000..c378934c --- /dev/null +++ b/charts/flink-job/manual-ci/bad-upgrademode.yaml @@ -0,0 +1,36 @@ +# example values from docs.cheetah.trifork.dev/ +image: + repository: flink + tag: 1.16 +ingress: + enabled: true + hostname: flink.cheetah.trifork.dev + annotations: + cert-manager.io/cluster-issuer: letsencrypt + tlsSecret: letsencrypt + + +version: v1_16 +job: + jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar + entryClass: org.apache.flink.streaming.examples.statemachine.StateMachineExample + parallelism: 2 + upgradeMode: savepoint + topics: + - name: test + type: input + postfix: postfix +taskManager: + replicas: 2 + resource: + memory: 2Gb + cpu: 0.5 +jobManager: + replicas: 2 + +flinkConfiguration: + state.backend: "rocksdb" + restart-strategy.failure-rate.failure-rate-interval: "6 min" + +metrics: + enabled: true diff --git a/charts/flink-job/templates/_helpers.tpl b/charts/flink-job/templates/_helpers.tpl index 3697c885..5577dada 100644 --- a/charts/flink-job/templates/_helpers.tpl +++ b/charts/flink-job/templates/_helpers.tpl @@ -269,6 +269,9 @@ Validate the configuration */}} {{- define "flink-job.storageConfiguration" -}} {{- $configs := .configs -}} + {{- if and (not (eq .global.job.upgradeMode "stateless")) (not (and .global.storage.scheme .global.storage.baseDir)) -}} + {{- fail "storage.scheme and storage.baseDir must be set when upgradeMode is not stateless" -}} + {{- end -}} {{- if and .global.storage.scheme .global.storage.baseDir (has .global.job.upgradeMode (list "last-state" "savepoint")) -}} {{- $checkpointsDir := printf "%s://%s/%s/checkpoints" (trimSuffix "://" .global.storage.scheme) .global.storage.baseDir .fullname -}} {{- $configs = fromJson (include "flink-job._dictSet" (list $configs "state.checkpoints.dir" $checkpointsDir)) -}} diff --git a/charts/flink-job/values.schema.json b/charts/flink-job/values.schema.json index cfc610c8..73c6f452 100644 --- a/charts/flink-job/values.schema.json +++ b/charts/flink-job/values.schema.json @@ -3,139 +3,6 @@ "title": "JSON schema for flink-job/values.yaml", "type": "object", "additionalProperties": false, - "allOf": [ - { - "if": { - "properties": { - "job": { - "properties": { - "upgradeMode": { - "const": "savepoint" - } - } - } - } - }, - "then": { - "anyOf": [ - { - "properties": { - "flinkConfiguration": { - "required": [ - "state.savepoints.dir" - ] - } - } - }, - { - "properties": { - "storage": { - "type": "object", - "properties": { - "scheme": { - "type": "string", - "minLength": 1 - }, - "baseDir": { - "type": "string", - "minLength": 1 - } - } - } - } - } - ] - } - }, - { - "if": { - "properties": { - "job": { - "properties": { - "upgradeMode": { - "const": "last-state" - } - } - } - } - }, - "then": { - "anyOf": [ - { - "properties": { - "flinkConfiguration": { - "required": [ - "state.checkpoints.dir", - "high-availability.storageDir" - ] - } - } - }, - { - "properties": { - "storage": { - "type": "object", - "properties": { - "scheme": { - "type": "string", - "minLength": 1 - }, - "baseDir": { - "type": "string", - "minLength": 1 - } - } - } - } - } - ] - } - }, - { - "if": - { - "properties": { - "jobManager": { - "properties": { - "replicas": { - "exclusiveMinimum": 1 - } - } - } - } - }, - "then": { - "anyOf": [ - { - "properties": { - "flinkConfiguration": { - "required": [ - "high-availability.storageDir" - ] - } - } - }, - { - "properties": { - "storage": { - "type": "object", - "properties": { - "scheme": { - "type": "string", - "minLength": 1 - }, - "baseDir": { - "type": "string", - "minLength": 1 - } - } - } - } - } - ] - } - } - ], "properties": { "nameOverride": { "type": "string"