Skip to content

Commit ba6197a

Browse files
committed
Remove scale subresource from blue green deployments
1 parent f203cd0 commit ba6197a

File tree

4 files changed

+533
-29
lines changed

4 files changed

+533
-29
lines changed

flink-kubernetes-operator-api/pom.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ under the License.
212212
<include>flinkdeployments.flink.apache.org-v1.yml</include>
213213
<include>flinksessionjobs.flink.apache.org-v1.yml</include>
214214
<include>flinkstatesnapshots.flink.apache.org-v1.yml</include>
215+
<include>flinkbluegreendeployments.flink.apache.org-v1.yml</include>
215216
</includes>
216217
<filtering>false</filtering>
217218
</resource>
@@ -236,6 +237,8 @@ under the License.
236237
<classpath refid="maven.compile.classpath"/>
237238
<arg value="file://${rootDir}/helm/flink-kubernetes-operator/crds/flinkdeployments.flink.apache.org-v1.yml"/>
238239
<arg value="https://raw.githubusercontent.com/apache/flink-kubernetes-operator/release-1.9.0/helm/flink-kubernetes-operator/crds/flinkdeployments.flink.apache.org-v1.yml"/>
240+
<arg value="https://raw.githubusercontent.com/apache/flink-kubernetes-operator/release-1.10.0/helm/flink-kubernetes-operator/crds/flinkdeployments.flink.apache.org-v1.yml"/>
241+
<arg value="https://raw.githubusercontent.com/apache/flink-kubernetes-operator/release-1.11.0/helm/flink-kubernetes-operator/crds/flinkdeployments.flink.apache.org-v1.yml"/>
239242
</java>
240243
</target>
241244
</configuration>
@@ -253,6 +256,24 @@ under the License.
253256
<classpath refid="maven.compile.classpath"/>
254257
<arg value="file://${rootDir}/helm/flink-kubernetes-operator/crds/flinksessionjobs.flink.apache.org-v1.yml"/>
255258
<arg value="https://raw.githubusercontent.com/apache/flink-kubernetes-operator/release-1.9.0/helm/flink-kubernetes-operator/crds/flinksessionjobs.flink.apache.org-v1.yml"/>
259+
<arg value="https://raw.githubusercontent.com/apache/flink-kubernetes-operator/release-1.10.0/helm/flink-kubernetes-operator/crds/flinksessionjobs.flink.apache.org-v1.yml"/>
260+
<arg value="https://raw.githubusercontent.com/apache/flink-kubernetes-operator/release-1.11.0/helm/flink-kubernetes-operator/crds/flinksessionjobs.flink.apache.org-v1.yml"/>
261+
</java>
262+
</target>
263+
</configuration>
264+
</execution>
265+
<execution>
266+
<id>flinkbgdeployments-remove-scale-subresource</id>
267+
<phase>package</phase>
268+
<goals>
269+
<goal>run</goal>
270+
</goals>
271+
<configuration>
272+
<target>
273+
<java classname="org.apache.flink.kubernetes.operator.api.utils.RemoveScaleSubResource"
274+
fork="true" failonerror="true">
275+
<classpath refid="maven.compile.classpath"/>
276+
<arg value="${rootDir}/helm/flink-kubernetes-operator/crds/flinkbluegreendeployments.flink.apache.org-v1.yml"/>
256277
</java>
257278
</target>
258279
</configuration>

flink-kubernetes-operator-api/src/main/java/org/apache/flink/kubernetes/operator/api/status/FlinkBlueGreenDeploymentStatus.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,4 @@ public class FlinkBlueGreenDeploymentStatus {
5252

5353
/** Timestamp when the deployment became READY/STABLE. Used to determine when to delete it. */
5454
private String deploymentReadyTimestamp;
55-
56-
/** Information about the TaskManagers for the scale subresource. */
57-
private TaskManagerInfo taskManager;
5855
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.flink.kubernetes.operator.api.utils;
19+
20+
import java.nio.file.Files;
21+
import java.nio.file.Paths;
22+
import java.util.stream.Collectors;
23+
24+
/**
25+
* Utility to remove scale subresource from CRD. Required by the {@link
26+
* org.apache.flink.kubernetes.operator.api.FlinkBlueGreenDeployment}.
27+
*/
28+
public class RemoveScaleSubResource {
29+
30+
public static void main(String[] args) throws Exception {
31+
var path = Paths.get(args[0]);
32+
var filtered =
33+
Files.readAllLines(path).stream()
34+
.filter(line -> !line.trim().equals("scale:"))
35+
.filter(line -> !line.trim().startsWith("specReplicasPath:"))
36+
.collect(Collectors.toList());
37+
38+
// Write back (overwrites file)
39+
Files.write(path, filtered);
40+
}
41+
}

0 commit comments

Comments
 (0)