Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ default Config getClientConfiguration() {
* @return {@code true} if CRDs should be checked (default), {@code false} otherwise
*/
default boolean checkCRDAndValidateLocalModel() {
return true;
return false;
}

int DEFAULT_RECONCILIATION_THREADS_NUMBER = 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static boolean isValidateCustomResourcesEnvVarSet() {
}

public static boolean shouldCheckCRDAndValidateLocalModel() {
return getBooleanFromSystemPropsOrDefault(CHECK_CRD_ENV_KEY, true);
return getBooleanFromSystemPropsOrDefault(CHECK_CRD_ENV_KEY, false);
}

public static boolean debugThreadPool() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ void shouldProvideTheSetInstanceIfProvided() {
@Test
void shouldBePossibleToOverrideConfigOnce() {
final var config = new AbstractConfigurationService(null);
assertTrue(config.checkCRDAndValidateLocalModel());
assertFalse(config.checkCRDAndValidateLocalModel());

ConfigurationServiceProvider.set(config);
var instance = ConfigurationServiceProvider.instance();
assertEquals(config, instance);

ConfigurationServiceProvider.overrideCurrent(o -> o.checkingCRDAndValidateLocalModel(false));
ConfigurationServiceProvider.overrideCurrent(o -> o.checkingCRDAndValidateLocalModel(true));
instance = ConfigurationServiceProvider.instance();
assertNotEquals(config, instance);
assertFalse(instance.checkCRDAndValidateLocalModel());
assertTrue(instance.checkCRDAndValidateLocalModel());

assertThrows(IllegalStateException.class,
() -> ConfigurationServiceProvider.overrideCurrent(o -> o.withCloseClientOnStop(false)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
class UtilsTest {

@Test
void shouldCheckCRDAndValidateLocalModelByDefault() {
assertTrue(Utils.shouldCheckCRDAndValidateLocalModel());
void shouldNotCheckCRDAndValidateLocalModelByDefault() {
assertFalse(Utils.shouldCheckCRDAndValidateLocalModel());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.junit.jupiter.api.Test;

import io.fabric8.kubernetes.api.model.Secret;
import io.javaoperatorsdk.operator.MissingCRDException;
import io.javaoperatorsdk.operator.MockKubernetesClient;
import io.javaoperatorsdk.operator.api.config.ConfigurationServiceProvider;
import io.javaoperatorsdk.operator.api.config.ControllerConfiguration;
Expand All @@ -12,7 +11,6 @@
import io.javaoperatorsdk.operator.sample.simple.TestCustomResource;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.*;

@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -47,19 +45,6 @@ void crdShouldNotBeCheckedForCustomResourcesIfDisabled() {
}
}

@Test
void crdShouldBeCheckedForCustomResourcesByDefault() {
ConfigurationServiceProvider.reset();
final var client = MockKubernetesClient.client(TestCustomResource.class);
when(configuration.getResourceClass()).thenReturn(TestCustomResource.class);

final var controller = new Controller<TestCustomResource>(reconciler, configuration, client);
// since we're not really connected to a cluster and the CRD wouldn't be deployed anyway, we
// expect a MissingCRDException to be thrown
assertThrows(MissingCRDException.class, controller::start);
verify(client, times(1)).apiextensions();
}

@Test
void usesFinalizerIfThereIfReconcilerImplementsCleaner() {
Reconciler reconciler = mock(Reconciler.class, withSettings().extraInterfaces(Cleaner.class));
Expand Down