Skip to content

Commit

Permalink
[FLINK-17332][k8s] Fix restart policy not equals to Never for native …
Browse files Browse the repository at this point in the history
…task manager pods

This closes apache#11949 .
  • Loading branch information
zhengcanbin authored and tisonkun committed May 6, 2020
1 parent fef974d commit 04ab8d2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public FlinkPod decorateFlinkPod(FlinkPod flinkPod) {
.withAnnotations(kubernetesTaskManagerParameters.getAnnotations())
.endMetadata()
.editOrNewSpec()
.withRestartPolicy(Constants.RESTART_POLICY_OF_NEVER)
.withImagePullSecrets(kubernetesTaskManagerParameters.getImagePullSecrets())
.withNodeSelector(kubernetesTaskManagerParameters.getNodeSelector())
.withTolerations(kubernetesTaskManagerParameters.getTolerations().stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,6 @@ public class Constants {
public static final String HEADLESS_SERVICE_CLUSTER_IP = "None";

public static final int MAXIMUM_CHARACTERS_OF_CLUSTER_ID = 45;

public static final String RESTART_POLICY_OF_NEVER = "Never";
}
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ public void testPodAnnotations() {
assertThat(resultAnnotations, is(equalTo(ANNOTATIONS)));
}

@Test
public void testRestartPolicy() {
final String resultRestartPolicy = this.resultPod.getSpec().getRestartPolicy();

assertThat(resultRestartPolicy, is(Constants.RESTART_POLICY_OF_NEVER));
}

@Test
public void testImagePullSecrets() {
final List<String> resultSecrets = this.resultPod.getSpec().getImagePullSecrets()
Expand Down

0 comments on commit 04ab8d2

Please sign in to comment.