mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-10 15:32:05 -03:30
fix: removing lifecylce in initContainers
closes: #40360 Signed-off-by: Steve Hawkins <shawkins@redhat.com>
This commit is contained in:
parent
78f575b53b
commit
bd1496109e
@ -193,8 +193,9 @@ public class KeycloakUpdateJobDependentResource extends CRUDKubernetesDependentR
|
||||
containerBuilder.withVolumeMounts(newVolumeMounts);
|
||||
}
|
||||
|
||||
// remove restart policy and probes
|
||||
// remove restart policy, lifecycle, and probes
|
||||
containerBuilder.withRestartPolicy(null);
|
||||
containerBuilder.withLifecycle(null);
|
||||
containerBuilder.withReadinessProbe(null);
|
||||
containerBuilder.withLivenessProbe(null);
|
||||
containerBuilder.withStartupProbe(null);
|
||||
|
||||
@ -70,6 +70,7 @@ import java.util.stream.Collectors;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.keycloak.operator.ContextUtils.DIST_CONFIGURATOR_KEY;
|
||||
import static org.keycloak.operator.ContextUtils.NEW_DEPLOYMENT_KEY;
|
||||
@ -739,4 +740,16 @@ public class PodTemplateTest {
|
||||
assertEquals(List.of(new LocalObjectReference("new-secret"), new LocalObjectReference("secret")), job.getSpec().getTemplate().getSpec().getImagePullSecrets());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFieldRemovalForInitContainer() {
|
||||
Job job = getUpdateJob(builder -> {
|
||||
}, builder -> builder.withNewUnsupported().withNewPodTemplate().withNewSpec().addNewContainer()
|
||||
.withRestartPolicy("OnFailure")
|
||||
.withNewLifecycle().withNewPostStart().withNewExec().withCommand("hello").endExec().endPostStart()
|
||||
.endLifecycle().endContainer().endSpec().endPodTemplate().endUnsupported(), builder -> {
|
||||
});
|
||||
assertNull(job.getSpec().getTemplate().getSpec().getInitContainers().get(0).getLifecycle());
|
||||
assertNull(job.getSpec().getTemplate().getSpec().getInitContainers().get(0).getRestartPolicy());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user