morhidi opened a new pull request, #525:
URL: https://github.com/apache/flink-kubernetes-operator/pull/525
## What is the purpose of the change
Flink deployment resources support env interpolation natively using $()
syntax. Users expected this to "just work" like other resources when using the
operator, but it does not. It would be a great addition, simplifying job
startup decision-making while following existing conventions.
```
job:
args:
- "--sleep"
- "${SLEEP}"
- "--error-rate"
- "${ERROR_RATE}"
```
Note: The feature is considered experymental and controlled by a flag
`argument.variables.enabled=false`
## Brief change log
The logic uses the idea to append the
`-D$internal.application.program-args=--sleep;${SLEEP};--error-rate;${ERROR_RATE}`
as a dynamic property to `kubernetes.jobmanager.entrypoint.args` which results
in the following container command:
```
- args:
- bash
- -c
- kubernetes-jobmanager.sh kubernetes-application
-D\$internal.application.program-args=--sleep\;${SLEEP}\;--error-rate\;${ERROR_RATE}
```
## Verifying this change
- Unit tests where added to cover the functionality
- Also verified manually by running:
```
apiVersion: flink.apache.org/v1beta1
kind: FlinkDeployment
metadata:
name: basic-example
spec:
image: flink:1.16
flinkVersion: v1_16
flinkConfiguration:
taskmanager.numberOfTaskSlots: "2"
serviceAccount: flink
podTemplate:
apiVersion: v1
kind: Pod
metadata:
name: pod-template
spec:
containers:
- name: flink-main-container
env:
- name: SLEEP
value: "10"
- name: ERROR_RATE
value: "0.1"
jobManager:
resource:
memory: "2048m"
cpu: 1
taskManager:
resource:
memory: "2048m"
cpu: 1
job:
jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar
args: ["--sleep","${SLEEP}","--error-rate", "${ERROR_RATE}"]
parallelism: 2
upgradeMode: stateless
```
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changes to the `CustomResourceDescriptors`:
no
- Core observer or reconciler logic that is regularly executed: no
## Documentation
- Does this pull request introduce a new feature? yes
- If yes, how is the feature documented? (autoganarated)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]