Skip to content

Commit 95b0750

Browse files
committed
Resolving conflicts after rebasing from main (FlinkConfiguration is now a ConfigObjectNode) and updating B/G e2e tests.
1 parent 0398adc commit 95b0750

File tree

3 files changed

+24
-30
lines changed

3 files changed

+24
-30
lines changed

e2e-tests/test_bluegreen_laststate.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ TIMEOUT=300
4242
#echo "APPLICATION_IDENTIFIER " $APPLICATION_IDENTIFIER
4343
#echo "BLUE_APPLICATION_IDENTIFIER " $BLUE_APPLICATION_IDENTIFIER
4444

45-
#on_exit cleanup_and_exit "$APPLICATION_YAML" $TIMEOUT $BG_CLUSTER_ID
45+
on_exit cleanup_and_exit "$APPLICATION_YAML" $TIMEOUT $BG_CLUSTER_ID
4646

4747
retry_times 5 30 "kubectl apply -f $APPLICATION_YAML" || exit 1
4848

@@ -52,11 +52,11 @@ wait_for_status $BLUE_APPLICATION_IDENTIFIER '.status.lifecycleState' STABLE ${T
5252
wait_for_status $APPLICATION_IDENTIFIER '.status.jobStatus.state' RUNNING ${TIMEOUT} || exit 1
5353
wait_for_status $APPLICATION_IDENTIFIER '.status.blueGreenState' ACTIVE_BLUE ${TIMEOUT} || exit 1
5454

55-
blue_job_id=$(kubectl get -oyaml flinkdep/basic-bluegreen-example-blue | yq '.status.jobStatus.jobId')
55+
#blue_job_id=$(kubectl get -oyaml flinkdep/basic-bluegreen-example-blue | yq '.status.jobStatus.jobId')
5656

57-
echo "Giving a chance for checkpoints to be generated..."
58-
sleep 5
5957
kubectl patch flinkbgdep ${BG_CLUSTER_ID} --type merge --patch '{"spec":{"template":{"spec":{"flinkConfiguration":{"rest.port":"8082","state.checkpoints.num-retained":"51"}}}}}'
58+
echo "Resource patched, giving a chance for the savepoint to be taken..."
59+
sleep 10
6060

6161
wait_for_status $GREEN_APPLICATION_IDENTIFIER '.status.lifecycleState' STABLE ${TIMEOUT} || exit 1
6262
kubectl wait --for=delete deployment --timeout=${TIMEOUT}s --selector="app=${BLUE_CLUSTER_ID}"
@@ -65,7 +65,7 @@ wait_for_status $APPLICATION_IDENTIFIER '.status.blueGreenState' ACTIVE_GREEN ${
6565

6666
green_initialSavepointPath=$(kubectl get -oyaml $GREEN_APPLICATION_IDENTIFIER | yq '.spec.job.initialSavepointPath')
6767

68-
if [[ $green_initialSavepointPath == '/flink-data/checkpoints/'$blue_job_id* ]]; then
68+
if [[ $green_initialSavepointPath == '/flink-data/savepoints/savepoint-'* ]]; then
6969
echo 'Green deployment started from the expected initialSavepointPath: ' $green_initialSavepointPath
7070
else
7171
echo 'Unexpected initialSavepointPath: ' $green_initialSavepointPath

e2e-tests/test_bluegreen_stateless.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ wait_for_status $BLUE_APPLICATION_IDENTIFIER '.status.lifecycleState' STABLE ${T
4747
wait_for_status $APPLICATION_IDENTIFIER '.status.jobStatus.state' RUNNING ${TIMEOUT} || exit 1
4848
wait_for_status $APPLICATION_IDENTIFIER '.status.blueGreenState' ACTIVE_BLUE ${TIMEOUT} || exit 1
4949

50-
blue_job_id=$(kubectl get -oyaml flinkdep/basic-bluegreen-example-blue | yq '.status.jobStatus.jobId')
51-
5250
echo "PATCHING B/G deployment..."
5351
kubectl patch flinkbgdep ${BG_CLUSTER_ID} --type merge --patch '{"spec":{"template":{"spec":{"flinkConfiguration":{"rest.port":"8082","taskmanager.numberOfTaskSlots":"2"}}}}}'
5452

flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/controller/FlinkBlueGreenDeploymentControllerTest.java

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.apache.flink.kubernetes.operator.TestingFlinkService;
2626
import org.apache.flink.kubernetes.operator.api.FlinkBlueGreenDeployment;
2727
import org.apache.flink.kubernetes.operator.api.FlinkDeployment;
28+
import org.apache.flink.kubernetes.operator.api.spec.ConfigObjectNode;
2829
import org.apache.flink.kubernetes.operator.api.spec.FlinkBlueGreenDeploymentSpec;
2930
import org.apache.flink.kubernetes.operator.api.spec.FlinkDeploymentSpec;
3031
import org.apache.flink.kubernetes.operator.api.spec.FlinkDeploymentTemplateSpec;
@@ -270,12 +271,8 @@ public void verifyFailureDuringTransition(FlinkVersion flinkVersion) throws Exce
270271
rs.reconciledStatus.getBlueGreenState());
271272
assertEquals(
272273
customValue,
273-
rs.deployment
274-
.getSpec()
275-
.getTemplate()
276-
.getSpec()
277-
.getFlinkConfiguration()
278-
.get(CUSTOM_CONFIG_FIELD));
274+
getFlinkConfigurationValue(
275+
rs.deployment.getSpec().getTemplate().getSpec(), CUSTOM_CONFIG_FIELD));
279276

280277
// Simulating the Blue deployment doesn't start correctly (status will remain the same)
281278
Long reschedDelayMs = 0L;
@@ -328,6 +325,11 @@ public void verifyFailureDuringTransition(FlinkVersion flinkVersion) throws Exce
328325
testTransitionToGreen(rs, customValue, null);
329326
}
330327

