what's the role/use of webhook in flink operator?
# random
k
what's the role/use of webhook in flink operator?
b
To my best knowledge, the webhook in flink operator is used for validation(i.e. validate and tell users that they are trying to apply wrong deployment in advance) so that the actual reconcile loop of the k8s operator will not be triggered. But in the org.apache.flink.kubernetes.operator.controller.FlinkDeploymentController#reconcile(), the validation methods will be called as well. So it may not be so necessary to enable it. Hi @Gyula F贸ra , just want to check, is my understanding correct? Are there any other obvious benefits to enable webhook?
馃憤 1
g
That is correct, the webhook does the same validation as the controller. The only difference is how the error is reported to the user
鉂わ笍 1
Without the webhook the user can still submit invalid config and the error will be recorder in the CR status
The webhook runs before accepting the CR so it results in an upfront rejection of the invalid configuration when the user tries to apply it
There is also a mutating webhook in the operator that adds some labels on session jobs . In the future we might need to use the mutating webhook to allow migration between api versions
馃憤 2
k
Thanks biao & Gyula for the explanation