[ 
https://issues.apache.org/jira/browse/FLINK-38548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18032620#comment-18032620
 ] 

Daniel Rossos commented on FLINK-38548:
---------------------------------------

Hi [~premsantosh],

Was just writing up and issue for this as I saw this notification pop-up so 
thanks for raising this!

Another issue we were facing is if you have your FlinkBlueGreenDeployment name 
set to any keyword key name / subset of a key name it will do a find and 
replace on all parts of the spec, not just limited to yaml values but also the 
keys. This can create invalid key/fields that will not be properly set in the 
FlinkDeployment spec leading to them being seen as missing / invalid. 

An easy to see example of this is with a FlinkBlueGreenDeployment that is named 
"flink". Your prepared spec will contain the fields like 
`"flink-blueConfiguration"` and `"flink-blueVersion"` instead of 
`"flinkConfiguration"` and `"flinkVersion"`. This breaks the spec and makes 
entire deployment invalid.

 

Luckily though, I believe the direction your PR is going will cover this 
alternative case as well

> Blue/Green Deployments rename too many spec fields
> --------------------------------------------------
>
>                 Key: FLINK-38548
>                 URL: https://issues.apache.org/jira/browse/FLINK-38548
>             Project: Flink
>          Issue Type: Bug
>          Components: Kubernetes Operator
>            Reporter: Prem Santosh
>            Priority: Minor
>              Labels: pull-request-available
>
> Hi [~gyfora] and [~schongloo], thanks so much for contributing FLINK-38420.
> In our initial testing of the feature, we found that the adjustNameReferences 
> method blanket replaces all occurrences of the deployment name in the spec 
> with a suffixed version of the name with -blue or -green: 
> [https://github.com/apache/flink-kubernetes-operator/blob/main/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/bluegreen/BlueGreenUtils.java#L62-L81]
> {code:java}
>     public static <T> T adjustNameReferences(
>             T spec,
>             String deploymentName,
>             String childDeploymentName,
>             String wrapperKey,
>             Class<T> valueType) {
>         String serializedSpec = SpecUtils.writeSpecAsJSON(spec, wrapperKey);
>         String replacedSerializedSpec = 
> serializedSpec.replace(deploymentName, childDeploymentName);
>         return SpecUtils.readSpecFromJSON(replacedSerializedSpec, wrapperKey, 
> valueType);
>     }
> {code}
> We use the deployment name in various fields such as metrics scope, 
> checkpoint and savepoint directories, and even configmap names in the 
> taskmanager and jobmanager pod templates. The blanket replacement breaks 
> operations such as restoring the deployment from savepoint since the 
> initialSavepointPath field also gets rewriten.
> We would like to submit a patch to remove the call to adjustNameReferences, 
> and change only the child deployment names to include the blue/green suffixes 
> if possible. Creating a Jira ticket first per the contributor guide.
> Sharing the code change we'll submit as a PR upstream if the contributors 
> agree: [https://github.com/lyft/flink-kubernetes-operator/pull/1/files]
> Thanks!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to