328+
private static String getFlinkConfigurationValue(
329+
FlinkDeploymentSpec flinkDeploymentSpec, String propertyName) {
330+
return flinkDeploymentSpec.getFlinkConfiguration().get(propertyName).asText();
331+
}
332+
331333
@ParameterizedTest
332334
@MethodSource("org.apache.flink.kubernetes.operator.TestUtils#flinkVersions")
333335
public void verifySpecChangeDuringTransition(FlinkVersion flinkVersion) throws Exception {
@@ -702,11 +704,9 @@ public void verifySpecificBehavior(
702704
assertEquals(1, deployments.size());
703705
assertEquals(
704706
"100 SECONDS",
705-
deployments
706-
.get(0)
707-
.getSpec()
708-
.getFlinkConfiguration()
709-
.get("kubernetes.operator.reconcile.interval"));
707+
getFlinkConfigurationValue(
708+
deployments.get(0).getSpec(),
709+
"kubernetes.operator.reconcile.interval"));
710710
}
711711
}
712712

@@ -763,11 +763,9 @@ public void verifySpecificBehavior(
763763
// Child spec change should be applied to FlinkDeployment
764764
assertEquals(
765765
"100 SECONDS",
766-
deployments
767-
.get(0)
768-
.getSpec()
769-
.getFlinkConfiguration()
770-
.get("kubernetes.operator.reconcile.interval"));
766+
getFlinkConfigurationValue(
767+
deployments.get(0).getSpec(),
768+
"kubernetes.operator.reconcile.interval"));
771769

772770
// Top-level changes should be preserved in reconciled spec
773771
assertNotNull(result.rs.reconciledStatus.getLastReconciledSpec());
@@ -1043,12 +1041,8 @@ private void testTransitionToGreen(
10431041
assertEquals(0, instantStrToMillis(rs.reconciledStatus.getDeploymentReadyTimestamp()));
10441042
assertEquals(
10451043
customValue,
1046-
rs.deployment
1047-
.getSpec()
1048-
.getTemplate()
1049-
.getSpec()
1050-
.getFlinkConfiguration()
1051-
.get(CUSTOM_CONFIG_FIELD));
1044+
getFlinkConfigurationValue(
1045+
rs.deployment.getSpec().getTemplate().getSpec(), CUSTOM_CONFIG_FIELD));
10521046

10531047
// Initiate and mark the Green deployment ready
10541048
simulateSuccessfulJobStart(getFlinkDeployments().get(1));
@@ -1213,12 +1207,14 @@ private static FlinkBlueGreenDeploymentSpec getTestFlinkDeploymentSpec(FlinkVers
12131207
.imagePullPolicy(IMAGE_POLICY)
12141208
.serviceAccount(SERVICE_ACCOUNT)
12151209
.flinkVersion(version)
1216-
.flinkConfiguration(conf)
1210+
.flinkConfiguration(new ConfigObjectNode())
12171211
.jobManager(new JobManagerSpec(new Resource(1.0, "2048m", "2G"), 1, null))
12181212
.taskManager(
12191213
new TaskManagerSpec(new Resource(1.0, "2048m", "2G"), null, null))
12201214
.build();
12211215

1216+
flinkDeploymentSpec.setFlinkConfiguration(conf);
1217+
12221218
Map<String, String> configuration = new HashMap<>();
12231219
configuration.put(ABORT_GRACE_PERIOD.key(), "1");
12241220
configuration.put(RECONCILIATION_RESCHEDULING_INTERVAL.key(), "500");

0 commit comments

Comments
 (0)