Skip to content

Commit

Permalink
Merge pull request #33086 from Sgitario/33085
Browse files Browse the repository at this point in the history
Fix completion mode field when creating a K8s Job resource and Flyway
  • Loading branch information
iocanel authored May 7, 2023
2 parents 0951b3d + adb04e9 commit a6d6478
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import java.util.List;

import io.dekorate.kubernetes.annotation.JobCompletionMode;
import io.dekorate.kubernetes.annotation.JobRestartPolicy;
import io.dekorate.kubernetes.decorator.ResourceProvidingDecorator;
import io.fabric8.kubernetes.api.model.KubernetesListBuilder;
import io.fabric8.kubernetes.api.model.batch.v1.JobBuilder;
Expand All @@ -15,8 +17,8 @@
**/
public class CreateJobResourceFromImageDecorator extends ResourceProvidingDecorator<KubernetesListBuilder> {

private static final String DEFAULT_RESTART_POLICY = "OnFailure";
private static final String DEFAULT_COMPLETION_MODE = "OnFailure";
private static final String DEFAULT_RESTART_POLICY = JobRestartPolicy.OnFailure.name();
private static final String DEFAULT_COMPLETION_MODE = JobCompletionMode.NonIndexed.name();

private final String name;
private final String image;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ public void assertGeneratedResources() throws IOException {

assertThat(job.get()).satisfies(j -> {
assertThat(j.getSpec()).satisfies(jobSpec -> {
assertThat(jobSpec.getCompletionMode()).isEqualTo("NonIndexed");
assertThat(jobSpec.getTemplate()).satisfies(t -> {
assertThat(t.getSpec()).satisfies(podSpec -> {
assertThat(podSpec.getRestartPolicy()).isEqualTo("OnFailure");
assertThat(podSpec.getContainers()).singleElement().satisfies(container -> {
assertThat(container.getName()).isEqualTo("flyway-init");
assertThat(container.getEnv()).filteredOn(env -> "QUARKUS_FLYWAY_ENABLED".equals(env.getName()))
Expand Down

0 comments on commit a6d6478

Please sign in to comment.