Skip to content

Commit

Permalink
Fix completion mode field when creating a K8s Job resource and Flyway
Browse files Browse the repository at this point in the history
Fix quarkusio#33085

(cherry picked from commit adb04e9)
  • Loading branch information
Sgitario authored and gsmet committed May 9, 2023
1 parent f434b32 commit ff63ae1
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 ff63ae1

Please sign in to comment.